Learn R Programming

BRugs (version 0.8-2)

samplesStats: Calculate summary statistics

Description

This function produces summary statistics for a variable, pooling over the chains selected.

Usage

samplesStats(node, beg = samplesGetBeg(), end = samplesGetEnd(), 
    firstChain = samplesGetFirstChain(), 
    lastChain = samplesGetLastChain(), thin = samplesGetThin())

Arguments

node
Character vector containing names of variables in the model.
beg, end
Arguments to select a slice of monitored values corresponding to iterations beg:end.
firstChain, lastChain
Arguments to select a sub group of chains to calculate summary statistics for.
thin
to only use every thin-th value of the stored sample for statistics.

Value

  • samples.stats returns a data frame with columns:
  • meanmeans
  • sdstandard deviations
  • MC_errorEstimate of $s/\sqrt(N)$, the Monte Carlo standard error of the mean. The batch means method outlined by Roberts (1996; p.50) is used to estimate $s$.
  • val2.5pc0.025 quantiles
  • medianmedians
  • val97.5pc0.975 quantiles
  • startbeg + 1
  • samplesample sizes

concept

  • WinBUGS
  • OpenBUGS
  • chain
  • update
  • iteration

Details

If the variable of interest is an array, slices of the array can be selected using the notation variable[lower0:upper0, lower1:upper1, ...]. A star * can be entered as shorthand for all the stored samples. If the arguments are left at their defaults the whole sample for all chains will be used for calculation.

References

Roberts, G.O. (1996): Markov Chain Concepts Related to Sampling Algorithms. In: W.R. Gilks, S. Richardson and D.J. Spiegelhalter (Eds.): Markov Chain Monte Carlo in Practice. Chapman and Hall, London, UK.

See Also

BRugs, help.WinBUGS