Error: Defining model

15 views
Skip to first unread message

Nito Furtado

unread,
Aug 4, 2022, 9:01:16 AM8/4/22
to nimble-users
Hi everyone.
I am defining the following dist
Screen Shot 2022-08-04 at 11.50.30.png
I am using the following code to create my nimblefunction, 

dHGA <- nimbleFunction(
    run = function(x = double(0),
                   p = double(0),
                   alfa = double(0),
                   beta = double(0),
                   log = integer(0, default = 0)
    ) {
      returnType(double(0))
      if (x > 0) prob <- (1 - p) * dgamma(x, shape = alfa, rate = beta) else prob <-  p
      return(prob)
    }
  )
but when i try to use it  in the nimbleMCMC, I get the following error message

Defining model
  [Note] Registering 'dGHA' as a distribution based on its use in BUGS code. If you make changes to the nimbleFunctions for the distribution, you must call 'deregisterDistributions' before using the distribution in BUGS code for those changes to take effect.
Error in FUN(X[[i]], ...) :
  checkDistributionFunctions: density function for dGHA is not available.  It must be a nimbleFunction (with no setup code).

Thanks in advance.
Sorry for such a basic question.

Ben Goldstein

unread,
Aug 4, 2022, 11:02:11 AM8/4/22
to Nito Furtado, nimble-users
Based on the error message, it looks like you might have misspelled the function dHGA as dGHA somewhere in your model!

Hope that helps. 
Ben

--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/bdc35a35-8b1c-4feb-b154-ced484856803n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages