Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

effectiveSize

Effective sample size for estimating the mean


Description

Sample size adjusted for autocorrelation.

Usage

effectiveSize(x)

Arguments

x

An mcmc or mcmc.list object.

Details

For a time series x of length N, the standard error of the mean is the square root of var(x)/n where n is the effective sample size. n = N only when there is no autocorrelation.

Estimation of the effective sample size requires estimating the spectral density at frequency zero. This is done by the function spectrum0.ar

For a mcmc.list object, the effective sizes are summed across chains. To get the size for each chain individually use lapply(x,effectiveSize).

Value

A vector giving the effective sample size for each column of x.

See Also


coda

Output Analysis and Diagnostics for MCMC

v0.19-4
GPL (>= 2)
Authors
Martyn Plummer [aut, cre, trl], Nicky Best [aut], Kate Cowles [aut], Karen Vines [aut], Deepayan Sarkar [aut], Douglas Bates [aut], Russell Almond [aut], Arni Magnusson [aut]
Initial release
2020-09-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.