arviz.mcse

arviz.mcse(data, *, var_names=None, method='mean', prob=None, dask_kwargs=None)[source]

Calculate Markov Chain Standard Error statistic.

Parameters
dataobj

Any object that can be converted to an arviz.InferenceData object Refer to documentation of arviz.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 rhat report

methodstr

Select mcse method. Valid methods are: - “mean” - “sd” - “median” - “quantile”

probfloat

Quantile information.

dask_kwargsdict, optional

Dask related kwargs passed to wrap_xarray_ufunc().

Returns
xarray.Dataset

Return the msce dataset

See also

ess

Compute autocovariance estimates for every lag for the input array.

summary

Create a data frame with summary statistics.

plot_mcse

Plot quantile or local Monte Carlo Standard Error.

Examples

Calculate the Markov Chain Standard Error using the default arguments:

In [1]: import arviz as az
   ...: data = az.load_arviz_data("non_centered_eight")
   ...: az.mcse(data)
   ...: 
Out[1]: 
<xarray.Dataset>
Dimensions:  (school: 8)
Coordinates:
  * school   (school) object 'Choate' 'Deerfield' ... "St. Paul's" 'Mt. Hermon'
Data variables:
    mu       float64 0.06787
    theta_t  (school) float64 0.02117 0.01655 0.01758 ... 0.01886 0.0185 0.01861
    tau      float64 0.0739
    theta    (school) float64 0.1196 0.09312 0.1104 ... 0.09868 0.1054 0.1068

Calculate the Markov Chain Standard Error using the quantile method:

In [2]: az.mcse(data, method="quantile", prob=0.7)
Out[2]: 
<xarray.Dataset>
Dimensions:  (school: 8)
Coordinates:
  * school   (school) object 'Choate' 'Deerfield' ... "St. Paul's" 'Mt. Hermon'
Data variables:
    mu       float64 0.0966
    theta_t  (school) float64 0.02069 0.03194 0.02927 ... 0.02107 0.03014
    tau      float64 0.08686
    theta    (school) float64 0.1886 0.1385 0.1313 ... 0.1247 0.1144 0.1243