when I run my jags model, I got this error message : module glm loaded Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, :
Error parsing model file: syntax error on line 5 near "="
And here is my code:
install.packages('R2jags')
install.packages('rjags')
library(rjags)
library('R2jags')
library(lattice)
binomial.model.JAGS = function(){
y ~ dbin(p,n)
p=lambda*mu+rho*(1-mu)
lambda ~ dunif(min = 0.2,max = 1.4)
mu ~ dunif(min = 0,max = 1)
rho ~ dunif(min = 0.1,max = 1.7)
}
n = 100000
y = 30000
data.JAGS = list(y = y, n = n)
inits.JAGS = list(list(lambda=0.8,mu=0.5,rho=0.9))
para.JAGS = c("p", "lambda", "mu", "rho")
fit.JAGS = jags(
data=data.JAGS,inits=inits.JAGS,
parameters.to.save=para.JAGS,
n.chains=1,
n.iter=9000,
n.burnin = 1000,
model.file = binomial.model.JAGS)
I really don't know where it went wrong. Does anybody could help me please? Thank you a lot!!
Just remove all the argument naming in your priors and you should be good to go.