schools                package:rbugs                R Documentation

_8 _s_c_h_o_o_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     8 schools analysis from section 5.5 of "Bayesian Data Analysis" by
     Andrew Gelman, John B. Carlin,  Hal S. Stern, and Donald B. Rubin.

_U_s_a_g_e:

     data(schools)

_F_o_r_m_a_t:

     A data frame with 8 observations on the following 3 variables.

     _s_c_h_o_o_l a factor with levels 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H'

     _e_s_t_i_m_a_t_e a numeric vector

     _s_d a numeric vector

_S_o_u_r_c_e:

     Gelman, A., Carlin, J.B., Stern, H.S., Rubin, D.B. (2003):
     _Bayesian Data Analysis_, 2nd edition, CRC Press.

_E_x_a_m_p_l_e_s:

     data(schools)
     J <- nrow(schools)
     y <- schools$estimate
     y <- rnorm(length(y))
     sigma.y <- schools$sd
     schools.data <- list ("J", "y", "sigma.y") 
     ## schools.data <- list(J=J, y=y, sigma.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.bug <- file.path(.path.package("rbugs"), "bugs/model", "schools.bug")
     file.show(schools.bug)
     ## Not run: 
     ## no tested examples for mac-os.
     schools.sim <- rbugs(data=schools.data, inits, parameters,
                          schools.bug, n.chains=3, n.iter=1000,
                          workingDir="/var/scratch/jyan/c/tmp",
                          bugsWorkingDir="c:/tmp",
                          useWine=TRUE,
                          wine="/var/scratch/jyan/wine-20040408/wine",
                          debug=TRUE)
     ## End(Not run)

