An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20050516/910bc825/attachment.pl
A question about bugs.R: functions for running WinBUGs from R
2 messages · Li, Jia, Uwe Ligges
Li, Jia wrote:
Dear R users, I've found bugs.R : the functions for running WinBUGs from R that is writen by Dr. Andrew Gelman who is a professor from Columbia University. The bugs.R would be very useful for me, and I think many of you know it as well. I followed the instuctions on Dr. Gelman's web to install all of documents that bugs.R needs, but when I try to run the school example the web posted in R, I got an error. 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. Thanks a lot in advance!
Why do you post twice? See my former message, you forgot to source() "bugs.R". BTW: Since this code is from the website from Andrew Gelman, why do you think posting to R-help is the appropriate way to get help? R has a standardized mechanism for distributing code - called "package". And the appropriate package "R2WinBUGS" you are looking for has been made available - thanks to Andrew's effort in writing the original code and thanks to the efforts of two others to generalize the code and package it for you. Uwe Ligges
Jiaa
________________________________________________________________________ _ # 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" ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------------------------------- [[alternative HTML version deleted]] ______________________________________________ R-help at 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