toby909 at gmail.com wrote:> 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
The idea is that people in general write their model files more or less
while interactively using WinBUGS / OpenBUGS and later on start
automizing with R2WinBUGS or BRugs. Then the file already exists.
Of course, we can add dome fancy stuff that applies write.model if an
expression is given in the argument "model".
I'll put it on the ToDo list.
Best,
Uwe Ligges
>
> 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)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.