Hi: I am trying to run your SCHOOLS example as following and I get an error message stated that : Error: could not find function "bugs" Would you please help me since I would like to run some WINBUG programs from your R by reading external data and I am new to R? Do I missing some function? Should I install some extra files?
Thanks a lot in advance for your help!! > schools <- read.table ("schools.dat", header=TRUE) > J <- nrow(schools) > y <- schools$estimate > sigma.y <- schools$sd > data <- list ("J", "y", "sigma.y") > inits <- function() {list (theta=rnorm(J,0,100), mu.theta=rnorm(1,0,100), > sigma.theta=runif(1,0,100))} > parameters <- c("theta", "mu.theta", "sigma.theta") > schools.sim <- bugs (data, inits, parameters, "schools.bug", n.chains=3, > n.iter=1000) Error: could not find function "bugs" ******************************************************************************************** Running WinBugs and OpenBugs from R Example * 8 schools analysis from Section 5.5 of "Bayesian Data Analysis" * Put the following<schools.bug> in the file "schools.bug" in your R working directory (it is convenient to edit this and other .bug and .R files in XEmacs<http://www.xemacs.org>): model { for (j in 1:J){ y[j] ~ dnorm (theta[j], tau.y[j]) theta[j] ~ dnorm (mu.theta, tau.theta) tau.y[j] <- pow(sigma.y[j], -2) } mu.theta ~ dnorm (0.0, 1.0E-6) tau.theta <- pow(sigma.theta, -2) sigma.theta ~ dunif (0, 1000) } * Save this file<schools.dat> as "schools.dat" in your R working directory. * Do the following<schools.R> commands in R: schools <- read.table ("schools.dat", header=TRUE) J <- nrow(schools) y <- schools$estimate sigma.y <- schools$sd data <- list ("J", "y", "sigma.y") inits <- function() {list (theta=rnorm(J,0,100), mu.theta=rnorm(1,0,100), sigma.theta=runif(1,0,100))} parameters <- c("theta", "mu.theta", "sigma.theta") schools.sim <- bugs (data, inits, parameters, "schools.bug", n.chains=3, n.iter=1000) ****************************************************************************** Aijun Gao Senior Biostatistician "Secure Server BSK" made the following annotations on 09/17/2008 01:39:59 PM ------------------------------"This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately." ============================== [[alternative HTML version deleted]] ______________________________________________ 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.