Closed wlandau closed 3 years ago
Reproducible example:
model <- "model { for (i in 1:n) { y[i] ~ dnorm(x[i] * beta, 1) } beta ~ dnorm(0, 1) }" tmp <- tempfile() writeLines(model, tmp) data <- list( n = 10, x = rnorm(10), y = rnorm(10) ) library(coda) out <- capture.output( R2jags::jags( data, parameters.to.save = "beta", model.file = tmp, n.chains = 4, DIC = FALSE ) ) #> module glm loaded #> module dic loaded #> Error in apply(sims.matrix, 2, mean): dim(X) must have a positive length
Created on 2020-12-21 by the reprex package (v0.3.0)
Seems to be caused by sims.matrix = sims[, rank.long] as opposed to sims.matrix = sims[, rank.long, drop = FALSE]. My guess is this only happens for one-parameter models.
sims.matrix = sims[, rank.long]
sims.matrix = sims[, rank.long, drop = FALSE]
Reproducible example:
Created on 2020-12-21 by the reprex package (v0.3.0)