[R-sig-ME] glm module in

Ben Bolker bbolker at gmail.com
Mon Sep 19 22:53:08 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


  I'm curious whether anyone knows whether, or how, the following model
can be made to use the 'glm' module in JAGS ... I followed the advice in
<https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/005780.html>
and looked at list.samplers() on the result, with the following outcome:

> unique(names(list.samplers(ooo$model)))
[1] "FiniteMethod"  "RealSlicer"    "ConjugateBeta"

  i.e. no glm module.

  I'm using
[1] R2jags_0.02-15   rjags_2.2.0-4    R2WinBUGS_2.1-18 coda_0.14-4

 which uses JAGS 2.2.0 (I haven't spent the time yet to figure out how
to upgrade), but a glance at the manual suggests that the glm module
hasn't changed radically since then ...

  For background, the model is a mixed zero-inflated Poisson, with the
model matrix constructed in R and passed into JAGS in the data.

  If I have time I will work to break this down to a simpler example,
but in the meantime if anyone happens to have any bright ideas ...

  sincerely
    Ben Bolker
============

model {

  ## PRIORS
  for (m in 1:5){
    beta[m] ~ dnorm(0, 0.01)           # Linear effects
  }
  alpha ~ dnorm(0, .01)
  sigma ~ dunif(0, 5)
  tau <- 1/(sigma*sigma)
  psi ~ dunif(0, 1)
  for(j in 1:nnests){
     a[j] ~ dnorm(0, tau)
   }

   for(i in 1:N){
       SibNeg[i] ~ dpois(mu[i])
       mu[i] <- lambda[i]*z[i]+0.00001
     ## hack required for Rjags -- otherwise 'incompatible'
       z[i] ~ dbern(psi)
       log(lambda[i]) <- offset[i] + alpha +
              inprod(X[i,],beta) + a[nest[i]]
   }
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOd6u0AAoJED2whTVMEyK9o5IIAKDcv+4sjz5AStVe8MNQDTNh
R0ikDHclUQZE4gvVeMahnjR/ae5wggaZ01N7rVI7k46SuGgz7Fo12WiHyMtIAy5U
JDh1h+1X+pVkshKsBV1A6qOSBcyfFFpBEgzAJTAed+2KmiT5R7wiQQh3QLa6UqN/
/6Qkq6mPi3YKeojg76gLBh5iT3U8FeBYpEpDOHYwsWaU/YmYoiOS5be66UPvryUJ
KXl7OJNQHjio+rWeq27Hn4sO3iSjmJTf7Wmpfw1474kfSlTn/BhsLM12FA2tWQpi
g9OwVT8VWSeezYEfmt8eG8vztZu2ER0szARmyIQ7gkOeM8F1y7NebENBWFKa4qQ=
=m1bV
-----END PGP SIGNATURE-----




More information about the R-sig-mixed-models mailing list