I forgot to add the R codes. The following are the codes I used for this 
problem:


###    Step by step example:    ###
library(BRugs) # loading BRugs

## Now setting the working directory to the examples' one:
setwd(options()$OpenBUGSExamples)

## add a simple loop
for (mn in 1:100){

## some usual steps (like clicking in WinBUGS):
modelCheck("Ratsmodel.txt")          # check model file
modelData("Ratsdata.txt")            # read data file
modelCompile(numChains=2)            # compile model with 2 chains
modelInits(rep("Ratsinits.txt", 2))  # read init data file
modelUpdate(1000)                    # burn in
samplesSet(c("alpha0", "alpha"))     # alpha0 and alpha should be monitored
modelUpdate(1000)                    # 1000 more iterations ....

samplesStats("*")                    # the summarized results

## some plots
#samplesHistory("*", mfrow = c(4, 2)) # plot the chain,
#samplesDensity("alpha")              # plot the densities,
#samplesBgr("alpha[1:6]")             # plot the bgr statistics, and
#samplesAutoC("alpha[1:6]", 1)        # plot autocorrelations of 1st chain

# force to print the current loop number
flush.console()
print(mn)
}




--- On Tue, 24/1/12, Jin Minming <jminm...@yahoo.com> wrote:

> From: Jin Minming <jminm...@yahoo.com>
> Subject: [R] Error from Brugs "'r for windows gui front-end has stopped 
> working''
> To: r-help@r-project.org
> Date: Tuesday, 24 January, 2012, 20:08
> Dear all,
> 
> I just try to run the example in R brugs packages, but not
> only once. Loop is added in this example. After several
> times (7, 11, or other random number), there is an error
> message "r for windows gui front-end has stopped working".
> This happened in two laptops with windows 7 and vista. I
> have tried different versions of R (2.14.1 and 2.13) and
> Brugs packages (0.7.1 and 0.7-5). But it works well in a
> computer installed with Windows XP system. 
> 
> Anyone has some idea how to avoid this crash in Windows
> Vista or 7 system?
> 
> Thanks,
> 
> Jim
> 
> ______________________________________________
> R-help@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.
>

______________________________________________
R-help@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.

Reply via email to