[R] WinBUGS Question

Yihui Xie xie at yihui.name
Tue Apr 13 22:45:55 CEST 2010


If you are using R2WinBUGS, I guess you may put them in a loop like:

# models
...
data_i[j]~dnorm(...)
...
# save them in a sequence of files with names like 'model_i.bug'
# write.model() might help?

# then call bugs()
for(i in names.of.your.100.datasets){
  bugs(data=i,...,model.file='model_i.bug',...)
}

The above code might need paste() here and there, e.g. paste('data_',
i, sep='').

I don't know if WinBUGS itself supports such a loop.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



On Tue, Apr 13, 2010 at 1:48 PM, Anamika Chaudhuri <canamika at gmail.com> wrote:
> Hi:
>
> Is there a way we can set up WINBUGS to run 100 simulated datasets on the
> same model and output results? Or do we have to call in each dataset at a
> time and repeat the process 100 times manually?
>
> Thanks
> Anamika
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



More information about the R-help mailing list