samplesStats {BRugs}R Documentation

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.

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.

Value

samples.stats returns a data frame with columns:

mean

means

sd

standard deviations

MC_error

Estimate 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.5pc

0.025 quantiles

median

medians

val97.5pc

0.975 quantiles

start

beg + 1

sample

sample sizes

Note

If the MCMC simulation has an adaptive phase it will not be possible to make inference using values sampled before the end of this phase.

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


[Package BRugs version 0.9-2.1 Index]