Gao, Aijun <Aijun.Gao <at> i3statprobe.com> writes: > > > 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"
I think you need library(R2WinBUGS) before you try to run the bugs command this is all assuming that you have WinBUGS installed ... Ben Bolker ______________________________________________ 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.