0
$\begingroup$

Can the zeros trick be applied for specifying a new distribution for modeled parameters such as a varying intercept model? I am trying to estimate a hierarchial model (like the following) where I have a generalized gamma for my data level model and I want to have an inverse generalised gamma for modeling the varying intercepts:

sink("invgam.txt")
cat("model{

constant <- 100
gam <- 1

for (i in 1:len.data){

   y[i] ~ dgen.gamma(alpha, lambda[i], gam)
   lambda[i] <- exp(lambda.id[indiv[i]] + b1*x1[i]) }

   for (j in 1:len.grp){
     ... sample lambda.id[j] from an inverse gen gamma ....
   }

 # Priors

}")
sink()

But there isn't a defined inverse gen gamma (IGG) distribution in JAGS. So, when I try to use the zeros trick for instance like this:

z[j] ~ dpois(phi[j])
phi[j] <- - log(gam) + loggam(nu) + nu*gam*log(theta) - (- nu*gam - 1)*log(lambda.id[j]) + 
                 pow(1/(theta*lambda.id[j]),gam) + constant

this error appears:

Compilation error on line 13.
Unknown variable lambda.id
Either supply values for this variable with the data
or define it on the left hand side of a relation.

I'm not sure if I am approaching this the right way. Any ideas how to correctly use the zeros trick in this situation?

Thanks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.