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> Size: 656B
Dimensions:  (school: 8)
Coordinates:
  * school   (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
    mu       float64 8B 0.08102
    theta_t  (school) float64 64B 0.02339 0.01925 0.02092 ... 0.01931 0.01906
    tau      float64 8B 0.0791
    theta    (school) float64 64B 0.1285 0.103 0.1306 ... 0.1158 0.1193 0.1218

Calculate the Markov Chain Standard Error using the quantile method:

In [2]: az.mcse(data, method="quantile", prob=0.7)
Out[2]: 
<xarray.Dataset> Size: 656B
Dimensions:  (school: 8)
Coordinates:
  * school   (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
    mu       float64 8B 0.1305
    theta_t  (school) float64 64B 0.034 0.02491 0.0319 ... 0.02363 0.03383
    tau      float64 8B 0.1145
    theta    (school) float64 64B 0.1776 0.1047 0.1426 ... 0.156 0.1508 0.1209