Recent changes to 25: Can't initialize variable with a vector with all NAshttps://sourceforge.net/p/mcmc-jags/bugs/25/Recent changes to 25: Can't initialize variable with a vector with all NAsenThu, 22 Nov 2012 14:39:37 -0000Can't initialize variable with a vector with all NAshttps://sourceforge.net/p/mcmc-jags/bugs/25/While making an R function that runs a JAGS model for left censored data I discovered that it is not possible to initialize a variable with a vector with all NAs. Initializing using a vector where some elements are NA works and has the effect (if I understood it right) that the values corresponding to the NAs get initialized automatically. Therefore I was a bit surprised to to get an error message when initializing an variable with a vector with all NAs which I assumed would be the same as not initializing the variable at all.
The following R code replicates the error on JAGS 3.3.0, rjags version 3-7, Ubuntu 10.4.
library(rjags)
model_string <- "model{
for(i in 1:3) {
y[i] ~ dnorm(0, 1)
}
}"
# Works
jags.model(textConnection(model_string), data=list(y=c(10, NA, NA)), inits=list(y = c(NA, NA, 5)))
# Works
jags.model(textConnection(model_string), data=list(y=c(10, NA, NA)))
# Reports "Invalid initial values"
jags.model(textConnection(model_string), data=list(y=c(10, NA, NA)), inits=list(y = c(NA, NA, NA)))Rasmus BååthThu, 22 Nov 2012 14:39:37 -0000https://sourceforge.net319225b5facf7b3be1b60977a2f43ab24c2cad9b