arviz.effective_sample_size

arviz.effective_sample_size(data, *, var_names=None, method='bulk', relative=False, prob=None)[source]

Calculate estimate of the effective sample size.

Function deprecated. Use arviz.ess.

Parameters
dataobj

Any object that can be converted to an az.InferenceData object. Refer to documentation of az.convert_to_dataset for details. For ndarray: shape = (chain, draw). For n-dimensional ndarray transform first to dataset with az.convert_to_dataset.

var_nameslist

Names of variables to include in the effective_sample_size_mean report

methodstr

Select ess method. Valid methods are - “bulk” - “tail” # prob, optional - “quantile” # prob - “mean” (old ess) - “sd” - “median” - “mad” (mean absolute deviance) - “z_scale” - “folded” - “identity”

relativebool

Return relative ess ress = ess / N

probfloat, optional

probability value for “tail” and “quantile” ess functions.

Returns
xarray.Dataset

Return the effective sample size for mean, \(\hat{N}_{eff}\)

Notes

The basic ess diagnostic is computed by:

\[\hat{N}_{eff} = \frac{MN}{\hat{\tau}}\]
\[\hat{\tau} = -1 + 2 \sum_{t'=0}^K \hat{P}_t'\]

where \(\hat{\rho}_t\) is the estimated _autocorrelation at lag t, and T is the first odd positive integer for which the sum \(\hat{\rho}_{T+1} + \hat{\rho}_{T+1}\) is negative.

The current implementation is similar to Stan, which uses Geyer’s initial monotone sequence criterion (Geyer, 1992; Geyer, 2011).

References

Vehtari et al. (2019) see https://arxiv.org/abs/1903.08008 https://mc-stan.org/docs/2_18/reference-manual/effective-sample-size-section.html Section 15.4.2 Gelman et al. BDA (2014) Formula 11.8