1 year ago

#233896

test-img

soothe

BAYESIAN BINOMIAL MODEL

I am trying to fit a log-binomial model with the code below for aggregated binomial data but keeps getting this error:

"Error: The following error occured when compiling and adapting the model using rjags:
Error in rjags::jags.model(model, data = dataenv, inits = inits, n.chains = length(runjags.object$end.state), :
Error in node y[1] Invalid parent values"

However, it works perfectly when i use the "logit" link. How do get around it since my interest is in the estimation of RR and not OR.

Any idea on how to program the zero-one trick for jags?

###MODEL SPECIFICATION 
modelString="
model {
 ### Prior distributions
beta.trt2 ~ dnorm(0.0,0.000001)
beta.trt3 ~ dnorm(0.0,0.000001)
mu ~ dnorm(0.0,0.000001)
I

#model
 for (i in 1:N) {
    y[i] ~ dbinom(p[i], n[i])
    log(p[i]) <- mu + beta.trt2 * trt2[i] + beta.trt3 * trt3[i]  
 } 
}
"``` 

r

bayesian

jags

0 Answers

Your Answer

Accepted video resources