Hi - I'm fitting a series of random effects meta-analyses using JAGS (using R2jags in R). I've pasted the model, the dataset, consisting of only two studies, and the output including error messages. Any ideas why this is failing? Works for comparisons with more than 2 studies and for other priors. Thanks. --Dale
My model is:
model
{
for( i in 1 : Nstud ) {
rA[i] ~ dbin(pA[i], nA[i])
rB[i] ~ dbin(pB[i], nB[i])
logit(pA[i]) <- mu[i]
logit(pB[i]) <- mu[i] + delta[i]
mu[i] ~ dnorm(0.0,1.0E-5)
delta[i] ~ dnorm(d, prec)
}
OR <- exp(d)
d ~ dnorm(0.0,1.0E-6)
prec ~ dgamma(0.001, 0.001)
tau <- 1/sqrt(prec)
tau.sq<-tau*tau
}
library(R2jags)
(c1 <- ombpoL2[[7]]) (R data frame) shown below:
|********| 100%
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in if ((W > 1e-08) && (n.chains > 1)) { :
missing value where TRUE/FALSE needed
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi - I'm fitting a series of random effects meta-analyses using JAGS (using
R2jags in R). I've pasted the model, the dataset, consisting of only two
studies, and the output including error messages. Any ideas why this is
failing? Works for comparisons with more than 2 studies and for other
priors. Thanks. --Dale
My model is:
model
{
for( i in 1 : Nstud ) {
rA[i] ~ dbin(pA[i], nA[i])
rB[i] ~ dbin(pB[i], nB[i])
logit(pA[i]) <- mu[i]
logit(pB[i]) <- mu[i] + delta[i]
mu[i] ~ dnorm(0.0,1.0E-5)
delta[i] ~ dnorm(d, prec)
}
OR <- exp(d)
d ~ dnorm(0.0,1.0E-6)
prec ~ dgamma(0.001, 0.001)
tau <- 1/sqrt(prec)
tau.sq<-tau*tau
}
library(R2jags)
(c1 <- ombpoL2[[7]]) (R data frame) shown below:
|**| 100%
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in if ((W > 1e-08) && (n.chains > 1)) { :
missing value where TRUE/FALSE needed
Random Effects meta-analysis: JAGS quits with errors for data with only two
studies
Hi - I'm fitting a series of random effects meta-analyses using JAGS (using R2jags in R). I've pasted the model, the dataset, consisting of only two studies, and the output including error messages. Any ideas why this is failing? Works for comparisons with more than 2 studies and for other priors. Thanks. --Dale
My model is:
model
{
for( i in 1 : Nstud ) {
rA[i] ~ dbin(pA[i], nA[i])
rB[i] ~ dbin(pB[i], nB[i])
logit(pA[i]) <- mu[i]
logit(pB[i]) <- mu[i] + delta[i]
mu[i] ~ dnorm(0.0,1.0E-5)
delta[i] ~ dnorm(d, prec)
}
OR <- exp(d)
d ~ dnorm(0.0,1.0E-6)
prec ~ dgamma(0.001, 0.001)
tau <- 1/sqrt(prec)
tau.sq<-tau*tau
}
library(R2jags)
(c1 <- ombpoL2[[7]]) (R data frame) shown below:
events1 events2 noevents1 noevents2 N1 N2
7 2 71 73 78 75
0 6 147 141 147 147
library(R2jags)
Nstud <- dim(c1)[1]
rA <- c1$events2; rB <- c1$events1; nA <- c1$N2; nB <- c1$N1
data <- list("rA", "rB", "nA", "nB", "Nstud")
params <- c("OR", "d", "delta", "tau", "tau.sq")
init1 <- list("d"=0, "prec"=1, "delta"= rep(0, Nstud), "mu"=rep(0, Nstud))
init2 <- list("d"=0, "prec"=2, "delta"= rep(0, Nstud), "mu"=rep(0, Nstud))
init3 <- list("d"=0, "prec"=0.25, "delta"= rep(0, Nstud), "mu"=rep(0, Nstud))
inits <- list(init1, init2, init3)
load.module("glm")
m.c1 <- jags(data=data, inits=inits, parameters.to.save=params,
n.chains=3, n.iter=15000, n.burnin=1000, n.thin=1, model.file="invgamma.bug")
Output follows:
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph Size: 30
Initializing model
|********| 100%
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
Error in if ((W > 1e-08) && (n.chains > 1)) { :
missing value where TRUE/FALSE needed
The error is from R2jags, not JAGS itself. It might help if you run the example
with options(error=recover).
Krzysztof
On Wed, Aug 21, 2013 at 7:11 PM, Dale Steele eleetselad@users.sf.net wrote:
--
Krzysztof Sakrejda
Organismic and Evolutionary Biology
University of Massachusetts, Amherst
319 Morrill Science Center South
611 N. Pleasant Street
Amherst, MA 01003
work #: 413-325-6555
email: sakrejda@cns.umass.edu