From: Li, Jia <LI_at_nsabp.pitt.edu>

Date: Tue 17 May 2005 - 05:20:15 EST

_

> # R code for entering the data and fitting the Bugs model for 8

schools

*> # analysis from Section 5.5 of "Bayesian Data Analysis".
*

*>
*

> # To run, the Bugs model must be in the file "schools.txt" in your

working

*> # directory and you must load in the functions in the bugs.R file (see
*

*> # http://www.stat.columbia.edu/~gelman/bugsR/).
*

*>
*

*> J <- 8
*

*> y <- c(28,8,-3,7,-1,1,18,12)
*

*> sigma.y <- c(15,10,16,11,9,11,10,18)
*

> schools.data <- list ("J", "y", "sigma.y")

> schools.inits <- function()

+ list (theta=rnorm(J,0,1), mu.theta=rnorm(1,0,100), + sigma.theta=runif(1,0,100))

*> schools.parameters <- c("theta", "mu.theta", "sigma.theta")
*

*>
*

*> #run in winbugs14
*

*>
*

> schools.sim <- bugs (schools.data, schools.inits, schools.parameters,

"schools.bug", n.chains=3, n.iter=1000, version=1.4) Error: couldn't find function "bugs"

R-help@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 Received on Tue May 17 05:29:39 2005

Date: Tue 17 May 2005 - 05:20:15 EST

Would you please help me out? I am stuck on this for a while and really frustrated now.

The program and the error as follow.

Jiaa

_

> # R code for entering the data and fitting the Bugs model for 8

schools

> # To run, the Bugs model must be in the file "schools.txt" in your

working

> schools.data <- list ("J", "y", "sigma.y")

> schools.inits <- function()

+ list (theta=rnorm(J,0,1), mu.theta=rnorm(1,0,100), + sigma.theta=runif(1,0,100))

> schools.sim <- bugs (schools.data, schools.inits, schools.parameters,

"schools.bug", n.chains=3, n.iter=1000, version=1.4) Error: couldn't find function "bugs"

[[alternative HTML version deleted]]

R-help@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 Received on Tue May 17 05:29:39 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:46 EST
*