'Bernoulli GLM in JAGS
I am getting errors of mismatched parameters for one of the predictor variables in my JAGS code and this is not producing convergence for 2 of my variables.
I am analyzing a data set of 1000 patients (observations) who had epilepsy and those who did not (1/0). Other variables are categorical - gender (male, female, LGBTQ), drug type use (diclofenac (1), bicarbonate (2) and thiazide (3)). Then, there is a continuous variable (BMI, ranging from 10:40). Below is my code. What could be wrong with it:
"model{
for (i in 1:n)
{
epilepsy[i]~dbern(prob[i])
logit(prob[i])<- intercept+gendereffect[gender[i]] + druguseeffect[Druguse[i]]+ BMIeffect*BMI[i]+
interaction*gender[i]*Druguse[i]}
intercept~dnorm(0,precision)
gendereffect[1]<-0
gendereffect[2]~dnorm(0,10^6)
gendereffect[3]~dnorm(0,10^6)
druguseeffect[1]<-0
druguseeffect[2] ~ dnorm(0,10^6)
druguseeffect[3]~dnorm(0,10^6)
intercept~dbeta(1,1)
BMIeffect~dnorm(0,10^6)
interaction~dnorm(0,10^6)
precision~dgamma(10,10)
#data# druguse, gender, BMI,n,epilepsy
#inits# intercept,BMIeffect,gendereffect,druguseeffect,interaction,precision
#monitor# gendereffect,BMIeffect,druguseeffect,interaction,precision
}"
Note: I have a list created. And on R, I converted druguse and gender to integers, both ranging 1:3. But the model is not running.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
