https://github.com/cran/bayestestR
Revision 85d0a0463621c30063752c5577e591be0de5ae60 authored by Dominique Makowski on 26 July 2021, 08:40:08 UTC, committed by cran-robot on 26 July 2021, 08:40:08 UTC
1 parent 601edcd
Raw File
Tip revision: 85d0a0463621c30063752c5577e591be0de5ae60 authored by Dominique Makowski on 26 July 2021, 08:40:08 UTC
version 0.10.5
Tip revision: 85d0a04
effective_sample.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/effective_sample.R
\name{effective_sample}
\alias{effective_sample}
\alias{effective_sample.brmsfit}
\alias{effective_sample.stanreg}
\alias{effective_sample.blavaan}
\alias{effective_sample.MCMCglmm}
\title{Effective Sample Size (ESS)}
\usage{
effective_sample(model, ...)

\method{effective_sample}{brmsfit}(
  model,
  effects = c("fixed", "random", "all"),
  component = c("conditional", "zi", "zero_inflated", "all"),
  parameters = NULL,
  ...
)

\method{effective_sample}{stanreg}(
  model,
  effects = c("fixed", "random", "all"),
  component = c("location", "all", "conditional", "smooth_terms", "sigma",
    "distributional", "auxiliary"),
  parameters = NULL,
  ...
)

\method{effective_sample}{blavaan}(model, parameters = NULL, ...)

\method{effective_sample}{MCMCglmm}(
  model,
  effects = c("fixed", "random", "all"),
  parameters = NULL,
  ...
)
}
\arguments{
\item{model}{A \code{stanreg}, \code{stanfit}, or \code{brmsfit} object.}

\item{...}{Currently not used.}

\item{effects}{Should results for fixed effects, random effects or both be returned?
Only applies to mixed models. May be abbreviated.}

\item{component}{Should results for all parameters, parameters for the conditional model
or the zero-inflated part of the model be returned? May be abbreviated. Only
applies to \pkg{brms}-models.}

\item{parameters}{Regular expression pattern that describes the parameters that
should be returned. Meta-parameters (like \code{lp__} or \code{prior_}) are
filtered by default, so only parameters that typically appear in the
\code{summary()} are returned. Use \code{parameters} to select specific parameters
for the output.}
}
\value{
A data frame with two columns: Parameter name and effective sample size (ESS).
}
\description{
This function returns the effective sample size (ESS).
}
\details{
\strong{Effective Sample (ESS)} should be as large as possible, altough for most applications, an effective sample size greater than 1,000 is sufficient for stable estimates (Bürkner, 2017). The ESS corresponds to the number of independent samples with the same estimation power as the N autocorrelated samples. It is is a measure of \dQuote{how much independent information there is in autocorrelated chains} (\emph{Kruschke 2015, p182-3}).
}
\examples{
\dontrun{
library(rstanarm)
model <- stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0)
effective_sample(model)
}
}
\references{
\itemize{
  \item Kruschke, J. (2014). Doing Bayesian data analysis: A tutorial with R, JAGS, and Stan. Academic Press.
  \item Bürkner, P. C. (2017). brms: An R package for Bayesian multilevel models using Stan. Journal of Statistical Software, 80(1), 1-28
}
}
back to top