I am trying to run this model under R for bayesian inference modelling:
model {
for (i in 1:N) {
logit(theta[i]) i- alpha + beta*d[i]
y[i] ∼ dbin(theta[i], n[i])
}
alpha∼ dbeta(1, 1)
beta ∼ dbeta(1, 1)}
I have previously created a list with the values of y, n, d and N:
list(y=c(67, 43, 193, 250, 141) , n=c(282, 225, 290, 261, 141) ,
d=c(0, 62.5, 125, 250, 500) , N=5)
and :
list(alpha=0.1, beta=0.01)
libraries installed:
library(R2WinBUGS) and library(coda)
I get this error message:
model {
Error: unexpected '{' in "model {"
for (i in 1:N) {
+ logit(theta[i]) i- alpha + beta*d[i]
Error: unexpected symbol in:
"for (i in 1:N) {
logit(theta[i]) i"
y[i] ∼ dbin(theta[i], n[i])}
Error: unexpected input in " y[i] ∼"
alpha∼ dbeta(1, 1)
Error: unexpected input in "alpha∼"
beta ∼ dbeta(1, 1)}
Error: unexpected input in "beta ∼"
Can someone please advise a solution?
Thank you very much in advance