r - JAGS - different values in BUGSoutput$summary and BUGSoutput$mean -
i ran state-space model in r using r2jags
package , noticed strange issue in model output. among parameters calculated model have deterministic node, is, log counts backtransformed.
nh[g,t] <- exp(lognh[g,t])
where g
, t
respectively site , time indices
in model output means reported on out$bugsoutput$mean
, out$bugsoutput$summary
no correspond time point on
cbind(out$bugsoutput$mean$nh[1,], out$bugsoutput$summary["nh[1,]",1]) [,1] [,2] nh[1,1] 7.889378 7.889378 nh[1,2] 7.461558 7.461558 nh[1,3] 7.212565 7.212565 nh..... ........ ........ nh[1,9] 5.180559 5.180559 nh[1,10] 4.987814 4.987814 nh[1,11] 5.780468 4.689696 #here starts diverging nh[1,12] 1.181960 4.311867 nh[1,13] 2.050339 3.920243 nh[1,14] 25.607913 3.693816 nh[1,15] 4.915882 3.549902
i tried calculate manually means accessing mcmc chains (iterations=100000, burning=50000, thinnning=9, 3 chains), test output correct. example, mean of node nh[1,14]
resulted
nh <- aperm(out$bugsoutput$sims.list$nh, c(2,3,1)) # simple array transposition stack iterations mean(nh[1,14,]) [1] 25.60791
i cannot understand difference in reported means.
Comments
Post a Comment