BRugs                 package:BRugs                 R Documentation

_I_n_t_r_o_d_u_c_t_i_o_n _t_o _B_R_u_g_s

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

     This manual describes how to use the BRugs software

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

     help.BRugs(browser = getOption("browser"))

_A_r_g_u_m_e_n_t_s:

 browser: the name of the program to be used as hypertext browser.  It
          should be in the PATH, or a full path specified.

_D_e_t_a_i_l_s:

     BRugs is a collection of R functions that  allow users to analys
     graphical models using MCMC techniques. Most of the R functions in
     BRugs provide a  interface to the BRugs dynamic link library
     (shared object file). The BRugs dynamic link library is able to
     make  use of many of the WinBUGS components, in particular those
     components concerned with graphical models and MCMC  simulation.
     BRugs lacks the GUI interface of WinBUGS but is able to use R to
     create graphical displays of the  MCMC simulation. BRugs uses the
     same model specification language as WinBUGS and the same format
     for data and  initial values. However BRugs always uses plain text
     files for input inplace of WinBUGS compound documents. The  BRugs
     functions can be split into two groups: those associated with
     setting up and simulating the graphical model  and those
     associated with making statistical inference. In general the R
     functions in BRugs correspond to the  command buttons and and text
     entry fields in the menus of WinBUGS. Each WinBUGS text entry
     field splits into two  R functions, one to set the quantity and
     the other to get the value of the quantity.

     Andrew Gelman suggests to use the function 'bugs' in the
     'R2WinBUGS' package  with argument 'program="openbugs"' as a
     wrapper.

_P_e_r_m_i_s_s_i_o_n _a_n_d _D_i_s_c_l_a_i_m_e_r:

     BRugs is released under the GNU GENERAL PUBLIC LICENSE.  For
     details see <URL: http://mathstat.helsinki.fi/openbugs/> or type
     'help.BRugs()'.

     More informally, potential users are reminded to be extremely
     careful if using this program for serious  statistical analysis.
     We have tested the program on quite a wide set of examples, but be
     particularly careful  with types of model that are currently not
     featured. If there is a problem, BRugs might just crash, which is
     not  very good, but it might well carry on and produce answers
     that are wrong, which is even worse. Please let us know  of any
     successes or failures.

_S_e_e _A_l_s_o:

     'help.WinBUGS' and the meta function 'BRugsFit'

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

     ###    Step by step example:    ###
     library(BRugs) # loading BRugs

     ## Now setting the working directory to the examples' one:
     oldwd <- getwd()
     setwd(system.file("OpenBUGS", "Examples", package="BRugs"))

     ## some usual steps (like clicking in WinBUGS):
     modelCheck("ratsmodel.txt")          # check model file
     modelData("ratsdata.txt")            # read data file
     modelCompile(numChains=2)            # compile model with 2 chains
     modelInits(rep("ratsinits.txt", 2))  # read init data file
     modelUpdate(1000)                    # burn in
     samplesSet(c("alpha0", "alpha"))     # alpha0 and alpha should be monitored
     modelUpdate(1000)                    # 1000 more iterations ....

     samplesStats("*")                    # the summarized results

     ## some plots
     samplesHistory("*", mfrow = c(4, 2)) # plot the chain,
     samplesDensity("alpha")              # plot the densities,
     samplesBgr("alpha[1:6]")             # plot the bgr statistics, and
     samplesAutoC("alpha[1:6]", 1)        # plot autocorrelations of 1st chain

     ## switch back to the previous working directory:
     setwd(oldwd) 
     ## Not run: 
     # Getting more (online-)help:
     help.BRugs() 
     ## End(Not run)

