Learn R Programming

mcmcr (version 0.0.2)

esr: Effective Sampling Rate

Description

Calculates the effective sampling rate (esr) based on the formula $$\frac{1}{1 + 2 \sum_{k = 1}^\infty\rho_k(\theta)}$$ in Brooks et al. (2011). The infinite sum is truncated at lag \(k\) when \(\rho_{k+1}(\theta) < 0\).

Usage

esr(x, ...)

# S3 method for mcarray esr(x, by = "all", ...)

# S3 method for mcmc esr(x, by = "all", ...)

# S3 method for mcmc.list esr(x, by = "all", ...)

# S3 method for mcmcarray esr(x, by = "all", as_df = FALSE, ...)

# S3 method for mcmcr esr(x, by = "all", as_df = FALSE, ...)

# S3 method for mcmcrs esr(x, by = "all", ...)

Arguments

x

An MCMC object

...

Unused

by

A string indicating whether to return the estimates by the object ("all"), "parameter" or "term"

as_df

A flag indicating whether to return the estimates as a tibble versus a list.

Value

The esr value(s) as a tibble or list

Methods (by class)

  • mcarray: Effective Sampling Rate for an mcarray object

  • mcmc: Effective Sampling Rate for an mcmc object

  • mcmc.list: Effective Sampling Rate for an mcmc.list object

  • mcmcarray: Effective Sampling Rate for an mcmcarray object

  • mcmcr: Effective Sampling Rate for an mcmcr object

  • mcmcrs: Effective Sampling Rate for an mcmcrs object

References

Brooks, S., Gelman, A., Jones, G.L., and Meng, X.-L. (Editors). 2011. Handbook for Markov Chain Monte Carlo. Taylor & Francis, Boca Raton.

Examples

Run this code
# NOT RUN {
esr(mcmcr_example)
# }

Run the code above in your browser using DataLab