I am trying to model a dose-toxicity Bayesian model using WinBugs. The probability of toxicity should be given by p=x^exp(theta). The variable X is the dose and Y is the toxicity (Bernoulli likelihood). I am using a non-informative prior for log(theta), log(theta)=(0, 1.34^2).
I wrote this WinBugs model to update the probability of toxiciy as data acrues:
model {
#Prior on log(theta)
#Precision 1/(1.34^2)=0.5569169
logtheta ~ dnorm(0, 0.5569169)
#Calculate theta from log(theta)
theta <- exp(logtheta)
#Probability of toxicity
p[i] <- x^theta
#Bernoulli Likelihood
for (i in 1:n) {
y[i] ~ dbern(p)
}
}
I have data for the first three subjects, exposed to dose x=0.01831018 and with NO toxicities observed. I run this code to get the posterior probability of toxicity:
#Data
data <- list(x=c(0.01831018, 0.01831018, 0.01831018),y=c(0, 0, 0), n=3)
#WinBUGS
inits <-function(){list(theta=0.1)}
params <- c("theta")
model1.updating1 <- bugs(data, inits, params, model.file ="model1.txt",
n.chains = 1, n.iter = 10000, n.burnin = 2000, debug = TRUE)
However, I am getting the error below and I can't understand why.
invalid or unexpected token scanned
Can anyone help?
Thank you so much.