I am using the R2WinBugs package. I would like to pass two parameter that are calculated previously in the R script to the model function
c0yy <- 0.1
syy <- 0.0001
#Model
model <- function(c0yy,syy){
#Likelihood
for(i in 1:n){
y[i] ~ dnorm(mu[i],cyy)
}
#Regression formula
for(i in 1:n){
mu[i] <- alpha + gamma * x[i]
}
#Priors for the regression parameters
alpha ~ dnorm(0,0.000001)
gamma ~ dnorm(0,0.000001)
#Priors for the precision parameter
cyy ~ dnorm(c0yy,syy)
#Monitored variables
beta <- gamma/(alpha-1)
}
filename <- file.path(tempdir(), "Olm.txt")
write.model(model, filename)
but I get this error
made use of undefined node c0yy
while if I substitute the values for c0yy
and syy
inside the model function it works.. Any help?
Thanks