[R] R2WinBUGS awkward to use
toby909 at gmail.com
toby909 at gmail.com
Sat Jul 21 03:17:13 CEST 2007
Hi All
Does anyone know if I can avoid to use the write.model() function below? I dont
want to do this. Can't bugs() do that automatically for me just by specifying
the 4th argument 'model'? Just I like I am also using the 'inits' object!
If I use 'model' in the same way as I use 'inits' I am getting the error:
> sim <- bugs(data, inits, parameters, model, n.chains=1, n.iter=5000,
bugs.directory="c:/Program Files/WinBUGS14", working.directory=NULL,
clearWD=TRUE, DIC=0)
Error in file.exists(c(...)) : invalid 'file' argument
Thanks Toby
data <- list(.....)
model <- function() {
[omitted]
}
write.model(model, "cwk.txt")
inits <- function() {.....}
parameters <- c("b", "nu", "S1", "S2")
sim <- bugs(data, inits, parameters, "cwk.txt", n.chains=1, n.iter=5000,
bugs.directory="c:/Program Files/WinBUGS14", working.directory=NULL,
clearWD=TRUE, DIC=0)
print(sim)
plot(sim)
More information about the R-help
mailing list