I get an error when I call bugs(..., program="OpenBUGS", bugs.directory="c:/Program files/OpenBUGS/OpenBUGS312"), expecting, as suggested in help(bugs), that it would fit the model with openbugs() via BRugs.
- > help(bugs)
- ... either winbugs/WinBUGS or openbugs/OpenBUGS, the latter makes use of function openbugs and requires the CRAN package
- BRugs. ...
settings) bugs(program="OpenBUGS") works differently than openbugs(). Am I doing something wrong with bugs()? Or there is something wrong with my OpenBUGS installation?
I am using R-2.12.0, R2WinBUGS 2.1-16 (2009-11-06), OpenBUGS 3.1.2 rev 668 (2010-09-28), and BRugs 0.5-3 (2009-11-06) on a Windows XP machine.
Thanks
- ------- R file ---------
- require(R2WinBUGS)
- require(BRugs)
- # Example in Albert (2007). Bayesian Computation with R. Springer.
- # pp. 237-238. Prior = beta(0.5, 0.5), observe Binom(n, p)
- # y=7 successes out of a sample of n=50. Estimate p.
- y <- 7
- n <- 50
- alpha <- 1.0
- beta <- 1.0
- data <- list("y", "n", "alpha", "beta")
- inits <- function() { list(p = runif(1)) }
- param <- "p"
- # this works
- Albert.bugs <- openbugs(data=data, inits=inits, parameters.to.save=param, model.file = "C:/tryR/WinBUGS/Albert11.txt", n.chains=3, n.iter=500)
- print(Albert.bugs, digits.summary = 4)
- # this fails
- Albert.bugs <- bugs(data=data, inits=inits, parameters.to.save=param, model.file="C:/tryR/WinBUGS/Albert11.txt", n.chains=3, n.iter=500, program="OpenBUGS")
- ------- BUGS file: Albert11.txt ------
- model
- {
- y ~ dbin(p, n)
- p ~ dbeta( alpha, beta )
- }


雷达卡



京公网安备 11010802022788号







