I have hit a problem when I have only 1 parameter I want to monitor. JAGS runs ok, then I get
Calculating statistics.......
Error in strsplit(params, "\\[") : non-character argument
I hit this first with jagsUI 1.3.7, but same problem with 1.3.9. Here's an example:
library(jagsUI)
modelstring = "
model {
# Prior:
tau <- pow(40, -2) # Calculate precision for SD=40
N ~ dnorm(448, tau) # No. of ou in whole area
n <- N * a # No. of ou in area a
# Likelihood:
C ~ dpois(n)
} " # close quote for modelstring
writeLines(modelstring, con="model.txt")
jagsData <- list(a = 1/8, C = 45)
jagsout <- jags(jagsData, inits=NULL, parameters.to.save="N", model.file="model.txt",
n.chains=3, n.adapt=100, n.iter=1100, n.burnin=100, n.thin=1, DIC=FALSE)
It doesn't happen if DIC=TRUE, as then deviance is also monitored, nor when I insert a dummy parameter in the JAGS model (dummy ~ dnorm(0, 1)) and monitor that as well.
Could this be due to R's habit of changing 1-column matrices to vectors? If so, may need a [..., drop=FALSE] somewhere.
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] jagsUI_1.3.9 lattice_0.20-33
loaded via a namespace (and not attached):
[1] parallel_3.2.3 coda_0.18-1 grid_3.2.3 rjags_4-4
I have hit a problem when I have only 1 parameter I want to monitor. JAGS runs ok, then I get
I hit this first with jagsUI 1.3.7, but same problem with 1.3.9. Here's an example:
It doesn't happen if
DIC=TRUE
, as thendeviance
is also monitored, nor when I insert a dummy parameter in the JAGS model (dummy ~ dnorm(0, 1)
) and monitor that as well.Could this be due to R's habit of changing 1-column matrices to vectors? If so, may need a
[..., drop=FALSE]
somewhere.