Working with InferenceData — ArviZ dev documentation (original) (raw)
Here we present a collection of common manipulations you can use while working with InferenceData
.
import arviz as az import numpy as np import xarray as xr
xr.set_options(display_expand_data=False, display_expand_attrs=False);
display_expand_data=False
makes the default view for xarray.DataArray fold the data values to a single line. To explore the values, click on the icon on the left of the view, right under the xarray.DataArray
text. It has no effect on Dataset
objects that already default to folded views.
display_expand_attrs=False
folds the attributes in both DataArray
and Dataset
objects to keep the views shorter. In this page we print DataArrays and Datasets several times and they always have the same attributes.
- posterior
<xarray.Dataset> Size: 165kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 16kB ...
theta (chain, draw, school) float64 128kB ...
tau (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* mu
(chain, draw)
float64
...
[2000 values with dtype=float64]
* theta
(chain, draw, school)
float64
...
[16000 values with dtype=float64]
* tau
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 246kB
Dimensions: (chain: 4, draw: 500)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 16kB ...
energy_error (chain, draw) float64 16kB ...
lp (chain, draw) float64 16kB ...
index_in_trajectory (chain, draw) int64 16kB ...
acceptance_rate (chain, draw) float64 16kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 16kB ...
step_size_bar (chain, draw) float64 16kB ...
step_size (chain, draw) float64 16kB ...
energy (chain, draw) float64 16kB ...
tree_depth (chain, draw) int64 16kB ...
perf_counter_diff (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[2000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[2000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[2000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[2000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[2000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[2000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[2000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[2000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[2000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 4kB ...
theta (chain, draw, school) float64 32kB ...
mu (chain, draw) float64 4kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
...
[500 values with dtype=float64]
* theta
(chain, draw, school)
float64
...
[4000 values with dtype=float64]
* mu
(chain, draw)
float64
...
[500 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Get the dataset corresponding to a single group#
post = idata.posterior post
<xarray.Dataset> Size: 165kB Dimensions: (chain: 4, draw: 500, school: 8) Coordinates:
chain (chain) int64 32B 0 1 2 3
draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon' Data variables: mu (chain, draw) float64 16kB ... theta (chain, draw, school) float64 128kB ... tau (chain, draw) float64 16kB ... Attributes: (6)
Dimensions:
- chain: 4
- draw: 500
- school: 8
Coordinates: (3)
- chain
(chain)
int64
0 1 2 3 - draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
- chain
Data variables: (3)
- mu
(chain, draw)
float64
...
[2000 values with dtype=float64] - theta
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - tau
(chain, draw)
float64
...
[2000 values with dtype=float64]
- mu
Indexes: (3)
- PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain')) - PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
- PandasIndex
Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
Tip
You’ll have noticed we stored the posterior group in a new variable: post
. As .copy()
was not called, now using idata.posterior
or post
is equivalent.
Use this to keep your code short yet easy to read. Store the groups you’ll need very often as separate variables to use explicitly, but don’t delete the InferenceData parent. You’ll need it for many ArviZ functions to work properly. For example: plot_pair() needs data from sample_stats
group to show divergences, compare() needs data from both log_likelihood
and posterior
groups, plot_loo_pit() needs not 2 but 3 groups: log_likelihood
, posterior_predictive
and posterior
.
Add a new variable#
post["log_tau"] = np.log(post["tau"]) idata.posterior
<xarray.Dataset> Size: 181kB Dimensions: (chain: 4, draw: 500, school: 8) Coordinates:
chain (chain) int64 32B 0 1 2 3
draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon' Data variables: mu (chain, draw) float64 16kB ... theta (chain, draw, school) float64 128kB ... tau (chain, draw) float64 16kB 4.726 3.909 4.844 ... 2.741 2.932 4.461 log_tau (chain, draw) float64 16kB 1.553 1.363 1.578 ... 1.008 1.076 1.495 Attributes: (6)
Dimensions:
- chain: 4
- draw: 500
- school: 8
Coordinates: (3)
- chain
(chain)
int64
0 1 2 3 - draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
- chain
Data variables: (4)
- mu
(chain, draw)
float64
...
[2000 values with dtype=float64] - theta
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - tau
(chain, draw)
float64
4.726 3.909 4.844 ... 2.932 4.461
array([[4.72574 , 3.908994, 4.844025, ..., 1.893838, 5.920062, 4.325896],
[1.97083 , 2.049029, 2.123765, ..., 2.17459 , 1.327551, 1.211995],
[3.501277, 2.893243, 4.273286, ..., 4.08978 , 2.72017 , 1.917011],
[6.07326 , 3.771867, 3.170537, ..., 2.740607, 2.932379, 4.461246]]) - log_tau
(chain, draw)
float64
1.553 1.363 1.578 ... 1.076 1.495
array([[1.55302418, 1.36327995, 1.57774603, ..., 0.6386056 , 1.778347 ,
1.46461921],
[0.67845483, 0.71736608, 0.75319044, ..., 0.77684015, 0.28333575,
0.19226749],
[1.25312773, 1.06237808, 1.45238307, ..., 1.40849125, 1.00069436,
0.65076731],
[1.8038955 , 1.32757011, 1.15390112, ..., 1.00817931, 1.07581413,
1.49542809]])
- mu
Indexes: (3)
- PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain')) - PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
- PandasIndex
Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
Combine chains and draws#
<xarray.Dataset> Size: 225kB Dimensions: (sample: 2000, school: 8) Coordinates:
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
sample (sample) object 16kB MultiIndex
chain (sample) int64 16kB 0 0 0 0 0 0 0 0 0 0 0 ... 3 3 3 3 3 3 3 3 3 3 3
draw (sample) int64 16kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499 Data variables: mu (sample) float64 16kB 7.872 3.385 9.1 7.304 ... 1.767 3.486 3.404 theta (school, sample) float64 128kB 12.32 11.29 5.709 ... 8.452 1.295 tau (sample) float64 16kB 4.726 3.909 4.844 1.857 ... 2.741 2.932 4.461 log_tau (sample) float64 16kB 1.553 1.363 1.578 ... 1.008 1.076 1.495 Attributes: (6)
Dimensions:
- sample: 2000
- school: 8
Coordinates: (4)
- school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - sample
(sample)
object
MultiIndex
array([(0, 0), (0, 1), (0, 2), ..., (3, 497), (3, 498), (3, 499)], dtype=object) - chain
(sample)
int64
0 0 0 0 0 0 0 0 ... 3 3 3 3 3 3 3 3
array([0, 0, 0, ..., 3, 3, 3]) - draw
(sample)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
- school
Data variables: (4)
- mu
(sample)
float64
7.872 3.385 9.1 ... 3.486 3.404
array([7.87179637, 3.38455431, 9.10047569, ..., 1.76673325, 3.48611194,
3.40446391]) - theta
(school, sample)
float64
12.32 11.29 5.709 ... 8.452 1.295
array([[12.32068558, 11.28562322, 5.70850575, ..., 3.53251469,
4.1827505 , 0.19295578],
[ 9.90536689, 9.12932369, 5.7579324 , ..., 2.00890089,
7.55425055, 6.4984278 ],
[14.9516155 , 3.13926327, 10.94458539, ..., 0.51080602,
4.45603444, -0.89442402],
...,
[16.90179529, 2.39308809, 8.14332707, ..., 4.70724881,
1.5289581 , 7.93646013],
[13.19805933, 10.05522282, 7.60475341, ..., 3.07331446,
1.09609826, 6.76245459],
[15.06136584, 6.17672421, 8.76764689, ..., -2.62306892,
8.45228161, 1.2950506 ]]) - tau
(sample)
float64
4.726 3.909 4.844 ... 2.932 4.461
array([4.72574006, 3.90899361, 4.8440252 , ..., 2.74060666, 2.93237926,
4.46124596]) - log_tau
(sample)
float64
1.553 1.363 1.578 ... 1.076 1.495
array([1.55302418, 1.36327995, 1.57774603, ..., 1.00817931, 1.07581413,
1.49542809])
- mu
Indexes: (2)
- PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - PandasMultiIndex
PandasIndex(MultiIndex([(0, 0),
(0, 1),
(0, 2),
(0, 3),
(0, 4),
(0, 5),
(0, 6),
(0, 7),
(0, 8),
(0, 9),
...
(3, 490),
(3, 491),
(3, 492),
(3, 493),
(3, 494),
(3, 495),
(3, 496),
(3, 497),
(3, 498),
(3, 499)],
name='sample', length=2000))
- PandasIndex
Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
You can also use xarray.Dataset.stack() if you only want to combine the chain and draw dimensions. arviz.extract() is a convenience function aimed at taking care of the most common subsetting operations with MCMC samples. It can:
- Combine chains and draws.
- Return a subset of variables (with optional filtering with regular expressions or string matching).
- Return a subset of samples. Moreover, by default it returns a random subset to prevent getting non-representative samples due to bad mixing.
- Access any group.
Get a random subset of the samples#
<xarray.Dataset> Size: 12kB Dimensions: (sample: 100, school: 8) Coordinates:
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
sample (sample) object 800B MultiIndex
chain (sample) int64 800B 1 2 0 1 2 1 3 3 2 2 1 ... 1 2 1 0 0 1 0 2 1 0 0
draw (sample) int64 800B 203 316 58 22 372 214 ... 460 136 37 476 368 Data variables: mu (sample) float64 800B 6.36 4.445 6.403 ... -0.8143 5.246 1.743 theta (school, sample) float64 6kB 10.71 0.5876 9.016 ... 5.24 -0.8556 tau (sample) float64 800B 4.929 3.515 3.592 7.412 ... 1.755 3.332 9.721 log_tau (sample) float64 800B 1.595 1.257 1.279 ... 0.5626 1.203 2.274 Attributes: (6)
Dimensions:
- sample: 100
- school: 8
Coordinates: (4)
- school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - sample
(sample)
object
MultiIndex
array([(1, 203), (2, 316), (0, 58), (1, 22), (2, 372), (1, 214), (3, 326),
(3, 390), (2, 297), (2, 363), (1, 489), (3, 356), (2, 2), (2, 52),
(0, 264), (2, 396), (3, 241), (1, 418), (2, 360), (1, 314), (2, 36),
(2, 324), (3, 486), (1, 40), (3, 113), (3, 232), (2, 343), (3, 35),
(2, 134), (2, 179), (1, 315), (1, 108), (3, 385), (3, 18), (0, 214),
(0, 302), (0, 147), (2, 326), (0, 363), (3, 395), (1, 288), (3, 108),
(3, 119), (1, 102), (0, 322), (1, 336), (1, 452), (3, 175), (3, 313),
(0, 94), (1, 280), (2, 50), (0, 202), (3, 8), (2, 210), (2, 274),
(3, 44), (0, 346), (1, 350), (0, 198), (2, 296), (3, 118), (2, 436),
(1, 362), (1, 375), (3, 401), (2, 439), (0, 190), (2, 346), (0, 65),
(3, 159), (2, 211), (3, 96), (2, 376), (1, 239), (0, 204), (0, 333),
(1, 149), (1, 339), (1, 347), (2, 147), (3, 350), (2, 53), (2, 310),
(1, 180), (3, 66), (2, 311), (1, 201), (0, 347), (1, 356), (2, 303),
(1, 466), (0, 68), (0, 145), (1, 143), (0, 460), (2, 136), (1, 37),
(0, 476), (0, 368)], dtype=object) - chain
(sample)
int64
1 2 0 1 2 1 3 3 ... 0 0 1 0 2 1 0 0
array([1, 2, 0, 1, 2, 1, 3, 3, 2, 2, 1, 3, 2, 2, 0, 2, 3, 1, 2, 1, 2, 2, 3, 1,
3, 3, 2, 3, 2, 2, 1, 1, 3, 3, 0, 0, 0, 2, 0, 3, 1, 3, 3, 1, 0, 1, 1, 3,
3, 0, 1, 2, 0, 3, 2, 2, 3, 0, 1, 0, 2, 3, 2, 1, 1, 3, 2, 0, 2, 0, 3, 2,
3, 2, 1, 0, 0, 1, 1, 1, 2, 3, 2, 2, 1, 3, 2, 1, 0, 1, 2, 1, 0, 0, 1, 0,
2, 1, 0, 0]) - draw
(sample)
int64
203 316 58 22 ... 136 37 476 368
array([203, 316, 58, 22, 372, 214, 326, 390, 297, 363, 489, 356, 2, 52,
264, 396, 241, 418, 360, 314, 36, 324, 486, 40, 113, 232, 343, 35,
134, 179, 315, 108, 385, 18, 214, 302, 147, 326, 363, 395, 288, 108,
119, 102, 322, 336, 452, 175, 313, 94, 280, 50, 202, 8, 210, 274,
44, 346, 350, 198, 296, 118, 436, 362, 375, 401, 439, 190, 346, 65,
159, 211, 96, 376, 239, 204, 333, 149, 339, 347, 147, 350, 53, 310,
180, 66, 311, 201, 347, 356, 303, 466, 68, 145, 143, 460, 136, 37,
476, 368])
- school
Data variables: (4)
- mu
(sample)
float64
6.36 4.445 6.403 ... 5.246 1.743
array([ 6.36016609, 4.44500166, 6.4025715 , 0.6208035 , -0.36975178,
3.62638602, 7.72234413, -5.72978615, 1.38868493, 3.06679932,
3.94084419, -0.33127538, 5.91070276, 2.70912973, 4.6230255 ,
9.38457212, 7.09292227, 6.96861465, 3.06679932, 4.8886937 ,
8.19643478, 12.76825657, 2.07029687, 0.9202618 , 6.55184214,
2.55559737, 1.83295983, 9.41977923, 4.38627348, 6.18582138,
4.31656562, 2.94380701, 3.84171861, 3.56951197, 5.42489494,
9.37092629, 7.59379332, -1.2572517 , 2.83746997, 4.96572058,
8.88702835, 6.55184214, 6.55184214, 3.36772816, 4.00463066,
4.5385762 , 2.82139573, 4.53622774, 0.09628516, 6.80693378,
8.50268593, 3.32394992, 1.08059213, 3.66464628, 2.16050606,
1.93874097, 9.11086845, 6.69183952, 12.70940608, 2.11978665,
3.85450813, 6.55184214, 5.65485258, 2.08844238, 0.76512305,
2.31795076, 7.60524325, 6.95543974, 4.16045136, 1.48303582,
4.44698385, -0.33631146, 6.28471683, 8.2046313 , 5.83666858,
5.52917054, 5.630824 , 3.53885699, 0.35544324, 8.35903039,
7.17026169, 5.21513983, 4.45525606, 8.48199223, -1.37571389,
6.67807657, 11.76203911, -1.78922523, 3.34181137, 2.66558925,
6.56770174, 2.82139573, -1.60388254, 6.93986164, 7.18712408,
4.15324775, 3.38723801, -0.81431913, 5.24604477, 1.74335259]) - theta
(school, sample)
float64
10.71 0.5876 9.016 ... 5.24 -0.8556
array([[ 1.07135884e+01, 5.87573480e-01, 9.01554086e+00,
4.08789055e+00, 7.11722294e-01, 7.62948922e+00,
1.46669201e+01, -9.92977774e+00, 5.61988571e+00,
3.34359524e+00, 6.61626771e+00, -6.94349462e+00,
8.08257446e+00, 4.35969089e+00, 5.35480976e+00,
1.05693241e+01, 7.61099342e+00, 6.13702948e+00,
3.34359524e+00, 6.93129267e+00, 9.69976686e+00,
2.47771747e+01, 1.28008171e+01, 1.39026471e+00,
5.36521047e+00, 9.97022761e+00, 2.23346708e+00,
9.80188050e+00, 5.98966865e+00, 7.65469494e+00,
1.40315253e+01, 4.76967305e+00, 5.10762035e+00,
4.07854425e+00, 4.21320287e+00, 1.04382282e+01,
9.25162767e+00, -6.76764101e+00, 9.99547815e+00,
9.79988246e+00, 9.23455863e+00, 5.36521047e+00,
5.36521047e+00, 7.42543182e+00, 4.62595853e+00,
3.24428943e+00, 3.25808233e+00, 1.00735392e+01,
1.24594188e+01, 6.75783510e+00, 7.52662516e+00,
8.57922295e+00, -6.91979578e-03, -2.69312264e+00,
4.19507281e+00, 7.52359557e+00, 9.44361810e+00,
3.05254866e+00, 1.36055567e+01, 3.96148108e-01,
...
6.99697482e+00, 5.83754061e+00, 6.28885601e+00,
5.37556287e+00, 3.35132225e+00, 2.34452622e+00,
2.19066997e+00, 9.71062111e+00, 9.12635811e+00,
-8.20216060e-01, -1.07279648e+01, 1.64468240e+00,
2.82970201e+00, 3.48277548e+00, 9.82982661e+00,
2.99212062e+00, 7.74506750e-01, 3.98680602e+00,
8.76875458e+00, 6.99697482e+00, 6.02210690e+00,
4.40281119e+00, 9.01668501e+00, 5.02669815e-01,
1.07929921e+01, 7.79568661e+00, 3.74670827e+00,
2.84025088e+00, 3.07807919e+01, 3.84328645e+00,
5.29491415e+00, 7.80023565e+00, -5.75440694e+00,
1.72456909e+01, 6.14555460e+00, 5.61131294e+00,
1.44309819e+01, 9.31385156e+00, 1.21108249e+01,
3.10465820e+00, 3.97152085e+00, 1.41588471e+01,
-8.31401966e-01, 8.33094714e+00, 1.08605358e+01,
2.03454051e+00, 2.80970001e+00, 1.17551597e+00,
1.20099269e+01, 3.35132225e+00, -3.23634279e+00,
9.24457174e-01, 5.21835424e+00, 3.08674539e+00,
-2.05161879e+00, -7.47162368e-01, 5.23985192e+00,
-8.55627259e-01]])- tau
(sample)
float64
4.929 3.515 3.592 ... 3.332 9.721
array([ 4.92943196, 3.51476983, 3.5923285 , 7.41209101, 1.85078268,
5.47144773, 4.96779694, 4.22228907, 2.1438466 , 1.05397997,
1.50199447, 6.05858013, 4.27328591, 3.87526246, 1.1912914 ,
1.43136612, 1.66467576, 1.02961365, 1.05397997, 4.09216594,
1.59652509, 5.88145407, 11.44711018, 1.95513925, 1.17639717,
2.98431134, 1.80923401, 1.32905663, 4.42844414, 2.69478582,
4.05611755, 4.70614984, 4.18636633, 13.92994098, 1.61059251,
0.92739651, 3.19481933, 4.01437683, 7.31810286, 5.9931926 ,
1.88317758, 1.17639717, 1.17639717, 3.63211955, 3.23661866,
5.22842338, 0.89648017, 4.84972805, 4.14617954, 5.54565471,
1.19942026, 6.45989038, 4.58289898, 5.11570376, 5.64859014,
5.46574835, 1.67610879, 6.13581176, 7.07189366, 1.75687835,
2.56881889, 1.17639717, 1.61434011, 6.71010022, 5.72775921,
4.68799598, 1.90979392, 2.71908424, 2.44003772, 1.99512024,
11.49168632, 3.97897024, 1.22644213, 1.87124261, 8.12422535,
7.51876593, 2.03765525, 3.14166276, 8.0649573 , 5.45734118,
6.35336854, 6.42609919, 2.34891602, 4.07617312, 4.29735338,
7.13157112, 3.41870683, 16.99320663, 5.3919785 , 4.15211868,
5.02920963, 0.89648017, 3.40880153, 4.89834456, 2.24406247,
2.87267928, 4.51806803, 1.75520797, 3.33155567, 9.7210021 ]) - log_tau
(sample)
float64
1.595 1.257 1.279 ... 1.203 2.274
array([ 1.59522376, 1.25697404, 1.2788006 , 2.00311259, 0.61560862,
1.69954325, 1.60297647, 1.44037741, 0.76260169, 0.05257344,
0.40679387, 1.80147547, 1.45238307, 1.35461339, 0.17503793,
0.35862932, 0.50963037, 0.02918363, 0.05257344, 1.4090744 ,
0.46782945, 1.77180402, 2.43773731, 0.67046142, 0.16245652,
1.09336901, 0.59290356, 0.28446939, 1.48804831, 0.99131873,
1.40022625, 1.54887013, 1.43183313, 2.63404055, 0.47660213,
-0.07537407, 1.16153054, 1.38988213, 1.99035112, 1.79062426,
0.63296055, 0.16245652, 0.16245652, 1.28981638, 1.17452916,
1.65410978, -0.10927911, 1.57892263, 1.42218732, 1.71301469,
0.18183832, 1.86561235, 1.52233176, 1.63231498, 1.73140598,
1.69850105, 0.51647491, 1.81414239, 1.95612829, 0.56353857,
0.94344622, 0.16245652, 0.47892627, 1.90361389, 1.74532439,
1.5450052 , 0.64699534, 1.00029515, 0.8920135 , 0.69070432,
2.44162385, 1.38102305, 0.2041174 , 0.62660271, 2.09485038,
2.01740202, 0.71179976, 1.1447522 , 2.08752842, 1.69696171,
1.84898515, 1.8603677 , 0.85395395, 1.40515859, 1.45799934,
1.96453156, 1.22926236, 2.83281365, 1.68491239, 1.42361873,
1.61526284, -0.10927911, 1.22636077, 1.5888973 , 0.80828783,
1.05524514, 1.50808448, 0.56258735, 1.20343936, 2.27428871])
- mu
Indexes: (2)
- PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - PandasMultiIndex
PandasIndex(MultiIndex([(1, 203),
(2, 316),
(0, 58),
(1, 22),
(2, 372),
(1, 214),
(3, 326),
(3, 390),
(2, 297),
(2, 363),
(1, 489),
(3, 356),
(2, 2),
(2, 52),
(0, 264),
(2, 396),
(3, 241),
(1, 418),
(2, 360),
(1, 314),
(2, 36),
(2, 324),
(3, 486),
(1, 40),
(3, 113),
(3, 232),
(2, 343),
(3, 35),
(2, 134),
(2, 179),
(1, 315),
(1, 108),
(3, 385),
(3, 18),
(0, 214),
(0, 302),
(0, 147),
(2, 326),
(0, 363),
(3, 395),
(1, 288),
(3, 108),
(3, 119),
(1, 102),
(0, 322),
(1, 336),
(1, 452),
(3, 175),
(3, 313),
(0, 94),
(1, 280),
(2, 50),
(0, 202),
(3, 8),
(2, 210),
(2, 274),
(3, 44),
(0, 346),
(1, 350),
(0, 198),
(2, 296),
(3, 118),
(2, 436),
(1, 362),
(1, 375),
(3, 401),
(2, 439),
(0, 190),
(2, 346),
(0, 65),
(3, 159),
(2, 211),
(3, 96),
(2, 376),
(1, 239),
(0, 204),
(0, 333),
(1, 149),
(1, 339),
(1, 347),
(2, 147),
(3, 350),
(2, 53),
(2, 310),
(1, 180),
(3, 66),
(2, 311),
(1, 201),
(0, 347),
(1, 356),
(2, 303),
(1, 466),
(0, 68),
(0, 145),
(1, 143),
(0, 460),
(2, 136),
(1, 37),
(0, 476),
(0, 368)],
name='sample'))
- PandasIndex
Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
Tip
Use a random seed to get the same subset from multiple groups: az.extract(idata, num_samples=100, rng=3)
and az.extract(idata, group="log_likelihood", num_samples=100, rng=3)
will continue to have matching samples.
Obtain a NumPy array for a given parameter#
Let’s say we want to get the values for mu
as a NumPy array.
array([7.87179637, 3.38455431, 9.10047569, ..., 1.76673325, 3.48611194, 3.40446391])
Get the dimension lengths#
Let’s check how many groups are in our hierarchical model.
len(idata.observed_data.school)
Get coordinate values#
What are the names of the groups in our hierarchical model? You can access them from the coordinate name school
in this case:
idata.observed_data.school
<xarray.DataArray 'school' (school: 8)> Size: 512B 'Choate' 'Deerfield' 'Phillips Andover' ... "St. Paul's" 'Mt. Hermon' Coordinates:
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
'Choate' 'Deerfield' 'Phillips Andover' ... "St. Paul's" 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')Coordinates: (1)
- school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
- school
Indexes: (1)
- PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
- PandasIndex
Attributes: (0)
Get a subset of chains#
Let’s keep only chain 0 and 2 here. For the subset to take effect on all relevant InferenceData groups: posterior, sample_stats, log_likelihood, posterior_predictive we will use the arviz.InferenceData.sel(), the method of InferenceData instead of xarray.Dataset.sel().
- posterior
<xarray.Dataset> Size: 93kB
Dimensions: (chain: 2, draw: 500, school: 8)
Coordinates:- chain (chain) int64 16B 0 2
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 8kB 7.872 3.385 9.1 ... 2.871 4.096 1.776
theta (chain, draw, school) float64 64kB 12.32 9.905 ... 2.363 -2.968
tau (chain, draw) float64 8kB 4.726 3.909 4.844 ... 4.09 2.72 1.917
log_tau (chain, draw) float64 8kB 1.553 1.363 1.578 ... 1.408 1.001 0.6508
Attributes: (6)- Dimensions:
* chain: 2
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 2
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (4)
* mu
(chain, draw)
float64
7.872 3.385 9.1 ... 4.096 1.776
array([[7.871796, 3.384554, 9.100476, ..., 3.656804, 5.427279, 2.735883],
[4.527603, 5.862628, 5.910703, ..., 2.871067, 4.095536, 1.775718]])
* theta
(chain, draw, school)
float64
12.32 9.905 14.95 ... 2.363 -2.968
array([[[12.320686, 9.905367, ..., 13.198059, 15.061366],
[11.285623, 9.129324, ..., 10.055223, 6.176724],
...,
[10.402501, 6.907407, ..., 5.391061, 6.381239],
[ 6.661308, 7.413767, ..., 7.56657 , 9.987618]],
[[11.81417 , -0.040477, ..., 0.318087, 0.661304],
[ 4.743465, 10.175684, ..., 11.271711, 7.12114 ],
...,
[ 5.677651, 1.679108, ..., 1.280615, 7.627658],
[ 1.625447, 2.503281, ..., 2.362756, -2.967994]]])
* tau
(chain, draw)
float64
4.726 3.909 4.844 ... 2.72 1.917
array([[4.72574 , 3.908994, 4.844025, ..., 1.893838, 5.920062, 4.325896],
[3.501277, 2.893243, 4.273286, ..., 4.08978 , 2.72017 , 1.917011]])
* log_tau
(chain, draw)
float64
1.553 1.363 1.578 ... 1.001 0.6508
array([[ 1.55302418e+00, 1.36327995e+00, 1.57774603e+00,
6.18802278e-01, 1.55780951e+00, 1.25671910e+00,
1.43721949e+00, 9.87083658e-01, 1.56054365e-01,
1.91049952e-01, 5.83431177e-01, 6.09019240e-01,
1.60195535e+00, 1.24120216e+00, 8.47238096e-01,
6.37056145e-01, 5.20476536e-01, 6.48972800e-01,
4.64583388e-01, 8.78818168e-01, 7.42607878e-01,
1.23280175e+00, 7.78075153e-01, 1.25284415e+00,
7.55375819e-01, 1.13136236e+00, 1.48946714e+00,
7.84429576e-01, 6.42397943e-01, 2.67117339e-01,
9.51502947e-02, 9.25434942e-01, 5.06833585e-01,
1.43377199e+00, 1.69825516e+00, 1.85347955e+00,
2.23890162e+00, 1.85891164e+00, 8.93630782e-01,
1.24410125e+00, 1.09127118e+00, 5.46197566e-01,
7.86374231e-01, 8.29563970e-01, 1.37029263e+00,
1.29410534e+00, 1.73653849e+00, 2.49554546e+00,
2.04780393e+00, 1.68224915e+00, 1.39996629e+00,
1.95895168e+00, 1.90960828e+00, 1.22237934e+00,
1.16228400e+00, 1.40901934e+00, 1.60491251e+00,
1.04108086e+00, 1.27880060e+00, 2.97165589e-01,
...
1.53485359e+00, 6.20917185e-01, 9.66882054e-01,
1.22513268e+00, 1.17622913e+00, 1.13141728e+00,
9.64382676e-01, 1.57708236e+00, 9.66685005e-01,
1.27858266e+00, 1.19784451e+00, 1.74897368e+00,
2.52281304e+00, 1.75897988e+00, 1.86458986e+00,
1.19753581e+00, 2.07302016e+00, 1.53655732e+00,
1.33342236e+00, 8.48193540e-01, 1.01106837e+00,
8.21604557e-01, 5.28789977e-01, 4.45988247e-01,
4.45988247e-01, 1.29863901e+00, 1.47238421e+00,
9.30866456e-01, 4.95461104e-01, 4.95461104e-01,
4.95461104e-01, 9.87491541e-01, 1.11964319e+00,
1.16770678e+00, 1.11427311e+00, 8.97114047e-01,
8.38642994e-01, 8.39747089e-01, 8.92040131e-01,
1.17306794e+00, 1.14216576e+00, 1.43720047e+00,
9.37651794e-01, 8.99250277e-01, 1.50591560e+00,
1.57869633e+00, 1.27851594e+00, 1.08476495e+00,
1.64452176e+00, 2.41893953e+00, 2.38109781e+00,
7.73750618e-01, 1.64705895e+00, 1.60190697e+00,
1.27115094e+00, 9.39847701e-01, 1.40849125e+00,
1.00069436e+00, 6.50767311e-01]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 2], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 69kB
Dimensions: (chain: 2, draw: 500, school: 8)
Coordinates:- chain (chain) int64 16B 0 2
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 64kB ...
Attributes: (4)- Dimensions:
* chain: 2
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 2
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[8000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 2], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 69kB
Dimensions: (chain: 2, draw: 500, school: 8)
Coordinates:- chain (chain) int64 16B 0 2
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 64kB ...
Attributes: (4)- Dimensions:
* chain: 2
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 2
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[8000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 2], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 125kB
Dimensions: (chain: 2, draw: 500)
Coordinates:- chain (chain) int64 16B 0 2
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 8kB ...
energy_error (chain, draw) float64 8kB ...
lp (chain, draw) float64 8kB ...
index_in_trajectory (chain, draw) int64 8kB ...
acceptance_rate (chain, draw) float64 8kB ...
diverging (chain, draw) bool 1kB ...
... ...
smallest_eigval (chain, draw) float64 8kB ...
step_size_bar (chain, draw) float64 8kB ...
step_size (chain, draw) float64 8kB ...
energy (chain, draw) float64 8kB ...
tree_depth (chain, draw) int64 8kB ...
perf_counter_diff (chain, draw) float64 8kB ...
Attributes: (6)- Dimensions:
* chain: 2
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 2
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[1000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[1000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[1000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[1000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[1000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[1000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[1000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[1000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[1000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[1000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[1000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[1000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[1000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[1000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[1000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[1000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 2], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 4kB ...
theta (chain, draw, school) float64 32kB ...
mu (chain, draw) float64 4kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
...
[500 values with dtype=float64]
* theta
(chain, draw, school)
float64
...
[4000 values with dtype=float64]
* mu
(chain, draw)
float64
...
[500 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Remove the first n draws (burn-in)#
Let’s say we want to remove the first 100 samples, from all the chains and all InferenceData
groups with draws.
idata.sel(draw=slice(100, None))
- posterior
<xarray.Dataset> Size: 145kB
Dimensions: (chain: 4, draw: 400, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 3kB 100 101 102 103 104 105 ... 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 13kB 11.7 8.118 -5.88 ... 1.767 3.486 3.404
theta (chain, draw, school) float64 102kB 14.23 9.72 ... 6.762 1.295
tau (chain, draw) float64 13kB 4.289 2.765 2.457 ... 2.741 2.932 4.461
log_tau (chain, draw) float64 13kB 1.456 1.017 0.8991 ... 1.008 1.076 1.495
Attributes: (6)- Dimensions:
* chain: 4
* draw: 400
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (4)
* mu
(chain, draw)
float64
11.7 8.118 -5.88 ... 3.486 3.404
array([[11.696954, 8.118232, -5.879577, ..., 3.656804, 5.427279, 2.735883],
[ 1.788017, 4.005853, 3.367728, ..., 4.841024, 5.946105, 4.666438],
[-3.556408, -4.004835, -1.468155, ..., 2.871067, 4.095536, 1.775718],
[ 6.551842, 6.551842, 6.551842, ..., 1.766733, 3.486112, 3.404464]])
* theta
(chain, draw, school)
float64
14.23 9.72 9.195 ... 6.762 1.295
array([[[14.233871, 9.719505, ..., 13.893387, 16.755105],
[ 7.039749, 6.43951 , ..., 9.49575 , 2.414698],
...,
[10.402501, 6.907407, ..., 5.391061, 6.381239],
[ 6.661308, 7.413767, ..., 7.56657 , 9.987618]],
[[ 0.960887, 2.000763, ..., 5.833124, -0.25308 ],
[ 3.192414, 0.961681, ..., 3.695507, 3.936803],
...,
[ 7.030604, 6.214465, ..., 4.778138, 4.357112],
[ 4.884931, 3.952247, ..., 5.687935, 6.777772]],
[[-0.882173, 0.877192, ..., -1.57017 , -8.143601],
[-3.178242, 0.906009, ..., -3.9171 , -8.11232 ],
...,
[ 5.677651, 1.679108, ..., 1.280615, 7.627658],
[ 1.625447, 2.503281, ..., 2.362756, -2.967994]],
[[ 5.36521 , 5.920613, ..., 5.02678 , 6.996975],
[ 5.36521 , 5.920613, ..., 5.02678 , 6.996975],
...,
[ 4.182751, 7.554251, ..., 1.096098, 8.452282],
[ 0.192956, 6.498428, ..., 6.762455, 1.295051]]])
* tau
(chain, draw)
float64
4.289 2.765 2.457 ... 2.932 4.461
array([[4.289129, 2.764646, 2.457461, ..., 1.893838, 5.920062, 4.325896],
[4.457708, 2.643601, 3.63212 , ..., 2.17459 , 1.327551, 1.211995],
[5.979919, 5.879639, 5.467699, ..., 4.08978 , 2.72017 , 1.917011],
[1.176397, 1.176397, 1.176397, ..., 2.740607, 2.932379, 4.461246]])
* log_tau
(chain, draw)
float64
1.456 1.017 0.8991 ... 1.076 1.495
array([[1.45608367, 1.01691276, 0.8991289 , ..., 0.6386056 , 1.778347 ,
1.46461921],
[1.4946347 , 0.9721419 , 1.28981638, ..., 0.77684015, 0.28333575,
0.19226749],
[1.78840708, 1.77149543, 1.69885787, ..., 1.40849125, 1.00069436,
0.65076731],
[0.16245652, 0.16245652, 0.16245652, ..., 1.00817931, 1.07581413,
1.49542809]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 106kB
Dimensions: (chain: 4, draw: 400, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 3kB 100 101 102 103 104 105 ... 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 102kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 400
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[12800 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 106kB
Dimensions: (chain: 4, draw: 400, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 3kB 100 101 102 103 104 105 ... 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 102kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 400
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[12800 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 197kB
Dimensions: (chain: 4, draw: 400)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 3kB 100 101 102 103 ... 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 13kB ...
energy_error (chain, draw) float64 13kB ...
lp (chain, draw) float64 13kB ...
index_in_trajectory (chain, draw) int64 13kB ...
acceptance_rate (chain, draw) float64 13kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 13kB ...
step_size_bar (chain, draw) float64 13kB ...
step_size (chain, draw) float64 13kB ...
energy (chain, draw) float64 13kB ...
tree_depth (chain, draw) int64 13kB ...
perf_counter_diff (chain, draw) float64 13kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 400 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[1600 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[1600 values with dtype=float64]
* lp
(chain, draw)
float64
...
[1600 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[1600 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[1600 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[1600 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[1600 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[1600 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[1600 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[1600 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[1600 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[1600 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[1600 values with dtype=float64]
* energy
(chain, draw)
float64
...
[1600 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[1600 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[1600 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 36kB
Dimensions: (chain: 1, draw: 400, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 3kB 100 101 102 103 104 105 ... 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 3kB ...
theta (chain, draw, school) float64 26kB ...
mu (chain, draw) float64 3kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 400
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
...
[400 values with dtype=float64]
* theta
(chain, draw, school)
float64
...
[3200 values with dtype=float64]
* mu
(chain, draw)
float64
...
[400 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 29kB
Dimensions: (chain: 1, draw: 400, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 3kB 100 101 102 103 104 105 ... 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 26kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 400
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[3200 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
If you check the burnin
object you will see that the groups posterior
, posterior_predictive
, prior
and sample_stats
have 400 draws compared to idata
that has 500. The group observed_data
has not been affected because it does not have the draw
dimension. Alternatively, you can specify which group or groups you want to change.
idata.sel(draw=slice(100, None), groups="posterior")
- posterior
<xarray.Dataset> Size: 145kB
Dimensions: (chain: 4, draw: 400, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 3kB 100 101 102 103 104 105 ... 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 13kB 11.7 8.118 -5.88 ... 1.767 3.486 3.404
theta (chain, draw, school) float64 102kB 14.23 9.72 ... 6.762 1.295
tau (chain, draw) float64 13kB 4.289 2.765 2.457 ... 2.741 2.932 4.461
log_tau (chain, draw) float64 13kB 1.456 1.017 0.8991 ... 1.008 1.076 1.495
Attributes: (6)- Dimensions:
* chain: 4
* draw: 400
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
100 101 102 103 ... 496 497 498 499
array([100, 101, 102, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (4)
* mu
(chain, draw)
float64
11.7 8.118 -5.88 ... 3.486 3.404
array([[11.696954, 8.118232, -5.879577, ..., 3.656804, 5.427279, 2.735883],
[ 1.788017, 4.005853, 3.367728, ..., 4.841024, 5.946105, 4.666438],
[-3.556408, -4.004835, -1.468155, ..., 2.871067, 4.095536, 1.775718],
[ 6.551842, 6.551842, 6.551842, ..., 1.766733, 3.486112, 3.404464]])
* theta
(chain, draw, school)
float64
14.23 9.72 9.195 ... 6.762 1.295
array([[[14.233871, 9.719505, ..., 13.893387, 16.755105],
[ 7.039749, 6.43951 , ..., 9.49575 , 2.414698],
...,
[10.402501, 6.907407, ..., 5.391061, 6.381239],
[ 6.661308, 7.413767, ..., 7.56657 , 9.987618]],
[[ 0.960887, 2.000763, ..., 5.833124, -0.25308 ],
[ 3.192414, 0.961681, ..., 3.695507, 3.936803],
...,
[ 7.030604, 6.214465, ..., 4.778138, 4.357112],
[ 4.884931, 3.952247, ..., 5.687935, 6.777772]],
[[-0.882173, 0.877192, ..., -1.57017 , -8.143601],
[-3.178242, 0.906009, ..., -3.9171 , -8.11232 ],
...,
[ 5.677651, 1.679108, ..., 1.280615, 7.627658],
[ 1.625447, 2.503281, ..., 2.362756, -2.967994]],
[[ 5.36521 , 5.920613, ..., 5.02678 , 6.996975],
[ 5.36521 , 5.920613, ..., 5.02678 , 6.996975],
...,
[ 4.182751, 7.554251, ..., 1.096098, 8.452282],
[ 0.192956, 6.498428, ..., 6.762455, 1.295051]]])
* tau
(chain, draw)
float64
4.289 2.765 2.457 ... 2.932 4.461
array([[4.289129, 2.764646, 2.457461, ..., 1.893838, 5.920062, 4.325896],
[4.457708, 2.643601, 3.63212 , ..., 2.17459 , 1.327551, 1.211995],
[5.979919, 5.879639, 5.467699, ..., 4.08978 , 2.72017 , 1.917011],
[1.176397, 1.176397, 1.176397, ..., 2.740607, 2.932379, 4.461246]])
* log_tau
(chain, draw)
float64
1.456 1.017 0.8991 ... 1.076 1.495
array([[1.45608367, 1.01691276, 0.8991289 , ..., 0.6386056 , 1.778347 ,
1.46461921],
[1.4946347 , 0.9721419 , 1.28981638, ..., 0.77684015, 0.28333575,
0.19226749],
[1.78840708, 1.77149543, 1.69885787, ..., 1.40849125, 1.00069436,
0.65076731],
[0.16245652, 0.16245652, 0.16245652, ..., 1.00817931, 1.07581413,
1.49542809]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=400))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 246kB
Dimensions: (chain: 4, draw: 500)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 16kB ...
energy_error (chain, draw) float64 16kB ...
lp (chain, draw) float64 16kB ...
index_in_trajectory (chain, draw) int64 16kB ...
acceptance_rate (chain, draw) float64 16kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 16kB ...
step_size_bar (chain, draw) float64 16kB ...
step_size (chain, draw) float64 16kB ...
energy (chain, draw) float64 16kB ...
tree_depth (chain, draw) int64 16kB ...
perf_counter_diff (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[2000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[2000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[2000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[2000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[2000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[2000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[2000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[2000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[2000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 4kB ...
theta (chain, draw, school) float64 32kB ...
mu (chain, draw) float64 4kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
...
[500 values with dtype=float64]
* theta
(chain, draw, school)
float64
...
[4000 values with dtype=float64]
* mu
(chain, draw)
float64
...
[500 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Compute posterior mean values along draw
and chain
dimensions#
To compute the mean value of the posterior samples, do the following:
<xarray.Dataset> Size: 32B Dimensions: () Data variables: mu float64 8B 4.486 theta float64 8B 4.912 tau float64 8B 4.124 log_tau float64 8B 1.173
- Dimensions:
- Coordinates: (0)
- Data variables: (4)
- mu
()
float64
4.486 - theta
()
float64
4.912 - tau
()
float64
4.124 - log_tau
()
float64
1.173
- mu
- Indexes: (0)
- Attributes: (0)
This computes the mean along all dimensions. This is probably what you want for mu
and tau
, which have two dimensions (chain
and draw
), but maybe not what you expected for theta
, which has one more dimension school
.
You can specify along which dimension you want to compute the mean (or other functions).
post.mean(dim=["chain", "draw"])
<xarray.Dataset> Size: 600B Dimensions: (school: 8) Coordinates:
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon' Data variables: mu float64 8B 4.486 theta (school) float64 64B 6.46 5.028 3.938 4.872 3.667 3.975 6.581 4.772 tau float64 8B 4.124 log_tau float64 8B 1.173
Dimensions:
- school: 8
Coordinates: (1)
- school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
- school
Data variables: (4)
- mu
()
float64
4.486 - theta
(school)
float64
6.46 5.028 3.938 ... 6.581 4.772
array([6.46006423, 5.02755458, 3.93803067, 4.87161236, 3.66684116,
3.97468712, 6.58092358, 4.77241104]) - tau
()
float64
4.124 - log_tau
()
float64
1.173
- mu
Indexes: (1)
- PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
- PandasIndex
Attributes: (0)
Compute and store posterior pushforward quantities#
We use “posterior pushfoward quantities” to refer to quantities that are not variables in the posterior but deterministic computations using posterior variables.
You can use xarray for these pushforward operations and store them as a new variable in the posterior group. You’ll then be able to plot them with ArviZ functions, calculate stats and diagnostics on them (like the mcse()) or save and share the inferencedata object with the pushforward quantities included.
Compute the rolling mean of \(\log(\tau)\) with xarray.DataArray.rolling(), storing the result in the posterior:
post["mlogtau"] = post["log_tau"].rolling({"draw": 50}).mean()
Using xarray for pusforward calculations has all the advantages of working with xarray. It also inherits the disadvantages of working with xarray, but we believe those to be outweighed by the advantages, and we have already shown how to extract the data as NumPy arrays. Working with InferenceData is working mainly with xarray objects and this is what is shown in this guide.
Some examples of these advantages are specifying operations with named dimensions instead of positional ones (as seen in some previous sections), automatic alignment and broadcasting of arrays (as we’ll see now), or integration with Dask (as shown in the Dask for ArviZ guide).
In this cell you will compute pairwise differences between schools on their mean effects (variable theta
). To do so, substract the variable theta after renaming the school dimension to the original variable. Xarray then aligns and broadcasts the two variables because they have different dimensions, and the result is a 4d variable with all the pointwise differences.
Eventually, store the result in the theta_school_diff
variable:
post["theta_school_diff"] = post.theta - post.theta.rename(school="school_bis")
Note
This same operation using NumPy would require manual alignment of the two arrays to make sure they broadcast correctly. The could would be something like:
theta_school_diff = theta[:, :, :, None] - theta[:, :, None, :]
The theta_school_diff
variable in the posterior has kept the named dimensions and coordinates:
<xarray.Dataset> Size: 1MB Dimensions: (chain: 4, draw: 500, school: 8, school_bis: 8) Coordinates:
chain (chain) int64 32B 0 1 2 3
draw (draw) int64 4kB 0 1 2 3 4 5 ... 494 495 496 497 498 499
school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
school_bis (school_bis) <U16 512B 'Choate' ... 'Mt. Hermon' Data variables: mu (chain, draw) float64 16kB 7.872 3.385 ... 3.486 3.404 theta (chain, draw, school) float64 128kB 12.32 9.905 ... 1.295 tau (chain, draw) float64 16kB 4.726 3.909 ... 2.932 4.461 log_tau (chain, draw) float64 16kB 1.553 1.363 ... 1.076 1.495 mlogtau (chain, draw) float64 16kB nan nan nan ... 1.496 1.511 theta_school_diff (chain, draw, school, school_bis) float64 1MB 0.0 ... 0.0 Attributes: (6)
Dimensions:
- chain: 4
- draw: 500
- school: 8
- school_bis: 8
Coordinates: (4)
- chain
(chain)
int64
0 1 2 3 - draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - school_bis
(school_bis)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
- chain
Data variables: (6)
- mu
(chain, draw)
float64
7.872 3.385 9.1 ... 3.486 3.404
array([[7.871796, 3.384554, 9.100476, ..., 3.656804, 5.427279, 2.735883],
[4.315817, 4.597701, 6.213762, ..., 4.841024, 5.946105, 4.666438],
[4.527603, 5.862628, 5.910703, ..., 2.871067, 4.095536, 1.775718],
[7.179504, 6.539699, 7.48362 , ..., 1.766733, 3.486112, 3.404464]]) - theta
(chain, draw, school)
float64
12.32 9.905 14.95 ... 6.762 1.295
array([[[12.320686, 9.905367, ..., 13.198059, 15.061366],
[11.285623, 9.129324, ..., 10.055223, 6.176724],
...,
[10.402501, 6.907407, ..., 5.391061, 6.381239],
[ 6.661308, 7.413767, ..., 7.56657 , 9.987618]],
[[ 5.596639, 6.959605, ..., 7.148854, 3.7909 ],
[ 4.96541 , 1.779358, ..., 3.289161, 5.937311],
...,
[ 7.030604, 6.214465, ..., 4.778138, 4.357112],
[ 4.884931, 3.952247, ..., 5.687935, 6.777772]],
[[11.81417 , -0.040477, ..., 0.318087, 0.661304],
[ 4.743465, 10.175684, ..., 11.271711, 7.12114 ],
...,
[ 5.677651, 1.679108, ..., 1.280615, 7.627658],
[ 1.625447, 2.503281, ..., 2.362756, -2.967994]],
[[ 8.344508, 5.390855, ..., 12.46814 , 12.607797],
[ 8.93115 , 6.852969, ..., 7.013971, 5.136297],
...,
[ 4.182751, 7.554251, ..., 1.096098, 8.452282],
[ 0.192956, 6.498428, ..., 6.762455, 1.295051]]]) - tau
(chain, draw)
float64
4.726 3.909 4.844 ... 2.932 4.461
array([[4.72574 , 3.908994, 4.844025, ..., 1.893838, 5.920062, 4.325896],
[1.97083 , 2.049029, 2.123765, ..., 2.17459 , 1.327551, 1.211995],
[3.501277, 2.893243, 4.273286, ..., 4.08978 , 2.72017 , 1.917011],
[6.07326 , 3.771867, 3.170537, ..., 2.740607, 2.932379, 4.461246]]) - log_tau
(chain, draw)
float64
1.553 1.363 1.578 ... 1.076 1.495
array([[1.55302418, 1.36327995, 1.57774603, ..., 0.6386056 , 1.778347 ,
1.46461921],
[0.67845483, 0.71736608, 0.75319044, ..., 0.77684015, 0.28333575,
0.19226749],
[1.25312773, 1.06237808, 1.45238307, ..., 1.40849125, 1.00069436,
0.65076731],
[1.8038955 , 1.32757011, 1.15390112, ..., 1.00817931, 1.07581413,
1.49542809]]) - mlogtau
(chain, draw)
float64
nan nan nan ... 1.494 1.496 1.511
array([[ nan, nan, nan, ..., 1.16476321, 1.19559572,
1.22597193],
[ nan, nan, nan, ..., 0.12348971, 0.131342 ,
0.13737294],
[ nan, nan, nan, ..., 1.22653292, 1.21500516,
1.20868681],
[ nan, nan, nan, ..., 1.4938526 , 1.49647017,
1.5112594 ]]) - theta_school_diff
(chain, draw, school, school_bis)
float64
0.0 2.415 -2.631 ... -5.467 0.0
array([[[[ 0.00000000e+00, 2.41531869e+00, -2.63092992e+00, ...,
-4.58110972e+00, -8.77373755e-01, -2.74068026e+00],
[-2.41531869e+00, 0.00000000e+00, -5.04624860e+00, ...,
-6.99642840e+00, -3.29269244e+00, -5.15599894e+00],
[ 2.63092992e+00, 5.04624860e+00, 0.00000000e+00, ...,
-1.95017980e+00, 1.75355616e+00, -1.09750340e-01],
...,
[ 4.58110972e+00, 6.99642840e+00, 1.95017980e+00, ...,
0.00000000e+00, 3.70373596e+00, 1.84042946e+00],
[ 8.77373755e-01, 3.29269244e+00, -1.75355616e+00, ...,
-3.70373596e+00, 0.00000000e+00, -1.86330650e+00],
[ 2.74068026e+00, 5.15599894e+00, 1.09750340e-01, ...,
-1.84042946e+00, 1.86330650e+00, 0.00000000e+00]],
[[ 0.00000000e+00, 2.15629954e+00, 8.14635996e+00, ...,
8.89253514e+00, 1.23040040e+00, 5.10889901e+00],
[-2.15629954e+00, 0.00000000e+00, 5.99006042e+00, ...,
6.73623560e+00, -9.25899137e-01, 2.95259947e+00],
[-8.14635996e+00, -5.99006042e+00, 0.00000000e+00, ...,
7.46175179e-01, -6.91595956e+00, -3.03746095e+00],
...
[-2.65379240e+00, -6.02529245e+00, -2.92707633e+00, ...,
0.00000000e+00, 4.32859842e-01, -6.92332351e+00],
[-3.08665224e+00, -6.45815229e+00, -3.35993618e+00, ...,
-4.32859842e-01, 0.00000000e+00, -7.35618335e+00],
[ 4.26953111e+00, 8.98031057e-01, 3.99624717e+00, ...,
6.92332351e+00, 7.35618335e+00, 0.00000000e+00]],
[[ 0.00000000e+00, -6.30547202e+00, 1.08737981e+00, ...,
-7.74350435e+00, -6.56949881e+00, -1.10209482e+00],
[ 6.30547202e+00, 0.00000000e+00, 7.39285182e+00, ...,
-1.43803234e+00, -2.64026792e-01, 5.20337720e+00],
[-1.08737981e+00, -7.39285182e+00, 0.00000000e+00, ...,
-8.83088416e+00, -7.65687862e+00, -2.18947462e+00],
...,
[ 7.74350435e+00, 1.43803234e+00, 8.83088416e+00, ...,
0.00000000e+00, 1.17400554e+00, 6.64140953e+00],
[ 6.56949881e+00, 2.64026792e-01, 7.65687862e+00, ...,
-1.17400554e+00, 0.00000000e+00, 5.46740399e+00],
[ 1.10209482e+00, -5.20337720e+00, 2.18947462e+00, ...,
-6.64140953e+00, -5.46740399e+00, 0.00000000e+00]]]])- mu
Indexes: (4)
- PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain')) - PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school_bis'))
- PandasIndex
Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
Advanced subsetting#
To select the value corresponding to the difference between the Choate and Deerfield schools do:
post["theta_school_diff"].sel(school="Choate", school_bis="Deerfield")
<xarray.DataArray 'theta_school_diff' (chain: 4, draw: 500)> Size: 16kB 2.415 2.156 -0.04943 1.228 3.384 9.662 ... -1.656 -0.4021 1.524 -3.372 -6.305 Coordinates:
chain (chain) int64 32B 0 1 2 3
draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499 school <U16 64B 'Choate' school_bis <U16 64B 'Deerfield'
2.415 2.156 -0.04943 1.228 3.384 ... -0.4021 1.524 -3.372 -6.305
array([[ 2.41531869, 2.15629954, -0.04942665, ..., -1.568983 ,
3.49509445, -0.75245938],
[-1.36296658, 3.18605183, -3.57582959, ..., -0.03288082,
0.81613882, 0.93268411],
[11.85464717, -5.43221857, 0.85662645, ..., -1.62004592,
3.99854315, -0.87783417],
[ 2.95365309, 2.07818191, 4.51853032, ..., 1.5236138 ,
-3.37150005, -6.30547202]])Coordinates: (4)
- chain
(chain)
int64
0 1 2 3 - draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - school
()
<U16
'Choate'
array('Choate', dtype='<U16') - school_bis
()
<U16
'Deerfield'
array('Deerfield', dtype='<U16')
- chain
Indexes: (2)
- PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain')) - PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
- PandasIndex
Attributes: (0)
For more advanced subsetting (the equivalent to what is sometimes called “fancy indexing” in NumPy), you need to provide the indices as DataArray objects:
<xarray.DataArray 'theta_school_diff' (chain: 4, draw: 500, pairwise_school_diff: 3)> Size: 48kB 2.415 -6.741 -1.84 2.156 -3.474 3.784 ... -2.619 6.923 -6.305 1.667 -6.641 Coordinates:
chain (chain) int64 32B 0 1 2 3
draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499 school (pairwise_school_diff) <U16 192B 'Choate' ... 'Mt. Hermon' school_bis (pairwise_school_diff) <U16 192B 'Deerfield' ... 'Lawrenceville' Dimensions without coordinates: pairwise_school_diff
2.415 -6.741 -1.84 2.156 -3.474 ... -2.619 6.923 -6.305 1.667 -6.641
array([[[ 2.41531869, -6.74108399, -1.84042946],
[ 2.15629954, -3.47410767, 3.78363613],
[ -0.04942665, 4.28447846, 0.62431982],
...,
[ -1.568983 , 5.53829038, -3.9072901 ],
[ 3.49509445, -12.62680339, 9.21627977],
[ -0.75245938, -7.16363884, 14.24249242]],
[[ -1.36296658, -2.09672634, -1.78220365],
[ 3.18605183, 1.39310745, 1.30385219],
[ -3.57582959, -3.73894295, 1.50957259],
...,
[ -0.03288082, 0.22920766, 4.259231 ],
[ 0.81613882, -1.39409761, -2.83464009],
[ 0.93268411, 0.99243438, 1.52660383]],
[[ 11.85464717, -4.83033352, -2.06409623],
[ -5.43221857, -2.45302911, -0.29934021],
[ 0.85662645, -6.70463782, -4.8911762 ],
...,
[ -1.62004592, -0.95078454, -1.95522498],
[ 3.99854315, -0.85757228, 6.01710874],
[ -0.87783417, -0.5224125 , -4.44552037]],
[[ 2.95365309, -17.43005136, 4.73220433],
[ 2.07818191, 3.61925306, 5.02518058],
[ 4.51853032, -10.373311 , -2.59184142],
...,
[ 1.5236138 , -0.88482747, -7.33031773],
[ -3.37150005, -2.61944346, 6.92332351],
[ -6.30547202, 1.66679103, -6.64140953]]])Coordinates: (4)
- chain
(chain)
int64
0 1 2 3 - draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - school
(pairwise_school_diff)
<U16
'Choate' 'Hotchkiss' 'Mt. Hermon'
array(['Choate', 'Hotchkiss', 'Mt. Hermon'], dtype='<U16') - school_bis
(pairwise_school_diff)
<U16
'Deerfield' ... 'Lawrenceville'
array(['Deerfield', 'Choate', 'Lawrenceville'], dtype='<U16')
- chain
Indexes: (2)
- PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain')) - PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
- PandasIndex
Attributes: (0)
Using lists or NumPy arrays instead of DataArrays does colum/row based indexing. As you can see, the result has 9 values of theta_school_diff
instead of the 3 pairs of difference we selected in the previous cell:
post["theta_school_diff"].sel( school=["Choate", "Hotchkiss", "Mt. Hermon"], school_bis=["Deerfield", "Choate", "Lawrenceville"], )
<xarray.DataArray 'theta_school_diff' (chain: 4, draw: 500, school: 3, school_bis: 3)> Size: 144kB 2.415 0.0 -4.581 -4.326 -6.741 -11.32 ... 1.667 -6.077 -5.203 1.102 -6.641 Coordinates:
chain (chain) int64 32B 0 1 2 3
draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
school (school) <U16 192B 'Choate' 'Hotchkiss' 'Mt. Hermon'
school_bis (school_bis) <U16 192B 'Deerfield' 'Choate' 'Lawrenceville'
2.415 0.0 -4.581 -4.326 -6.741 ... 1.667 -6.077 -5.203 1.102 -6.641
array([[[[ 2.41531869, 0. , -4.58110972],
[ -4.3257653 , -6.74108399, -11.3221937 ],
[ 5.15599894, 2.74068026, -1.84042946]],
[[ 2.15629954, 0. , 8.89253514],
[ -1.31780813, -3.47410767, 5.41842747],
[ -2.95259947, -5.10889901, 3.78363613]],
[[ -0.04942665, 0. , -2.43482132],
[ 4.2350518 , 4.28447846, 1.84965714],
[ 3.00971448, 3.05914114, 0.62431982]],
...,
[[ -1.568983 , 0. , -7.17971855],
[ 3.96930738, 5.53829038, -1.64142817],
[ 1.70344545, 3.27242845, -3.9072901 ]],
[[ 3.49509445, 0. , 13.23754201],
[ -9.13170894, -12.62680339, 0.61073863],
...
[ 5.69743498, 3.61925306, 12.43928685],
[ -1.71667129, -3.7948532 , 5.02518058]],
[[ 4.51853032, 0. , -1.82804532],
[ -5.85478068, -10.373311 , -12.20135632],
[ 3.75473422, -0.7637961 , -2.59184142]],
...,
[[ 1.5236138 , 0. , -1.17473412],
[ 0.63878633, -0.88482747, -2.05956159],
[ -4.63196981, -6.15558361, -7.33031773]],
[[ -3.37150005, 0. , 2.6537924 ],
[ -5.99094351, -2.61944346, 0.03434894],
[ 0.89803106, 4.26953111, 6.92332351]],
[[ -6.30547202, 0. , -7.74350435],
[ -4.63868099, 1.66679103, -6.07671332],
[ -5.2033772 , 1.10209482, -6.64140953]]]])
- Coordinates: (4)
- chain
(chain)
int64
0 1 2 3 - draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - school
(school)
<U16
'Choate' 'Hotchkiss' 'Mt. Hermon'
array(['Choate', 'Hotchkiss', 'Mt. Hermon'], dtype='<U16') - school_bis
(school_bis)
<U16
'Deerfield' ... 'Lawrenceville'
array(['Deerfield', 'Choate', 'Lawrenceville'], dtype='<U16')
- chain
- Indexes: (4)
- PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain')) - PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - PandasIndex
PandasIndex(Index(['Choate', 'Hotchkiss', 'Mt. Hermon'], dtype='object', name='school')) - PandasIndex
PandasIndex(Index(['Deerfield', 'Choate', 'Lawrenceville'], dtype='object', name='school_bis'))
- PandasIndex
- Attributes: (0)
Add new chains using concat#
After checking the mcse() and realizing you need more samples, you rerun the model with two chains and obtain an idata_rerun
object.
idata_rerun = ( idata.sel(chain=[0, 1]) .copy() .assign_coords(coords={"chain": [4, 5]}, groups="posterior_groups") )
You can combine the two into a single InferenceData object using arviz.concat():
idata_complete = az.concat(idata, idata_rerun, dim="chain") idata_complete.posterior.sizes["chain"]
Add groups to InferenceData objects#
You can also add new groups to InferenceData objects with the extend() (if the new groups are already in an InferenceData object) or with add_groups() (if the new groups are dictionaries or xarray.Dataset
objects).
rng = np.random.default_rng(3) idata.add_groups( {"predictions": {"obs": rng.normal(size=(4, 500, 2))}}, dims={"obs": ["new_school"]}, coords={"new_school": ["Essex College", "Moordale"]}, ) idata
- posterior
<xarray.Dataset> Size: 1MB
Dimensions: (chain: 4, draw: 500, school: 8, school_bis: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- school_bis (school_bis) <U16 512B 'Choate' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 16kB 7.872 3.385 ... 3.486 3.404
theta (chain, draw, school) float64 128kB 12.32 9.905 ... 1.295
tau (chain, draw) float64 16kB 4.726 3.909 ... 2.932 4.461
log_tau (chain, draw) float64 16kB 1.553 1.363 ... 1.076 1.495
mlogtau (chain, draw) float64 16kB nan nan nan ... 1.496 1.511
theta_school_diff (chain, draw, school, school_bis) float64 1MB 0.0 ... 0.0
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500
* school: 8
* school_bis: 8 - Coordinates: (4)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* school_bis
(school_bis)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (6)
* mu
(chain, draw)
float64
7.872 3.385 9.1 ... 3.486 3.404
array([[7.871796, 3.384554, 9.100476, ..., 3.656804, 5.427279, 2.735883],
[4.315817, 4.597701, 6.213762, ..., 4.841024, 5.946105, 4.666438],
[4.527603, 5.862628, 5.910703, ..., 2.871067, 4.095536, 1.775718],
[7.179504, 6.539699, 7.48362 , ..., 1.766733, 3.486112, 3.404464]])
* theta
(chain, draw, school)
float64
12.32 9.905 14.95 ... 6.762 1.295
array([[[12.320686, 9.905367, ..., 13.198059, 15.061366],
[11.285623, 9.129324, ..., 10.055223, 6.176724],
...,
[10.402501, 6.907407, ..., 5.391061, 6.381239],
[ 6.661308, 7.413767, ..., 7.56657 , 9.987618]],
[[ 5.596639, 6.959605, ..., 7.148854, 3.7909 ],
[ 4.96541 , 1.779358, ..., 3.289161, 5.937311],
...,
[ 7.030604, 6.214465, ..., 4.778138, 4.357112],
[ 4.884931, 3.952247, ..., 5.687935, 6.777772]],
[[11.81417 , -0.040477, ..., 0.318087, 0.661304],
[ 4.743465, 10.175684, ..., 11.271711, 7.12114 ],
...,
[ 5.677651, 1.679108, ..., 1.280615, 7.627658],
[ 1.625447, 2.503281, ..., 2.362756, -2.967994]],
[[ 8.344508, 5.390855, ..., 12.46814 , 12.607797],
[ 8.93115 , 6.852969, ..., 7.013971, 5.136297],
...,
[ 4.182751, 7.554251, ..., 1.096098, 8.452282],
[ 0.192956, 6.498428, ..., 6.762455, 1.295051]]])
* tau
(chain, draw)
float64
4.726 3.909 4.844 ... 2.932 4.461
array([[4.72574 , 3.908994, 4.844025, ..., 1.893838, 5.920062, 4.325896],
[1.97083 , 2.049029, 2.123765, ..., 2.17459 , 1.327551, 1.211995],
[3.501277, 2.893243, 4.273286, ..., 4.08978 , 2.72017 , 1.917011],
[6.07326 , 3.771867, 3.170537, ..., 2.740607, 2.932379, 4.461246]])
* log_tau
(chain, draw)
float64
1.553 1.363 1.578 ... 1.076 1.495
array([[1.55302418, 1.36327995, 1.57774603, ..., 0.6386056 , 1.778347 ,
1.46461921],
[0.67845483, 0.71736608, 0.75319044, ..., 0.77684015, 0.28333575,
0.19226749],
[1.25312773, 1.06237808, 1.45238307, ..., 1.40849125, 1.00069436,
0.65076731],
[1.8038955 , 1.32757011, 1.15390112, ..., 1.00817931, 1.07581413,
1.49542809]])
* mlogtau
(chain, draw)
float64
nan nan nan ... 1.494 1.496 1.511
array([[ nan, nan, nan, ..., 1.16476321, 1.19559572,
1.22597193],
[ nan, nan, nan, ..., 0.12348971, 0.131342 ,
0.13737294],
[ nan, nan, nan, ..., 1.22653292, 1.21500516,
1.20868681],
[ nan, nan, nan, ..., 1.4938526 , 1.49647017,
1.5112594 ]])
* theta_school_diff
(chain, draw, school, school_bis)
float64
0.0 2.415 -2.631 ... -5.467 0.0
array([[[[ 0.00000000e+00, 2.41531869e+00, -2.63092992e+00, ...,
-4.58110972e+00, -8.77373755e-01, -2.74068026e+00],
[-2.41531869e+00, 0.00000000e+00, -5.04624860e+00, ...,
-6.99642840e+00, -3.29269244e+00, -5.15599894e+00],
[ 2.63092992e+00, 5.04624860e+00, 0.00000000e+00, ...,
-1.95017980e+00, 1.75355616e+00, -1.09750340e-01],
...,
[ 4.58110972e+00, 6.99642840e+00, 1.95017980e+00, ...,
0.00000000e+00, 3.70373596e+00, 1.84042946e+00],
[ 8.77373755e-01, 3.29269244e+00, -1.75355616e+00, ...,
-3.70373596e+00, 0.00000000e+00, -1.86330650e+00],
[ 2.74068026e+00, 5.15599894e+00, 1.09750340e-01, ...,
-1.84042946e+00, 1.86330650e+00, 0.00000000e+00]],
[[ 0.00000000e+00, 2.15629954e+00, 8.14635996e+00, ...,
8.89253514e+00, 1.23040040e+00, 5.10889901e+00],
[-2.15629954e+00, 0.00000000e+00, 5.99006042e+00, ...,
6.73623560e+00, -9.25899137e-01, 2.95259947e+00],
[-8.14635996e+00, -5.99006042e+00, 0.00000000e+00, ...,
7.46175179e-01, -6.91595956e+00, -3.03746095e+00],
...
[-2.65379240e+00, -6.02529245e+00, -2.92707633e+00, ...,
0.00000000e+00, 4.32859842e-01, -6.92332351e+00],
[-3.08665224e+00, -6.45815229e+00, -3.35993618e+00, ...,
-4.32859842e-01, 0.00000000e+00, -7.35618335e+00],
[ 4.26953111e+00, 8.98031057e-01, 3.99624717e+00, ...,
6.92332351e+00, 7.35618335e+00, 0.00000000e+00]],
[[ 0.00000000e+00, -6.30547202e+00, 1.08737981e+00, ...,
-7.74350435e+00, -6.56949881e+00, -1.10209482e+00],
[ 6.30547202e+00, 0.00000000e+00, 7.39285182e+00, ...,
-1.43803234e+00, -2.64026792e-01, 5.20337720e+00],
[-1.08737981e+00, -7.39285182e+00, 0.00000000e+00, ...,
-8.83088416e+00, -7.65687862e+00, -2.18947462e+00],
...,
[ 7.74350435e+00, 1.43803234e+00, 8.83088416e+00, ...,
0.00000000e+00, 1.17400554e+00, 6.64140953e+00],
[ 6.56949881e+00, 2.64026792e-01, 7.65687862e+00, ...,
-1.17400554e+00, 0.00000000e+00, 5.46740399e+00],
[ 1.10209482e+00, -5.20337720e+00, 2.18947462e+00, ...,
-6.64140953e+00, -5.46740399e+00, 0.00000000e+00]]]]) - Indexes: (4)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school_bis')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- predictions
<xarray.Dataset> Size: 36kB
Dimensions: (chain: 4, draw: 500, new_school: 2)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- new_school (new_school) <U13 104B 'Essex College' 'Moordale'
Data variables:
obs (chain, draw, new_school) float64 32kB 2.041 -2.556 ... -0.2822
Attributes: (2)- Dimensions:
* chain: 4
* draw: 500
* new_school: 2 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* new_school
(new_school)
<U13
'Essex College' 'Moordale'
array(['Essex College', 'Moordale'], dtype='<U13') - Data variables: (1)
* obs
(chain, draw, new_school)
float64
2.041 -2.556 ... -1.015 -0.2822
array([[[ 2.04091912, -2.55566503],
[ 0.41809885, -0.56776961],
[-0.45264929, -0.21559716],
...,
[-0.80265585, 0.40858787],
[ 0.89066617, 0.91324226],
[ 0.30152948, -2.85103878]],
[[-1.02941822, 0.81504467],
[-0.86725243, -1.00340203],
[-2.30495532, 1.26656886],
...,
[-1.40028095, 1.9391935 ],
[-0.37582993, -0.76872586],
[ 0.11466401, -0.89829659]],
[[ 0.02963037, -0.96028439],
[ 0.56533507, 0.05565896],
[-1.36828642, 1.0376982 ],
...,
[ 0.23222422, 0.36513287],
[ 0.31840946, -0.56685801],
[ 2.39826354, 0.91078977]],
[[-1.42283401, -0.74058959],
[ 0.83390251, 0.53293412],
[ 0.13188271, -0.03434879],
...,
[ 1.57846099, 0.24653314],
[ 0.64302486, 1.42710376],
[-1.01529472, -0.28215614]]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Essex College', 'Moordale'], dtype='object', name='new_school')) - Attributes: (2)
created_at :
2024-09-28T19:22:37.147191+00:00
arviz_version :
0.20.0
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 246kB
Dimensions: (chain: 4, draw: 500)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 16kB ...
energy_error (chain, draw) float64 16kB ...
lp (chain, draw) float64 16kB ...
index_in_trajectory (chain, draw) int64 16kB ...
acceptance_rate (chain, draw) float64 16kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 16kB ...
step_size_bar (chain, draw) float64 16kB ...
step_size (chain, draw) float64 16kB ...
energy (chain, draw) float64 16kB ...
tree_depth (chain, draw) int64 16kB ...
perf_counter_diff (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[2000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[2000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[2000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[2000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[2000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[2000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[2000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[2000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[2000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 4kB ...
theta (chain, draw, school) float64 32kB ...
mu (chain, draw) float64 4kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
...
[500 values with dtype=float64]
* theta
(chain, draw, school)
float64
...
[4000 values with dtype=float64]
* mu
(chain, draw)
float64
...
[500 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Add Transformations to Multiple Groups#
You can also add transformations to Multiple InferenceData Groups using arviz.InferenceData.map(). It takes a function as an input and applies the function groupwise to the selected InferenceData groups and overwrites the group with the result of the function.
selected_groups = ["posterior", "prior"]
def calc_mean(dataset, *args, **kwargs): result = dataset.mean(dim="chain", *args, **kwargs) return result
means = idata.map(calc_mean, groups=selected_groups, inplace=False) means
- posterior
<xarray.Dataset> Size: 309kB
Dimensions: (draw: 500, school: 8, school_bis: 8)
Coordinates:- draw (draw) int64 4kB 0 1 2 3 4 5 ... 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- school_bis (school_bis) <U16 512B 'Choate' ... 'Mt. Hermon'
Data variables:
mu (draw) float64 4kB 5.974 5.096 7.177 ... 4.739 3.146
theta (draw, school) float64 32kB 9.519 5.554 ... 5.595 3.773
tau (draw) float64 4kB 4.068 3.156 3.603 ... 3.225 2.979
log_tau (draw) float64 4kB 1.322 1.118 1.234 ... 1.035 0.9508
mlogtau (draw) float64 4kB nan nan nan nan ... 1.002 1.01 1.021
theta_school_diff (draw, school, school_bis) float64 256kB 0.0 ... 0.0- Dimensions:
* draw: 500
* school: 8
* school_bis: 8 - Coordinates: (3)
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* school_bis
(school_bis)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (6)
* mu
(draw)
float64
5.974 5.096 7.177 ... 4.739 3.146
array([ 5.97368017, 5.09614549, 7.17713997, 6.87741417, 6.88441083,
4.84086372, 7.01708358, 6.30316861, 4.51620587, 3.51435901,
8.02470906, 5.95045866, 5.02167729, 4.3671087 , 3.83334779,
3.94213036, 4.16589421, 2.12301607, 1.95301774, 2.87799146,
2.45097497, 4.6973103 , 6.23496838, 5.71981672, 8.43315988,
7.8214925 , 6.96952817, 7.02978194, 5.6004881 , 7.09120336,
7.01093531, 6.77268374, 6.2905079 , 4.5431412 , 4.94294994,
4.97649353, 5.42971457, 5.22441946, 5.12380029, 4.85319167,
5.59925422, 5.28412171, 3.44179875, 2.54282744, 2.04706891,
3.51007274, 2.81257858, 2.98355207, 1.25352519, 3.0289464 ,
4.29796057, 5.26610036, 3.37041698, 4.18994019, 4.21989074,
5.10601394, 2.9274154 , 5.19747242, 3.38401204, 4.82853361,
4.79157776, 6.29972209, 5.28340737, 5.80484852, 0.43976964,
1.13816338, 1.99660115, 4.53854082, 4.18764282, 5.08607123,
4.82755518, 4.87705035, 5.13060706, 5.65131506, 5.12875312,
5.10175967, 3.70935631, 4.91147853, 3.95385959, 2.84575154,
2.26131669, 1.91153602, 4.78462284, 3.65852601, 4.68021586,
3.64944805, 3.59396976, 5.08703284, 4.93070605, 5.88752838,
5.69143312, 8.2534381 , 7.61786813, 5.51614066, 4.81312486,
6.60340997, 5.03224433, 7.28815644, 6.27653186, 2.20050788,
...
4.83215454, 4.31025742, 5.52342996, 7.47556492, 8.40733007,
7.91724981, 6.58490944, 6.89924272, 5.94222017, 3.43319604,
6.60243616, 6.36189187, 3.80598967, 4.22733614, 5.1172315 ,
5.12510871, 6.61519371, 3.65237379, 5.72495477, 4.6349722 ,
1.86071336, 3.70878444, 4.03215053, 4.68583976, 4.32610419,
1.51856954, 6.97837558, 4.53510668, 6.49720081, 6.01585584,
4.64320497, 7.53733721, 4.99320792, 6.80154945, 3.83870421,
4.83408989, 3.9818728 , 3.87105982, 5.07985906, 5.24314344,
4.85720007, 5.26432426, 6.12469169, 5.66073344, 6.60622546,
6.0544301 , 5.01085876, 4.07245337, 4.41033219, 4.1244903 ,
2.82800074, 3.35555163, 5.12740508, 3.62961373, 4.97251047,
1.35997506, 3.07773379, 3.5442542 , 2.56527828, 2.79055045,
3.96084845, 5.01102 , 3.70448752, 5.42014382, 4.30528838,
3.03493602, 3.08845156, 3.75605787, 3.52525218, 3.2562104 ,
3.58446059, 4.07887414, 4.09665291, 4.62351667, 3.76542611,
3.52521781, 5.1456518 , 4.95544984, 4.59747767, 4.05346634,
2.92800398, 1.35454107, 4.06265637, 4.02687012, 5.4344199 ,
3.70135365, 4.66555525, 1.63401616, 3.88774047, 3.90969401,
3.68654685, 2.51199123, 2.86022208, 4.22286784, 3.97624991,
4.75407113, 3.53404815, 3.28390709, 4.73875823, 3.14562567])
* theta
(draw, school)
float64
9.519 5.554 6.118 ... 5.595 3.773
array([[ 9.5190006 , 5.5538375 , 6.11797152, ..., 8.26897288,
8.28328517, 8.03034163],
[ 7.48141224, 6.98433356, 6.07419118, ..., 3.63953594,
7.90751667, 6.09286812],
[ 7.32773875, 6.89026362, 7.05512777, ..., 8.31300687,
7.04794125, 6.97572556],
...,
[ 3.047783 , 3.47235698, 4.45528476, ..., 4.09130004,
5.36576861, 1.85789959],
[ 6.82337688, 5.58880778, 2.78970216, ..., 1.8740546 ,
3.13647791, 6.70457258],
[ 3.34116028, 5.09193064, -1.5848486 , ..., 2.60257005,
5.59492911, 3.77311163]])
* tau
(draw)
float64
4.068 3.156 3.603 ... 3.225 2.979
array([4.06777672, 3.15578323, 3.60290338, 5.78674782, 4.99791629,
5.93827284, 6.25265185, 4.72455418, 6.78584927, 6.49886649,
6.39464286, 7.96962525, 6.792903 , 8.80778665, 5.38340175,
7.90427878, 7.57656998, 5.9664143 , 5.98953719, 7.8490396 ,
7.54993238, 5.17961082, 5.4652292 , 4.99943296, 4.44016139,
4.3115449 , 4.32348229, 3.6495615 , 3.217016 , 2.68928529,
3.06877757, 2.47965636, 1.88171151, 2.78420116, 2.62295691,
2.69791747, 3.5159523 , 3.09278051, 1.89036139, 2.09688512,
2.49215524, 2.72371072, 3.49030974, 3.53160641, 2.96398495,
3.21665436, 4.09169266, 6.39026772, 5.03330529, 4.97603609,
4.77784331, 4.36531215, 4.4601659 , 2.80507495, 2.3501381 ,
3.095213 , 3.50675464, 3.12710161, 2.79361256, 1.86652857,
4.30979058, 3.42740763, 4.74104485, 4.41679668, 4.82857123,
3.81436024, 4.03065647, 3.79255865, 3.65891116, 2.76910642,
2.22663935, 1.5741797 , 1.34328882, 1.92134566, 1.70012019,
1.88589882, 2.58078539, 3.25028148, 3.51568834, 2.44678037,
2.56186234, 4.65392084, 3.51925728, 2.29815742, 3.63063287,
1.8630152 , 2.16440822, 2.649998 , 2.90568389, 2.91782833,
2.18914897, 2.59549741, 3.31528782, 3.8608286 , 5.61453817,
5.50407556, 6.90790968, 7.87946071, 7.353364 , 7.04856825,
...
3.42652914, 3.57338204, 3.74770977, 2.88104615, 3.56005932,
2.34044104, 2.87780539, 3.27653872, 3.82292255, 4.72303119,
4.40799976, 4.99298655, 4.76961762, 6.29895696, 4.44599886,
8.46419054, 5.37063054, 8.21373564, 5.57406191, 3.19423088,
4.13873245, 5.31248957, 6.23281937, 3.22694466, 4.30018798,
5.88784769, 3.93389001, 3.96732384, 2.77207946, 3.80397644,
3.25831244, 3.77610036, 4.46025825, 3.33782052, 4.0974327 ,
3.04840039, 2.79897829, 2.42587791, 2.38386316, 2.39282826,
2.96949488, 3.19170637, 1.83911656, 1.75128774, 1.94500911,
1.85281446, 1.80988697, 1.81275746, 2.39425682, 1.65065357,
1.89625809, 2.6089216 , 2.55957386, 4.76142826, 3.68749536,
4.08084387, 4.24416674, 3.34649285, 2.6608757 , 3.9892499 ,
3.62772503, 3.32206395, 2.60515095, 2.26993893, 2.15716903,
2.18656049, 3.55071147, 2.63647986, 2.97383805, 1.56236948,
2.87050116, 2.58342585, 2.66041767, 2.04853393, 2.5992427 ,
4.02498566, 3.23537501, 3.31062732, 3.4664859 , 5.77580729,
4.99415149, 5.72156943, 3.82769794, 3.95974907, 4.85488577,
5.40903182, 5.54289633, 2.8141554 , 3.07008713, 5.5777204 ,
5.80977649, 4.76253058, 3.03482558, 5.26768483, 4.46827381,
3.88216991, 2.73418374, 2.72470382, 3.22504062, 2.97903687])
* log_tau
(draw)
float64
1.322 1.118 1.234 ... 1.035 0.9508
array([1.32212556, 1.11764856, 1.23430516, 1.52712483, 1.57180336,
1.59710111, 1.76888052, 1.47739993, 1.48501664, 1.43572025,
1.60170582, 1.63659171, 1.81292151, 1.99935121, 1.60076885,
1.83411829, 1.76503459, 1.6225159 , 1.49361353, 1.91946337,
1.86287935, 1.5951552 , 1.59465596, 1.55712956, 1.38504505,
1.42312395, 1.41873094, 1.14388028, 1.01633582, 0.83147614,
0.87888469, 0.85543821, 0.60054467, 0.92276128, 0.79141052,
0.749707 , 0.88844695, 0.94007953, 0.58870299, 0.65533775,
0.85676477, 0.89525469, 1.05448166, 1.10475804, 1.03333584,
1.10569129, 1.31572942, 1.62596931, 1.45548446, 1.51836969,
1.50332905, 1.37313078, 1.39671947, 0.9999761 , 0.83446174,
1.08750122, 1.19208694, 1.09224322, 0.96974108, 0.5647696 ,
1.36678009, 1.06524726, 1.33866268, 1.28663071, 1.46052959,
1.24912767, 1.28475128, 1.29676047, 1.24253936, 0.87752469,
0.69056442, 0.38785849, 0.2509575 , 0.53294362, 0.45310091,
0.48162201, 0.74580352, 0.83137577, 0.95496117, 0.75435586,
0.72876676, 1.10436436, 0.96749644, 0.72609674, 0.86470599,
0.5363501 , 0.63629029, 0.89929707, 0.95499136, 0.97458604,
0.65407765, 0.7109385 , 0.84869173, 0.94788434, 1.49051811,
1.16734508, 1.52528834, 1.65168588, 1.49136407, 1.56663388,
...
1.04930386, 1.16284491, 1.2876382 , 0.96473001, 1.1665937 ,
0.81266219, 0.98534418, 1.131541 , 1.11553434, 1.52492898,
1.35239702, 1.54272234, 1.45051093, 1.48478808, 1.23224911,
1.87260057, 1.4580245 , 1.82822227, 1.43352967, 1.06545374,
1.29893155, 1.44350617, 1.35318041, 0.98140379, 1.13339888,
1.51068474, 1.1459622 , 1.12826635, 0.84799164, 1.07020212,
0.97887093, 1.01753226, 1.17841632, 0.98409605, 1.1166347 ,
0.94616877, 0.8293701 , 0.75817912, 0.76175016, 0.61564367,
0.8085938 , 0.85779852, 0.5392893 , 0.48652763, 0.55109029,
0.50195708, 0.48497505, 0.4984326 , 0.6623651 , 0.3897953 ,
0.48961253, 0.80520122, 0.70128035, 1.10832107, 1.10037509,
1.10587526, 1.19483734, 0.85241875, 0.77324695, 0.99495856,
0.98078574, 0.88856338, 0.73855622, 0.6734914 , 0.64531916,
0.65450283, 1.08323331, 0.77993352, 0.81227438, 0.39179354,
0.75881012, 0.76865767, 0.85020295, 0.61642445, 0.82759113,
1.13230688, 0.95640152, 0.97045308, 1.01824782, 1.33490267,
1.29329024, 1.45188135, 1.29971941, 1.28329117, 1.44397147,
1.60702321, 1.51286532, 0.99354128, 1.08536704, 1.52038248,
1.4752091 , 1.20395751, 0.9201547 , 1.51400454, 1.33073743,
1.19930214, 0.95451375, 0.95802908, 1.03454781, 0.95077052])
* mlogtau
(draw)
float64
nan nan nan ... 1.002 1.01 1.021
array([ nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
nan, nan, nan, nan, 1.30977551,
1.31339958, 1.31850923, 1.32175752, 1.31121454, 1.29646771,
1.28627571, 1.27473984, 1.2670367 , 1.25673119, 1.23931218,
1.23461367, 1.22318678, 1.2137016 , 1.19944719, 1.1966424 ,
1.18494259, 1.17533693, 1.16882182, 1.16380033, 1.14296156,
1.11951526, 1.09536933, 1.06849536, 1.04801164, 1.02937276,
1.01054272, 0.99708417, 0.99083408, 0.98960659, 0.98806418,
0.98506182, 0.99004034, 0.99737938, 0.99344609, 0.994912 ,
0.99064486, 0.98560173, 0.98478608, 0.99211184, 0.99849681,
0.99444307, 0.99075674, 0.98664095, 0.98350347, 0.99264712,
0.99388019, 0.99807137, 0.9985857 , 0.99930329, 1.00026858,
...
1.24079808, 1.23145719, 1.22714048, 1.22026642, 1.21389765,
1.20199003, 1.19228985, 1.18344793, 1.17838413, 1.17990264,
1.18186296, 1.18432244, 1.18262747, 1.18369914, 1.18777546,
1.20025858, 1.19932353, 1.20698224, 1.20424792, 1.19810419,
1.19308824, 1.19353773, 1.19349187, 1.18467999, 1.18420958,
1.18986859, 1.18993768, 1.18966549, 1.18596696, 1.18510645,
1.17984098, 1.17863544, 1.18347456, 1.18234616, 1.17901141,
1.17103034, 1.1672182 , 1.16313152, 1.15988649, 1.15308363,
1.15601855, 1.14669802, 1.13584688, 1.12187329, 1.11068578,
1.09437974, 1.08307464, 1.07388501, 1.06683324, 1.05605268,
1.04485886, 1.03770598, 1.02597883, 1.02885065, 1.02752628,
1.03339054, 1.0375804 , 1.03199796, 1.02515221, 1.0145528 ,
1.00712057, 0.99403739, 0.9797983 , 0.96357237, 0.95183377,
0.92747181, 0.91997599, 0.89901021, 0.88658511, 0.8731119 ,
0.86230948, 0.84881251, 0.83875296, 0.83145337, 0.82533721,
0.81776966, 0.81397844, 0.81082218, 0.8142273 , 0.81952131,
0.8258097 , 0.83449668, 0.83692274, 0.84290665, 0.84945338,
0.86267047, 0.87634037, 0.88104762, 0.88751995, 0.90561473,
0.91894704, 0.92587022, 0.93348752, 0.95403706, 0.96963001,
0.98357691, 0.99296768, 1.00215961, 1.00960326, 1.02082277])
* theta_school_diff
(draw, school, school_bis)
float64
0.0 3.965 3.401 ... -1.822 0.0
array([[[ 0. , 3.96516309, 3.40102907, ..., 1.25002772,
1.23571543, 1.48865897],
[-3.96516309, 0. , -0.56413402, ..., -2.71513538,
-2.72944766, -2.47650413],
[-3.40102907, 0.56413402, 0. , ..., -2.15100136,
-2.16531365, -1.91237011],
...,
[-1.25002772, 2.71513538, 2.15100136, ..., 0. ,
-0.01431229, 0.23863125],
[-1.23571543, 2.72944766, 2.16531365, ..., 0.01431229,
0. , 0.25294354],
[-1.48865897, 2.47650413, 1.91237011, ..., -0.23863125,
-0.25294354, 0. ]],
[[ 0. , 0.49707868, 1.40722105, ..., 3.84187629,
-0.42610443, 1.38854412],
[-0.49707868, 0. , 0.91014238, ..., 3.34479762,
-0.92318311, 0.89146544],
[-1.40722105, -0.91014238, 0. , ..., 2.43465524,
-1.83332549, -0.01867693],
...
[-4.94932227, -3.71475318, -0.91564756, ..., 0. ,
-1.2624233 , -4.83051798],
[-3.68689897, -2.45232988, 0.34677575, ..., 1.2624233 ,
0. , -3.56809468],
[-0.11880429, 1.1157648 , 3.91487043, ..., 4.83051798,
3.56809468, 0. ]],
[[ 0. , -1.75077037, 4.92600887, ..., 0.73859023,
-2.25376884, -0.43195136],
[ 1.75077037, 0. , 6.67677924, ..., 2.48936059,
-0.50299847, 1.31881901],
[-4.92600887, -6.67677924, 0. , ..., -4.18741865,
-7.17977771, -5.35796023],
...,
[-0.73859023, -2.48936059, 4.18741865, ..., 0. ,
-2.99235907, -1.17054159],
[ 2.25376884, 0.50299847, 7.17977771, ..., 2.99235907,
0. , 1.82181748],
[ 0.43195136, -1.31881901, 5.35796023, ..., 1.17054159,
-1.82181748, 0. ]]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school_bis')) - Attributes: (0)
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- predictions
<xarray.Dataset> Size: 36kB
Dimensions: (chain: 4, draw: 500, new_school: 2)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- new_school (new_school) <U13 104B 'Essex College' 'Moordale'
Data variables:
obs (chain, draw, new_school) float64 32kB 2.041 -2.556 ... -0.2822
Attributes: (2)- Dimensions:
* chain: 4
* draw: 500
* new_school: 2 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* new_school
(new_school)
<U13
'Essex College' 'Moordale'
array(['Essex College', 'Moordale'], dtype='<U13') - Data variables: (1)
* obs
(chain, draw, new_school)
float64
2.041 -2.556 ... -1.015 -0.2822
array([[[ 2.04091912, -2.55566503],
[ 0.41809885, -0.56776961],
[-0.45264929, -0.21559716],
...,
[-0.80265585, 0.40858787],
[ 0.89066617, 0.91324226],
[ 0.30152948, -2.85103878]],
[[-1.02941822, 0.81504467],
[-0.86725243, -1.00340203],
[-2.30495532, 1.26656886],
...,
[-1.40028095, 1.9391935 ],
[-0.37582993, -0.76872586],
[ 0.11466401, -0.89829659]],
[[ 0.02963037, -0.96028439],
[ 0.56533507, 0.05565896],
[-1.36828642, 1.0376982 ],
...,
[ 0.23222422, 0.36513287],
[ 0.31840946, -0.56685801],
[ 2.39826354, 0.91078977]],
[[-1.42283401, -0.74058959],
[ 0.83390251, 0.53293412],
[ 0.13188271, -0.03434879],
...,
[ 1.57846099, 0.24653314],
[ 0.64302486, 1.42710376],
[-1.01529472, -0.28215614]]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Essex College', 'Moordale'], dtype='object', name='new_school')) - Attributes: (2)
created_at :
2024-09-28T19:22:37.147191+00:00
arviz_version :
0.20.0
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 246kB
Dimensions: (chain: 4, draw: 500)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 16kB ...
energy_error (chain, draw) float64 16kB ...
lp (chain, draw) float64 16kB ...
index_in_trajectory (chain, draw) int64 16kB ...
acceptance_rate (chain, draw) float64 16kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 16kB ...
step_size_bar (chain, draw) float64 16kB ...
step_size (chain, draw) float64 16kB ...
energy (chain, draw) float64 16kB ...
tree_depth (chain, draw) int64 16kB ...
perf_counter_diff (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[2000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[2000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[2000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[2000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[2000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[2000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[2000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[2000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[2000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (draw: 500, school: 8)
Coordinates:- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (draw) float64 4kB 1.941 3.388 4.208 5.687 ... 0.8353 0.06893 2.145
theta (draw, school) float64 32kB 4.866 4.59 -0.7404 ... -2.031 6.045
mu (draw) float64 4kB 3.903 3.915 -1.751 2.595 ... -2.294 0.7908 2.869- Dimensions:
* draw: 500
* school: 8 - Coordinates: (2)
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(draw)
float64
1.941 3.388 4.208 ... 0.06893 2.145
array([1.94060202e+00, 3.38786056e+00, 4.20819481e+00, 5.68742111e+00,
4.82244460e+00, 7.84969782e+00, 2.41850082e+00, 1.11683428e+00,
5.10984626e-01, 1.67640274e+00, 8.37550751e+00, 3.55750200e+01,
1.87888479e+01, 7.38007966e+01, 7.19904857e+00, 2.97111678e+00,
2.38009906e+00, 8.61688371e-01, 1.82005508e+00, 7.05099843e-01,
3.73935694e+00, 8.73489254e+00, 1.39668221e+00, 2.17078500e+01,
9.59674138e+00, 3.15703268e+00, 3.33847615e+00, 3.51144898e+01,
6.80634203e+00, 4.11871168e+00, 4.93255227e+00, 4.83826812e+00,
2.72760625e+01, 5.24910941e+00, 2.85667668e+00, 4.28176247e+00,
2.28124585e+01, 1.34945279e+01, 9.68820812e+00, 1.07728226e+01,
1.20481030e+02, 3.31906378e-01, 4.63523234e-01, 1.26739022e+00,
2.51130780e+03, 5.07713155e+00, 9.28824918e-01, 9.14991935e+00,
4.66414362e+01, 8.84758086e+01, 3.00341165e-01, 7.30464820e-01,
3.40976947e+01, 2.99629266e+01, 2.26765592e+00, 1.78358355e+01,
3.30808448e+01, 3.88184972e+00, 8.84199075e-01, 1.51343747e+01,
2.65672354e+00, 1.31077618e+00, 2.25382327e+01, 1.22813964e+02,
7.85565515e+00, 7.41863308e-01, 9.49848204e+00, 1.41059847e+02,
9.25655368e-01, 1.78766382e+00, 2.62553715e+00, 8.58588175e-01,
1.74600321e+01, 4.62398480e+00, 1.01280222e+00, 5.74512287e+00,
1.26181092e+01, 4.56117182e+00, 1.03129481e+01, 1.05807520e+02,
...
4.44939392e+00, 6.07065997e+01, 3.09150476e+00, 1.07895462e+00,
3.40577271e+01, 8.87566932e+03, 5.14275783e-01, 2.34873432e+00,
4.28166200e+00, 6.11436072e+00, 7.02201974e+00, 9.11145054e-02,
5.06762347e+00, 5.54001194e+00, 1.65166669e+00, 4.62314520e+00,
2.79342562e+01, 8.20769981e+00, 1.34952820e+01, 8.67771773e-01,
2.67941929e+00, 5.78094132e+00, 4.08853487e+01, 1.21540351e+01,
6.21499874e+00, 2.05937430e+01, 5.18603595e+00, 5.93430042e+00,
1.27090430e+01, 9.37798481e+00, 3.80986538e+00, 1.14897162e+03,
6.66454695e+01, 1.68318555e+01, 6.50185117e+01, 1.77443210e+00,
1.98821067e+01, 1.48732781e+00, 5.32400098e+01, 8.90298404e-01,
9.74456150e+00, 3.17898046e+00, 4.64437308e+00, 1.67900077e+00,
2.11625865e+00, 5.88562332e-01, 8.72761717e+00, 3.23788264e+01,
2.62725682e+00, 2.48389110e+00, 5.78998327e+00, 4.86828624e+00,
8.96244600e+00, 9.85486905e-01, 4.35475195e+00, 8.21724160e+00,
3.67358130e+00, 3.19700555e-01, 4.32539022e+00, 7.87027890e-01,
2.16835786e+00, 3.34426424e+00, 1.67688831e+01, 9.15246738e-01,
5.68705452e+00, 4.86622906e+00, 2.32790878e+00, 3.16238422e+01,
8.20289530e+00, 1.59128252e+03, 1.70394780e+00, 2.42565587e+00,
7.62767038e+00, 2.41576900e+01, 4.25452773e+01, 1.21193875e+00,
1.02716549e+01, 8.35319808e-01, 6.89347686e-02, 2.14488132e+00])
* theta
(draw, school)
float64
4.866 4.59 -0.7404 ... -2.031 6.045
array([[ 4.86620856, 4.58956728, -0.74044057, ..., 3.9610381 ,
2.65493249, 6.01863257],
[ 4.37914099, 5.96929909, -2.97367789, ..., 11.03055872,
5.05284821, 2.67610001],
[-1.19602373, -9.83468642, 2.28396607, ..., -1.73761977,
8.42950283, 2.36634401],
...,
[-2.81086618, -3.98468829, -2.08099901, ..., -2.53012815,
-2.05930505, -3.19172734],
[ 0.81207434, 0.79427128, 0.83181532, ..., 0.79266084,
0.86104331, 0.7793056 ],
[ 3.57736989, 3.53795807, 5.30449351, ..., 3.3301618 ,
-2.03071509, 6.04538653]])
* mu
(draw)
float64
3.903 3.915 -1.751 ... 0.7908 2.869
array([ 3.90253102e+00, 3.91500660e+00, -1.75114302e+00, 2.59485538e+00,
-4.44296321e-01, 7.61000307e+00, -1.04548271e+01, -6.00723208e+00,
-2.99616365e+00, 4.75484334e+00, -7.53597289e-01, -4.49206911e+00,
1.22966674e+00, -1.17350445e+00, -1.14598007e+00, -1.10634181e+01,
6.31763132e+00, 1.73772124e+00, -4.91208423e-01, -2.75385285e+00,
-3.41248265e+00, 1.42264349e+00, 4.11819735e-01, 1.73585996e-01,
-5.07312782e+00, -9.99257696e+00, -6.56537987e+00, -6.24410186e+00,
1.30989418e+00, 1.92730225e+00, 9.19697020e+00, 8.53506427e+00,
3.39755738e+00, -4.93707846e+00, -7.33345648e+00, 2.98252256e+00,
-3.18159106e-01, 2.27959142e+00, -4.62958545e+00, -9.70160468e-02,
-1.60798088e+00, -6.00729427e+00, 8.37985516e+00, 9.52705402e-01,
1.47243794e+00, -4.65377145e+00, 7.28348474e-01, -3.06384730e+00,
-6.15183994e+00, -1.41063529e+00, 5.31880456e+00, 4.28382637e-01,
-8.23432363e+00, 1.22762109e+00, -8.29777595e-01, 4.21780345e+00,
5.62271511e-01, -1.17786709e+00, 8.09037873e+00, -6.71477871e-01,
-6.73172600e+00, -7.64168460e-01, -9.25141462e-02, -1.39886914e+00,
3.37072301e+00, 6.22566150e+00, 6.39989161e+00, -7.42547579e+00,
8.30312575e+00, -1.07413010e+00, -1.79272549e+00, 1.01766431e+01,
-2.62649315e+00, -6.23298070e+00, -3.11080725e+00, 4.74329549e+00,
-5.28479613e+00, 3.33562049e+00, -2.64374091e+00, -5.36198855e+00,
...
4.71858610e+00, -2.38511285e+00, 6.85363619e-01, 7.86083664e+00,
8.58371336e-01, -1.22509704e+00, -2.96950232e+00, 5.94273132e+00,
-2.96290955e+00, 5.30842670e+00, -2.93315882e+00, 2.00138807e+00,
-5.38929306e+00, -3.79404004e+00, 9.41113416e+00, -4.29479242e+00,
-4.87319690e+00, -1.32639504e+00, -4.40725483e+00, 2.48578744e+00,
-2.74719435e+00, 4.19794394e+00, 3.37369715e+00, 4.68554077e+00,
2.98601993e+00, -9.56558363e+00, -4.80824536e-01, 2.32683687e+00,
1.84240293e+00, 4.31505480e+00, 1.78131745e+00, 4.74830962e+00,
-2.51044292e-01, -6.19005739e+00, -6.80007397e+00, 5.41635224e-01,
2.53050533e+00, -1.22188016e+00, 5.05691442e+00, 2.03910664e+00,
-5.22800335e-02, -1.12511498e+00, 6.59945576e+00, -3.58516561e+00,
7.22804145e+00, 4.59556418e+00, -4.82300404e+00, 4.70726322e+00,
-3.32578499e+00, 3.15320672e+00, 1.14604995e+01, -4.35587322e+00,
7.06014478e+00, 2.34213481e+00, -1.31820085e+00, 3.72632528e+00,
-9.31774491e-01, -5.03118301e+00, 2.59806644e+00, -2.02997029e+00,
-7.30940496e+00, -2.53759146e+00, -3.66411956e+00, 9.38270535e+00,
3.79591101e+00, -5.59892859e-01, 1.18231368e+01, 1.26943270e+01,
5.77152605e+00, -7.33882918e+00, 2.08163637e+00, -4.50230861e+00,
-1.39653308e-01, -1.04822114e-01, 2.08910055e+00, -6.44041200e+00,
-6.60626614e-01, -2.29356629e+00, 7.90828077e-01, 2.86879752e+00]) - Indexes: (2)
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (0)
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
You can also pass a lambda function in map
.
idata_shifted_obs = idata.map(lambda x: x + 3, groups="posterior") idata_shifted_obs
- posterior
<xarray.Dataset> Size: 1MB
Dimensions: (chain: 4, draw: 500, school: 8, school_bis: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- school_bis (school_bis) <U16 512B 'Choate' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 16kB 10.87 6.385 ... 6.486 6.404
theta (chain, draw, school) float64 128kB 15.32 12.91 ... 4.295
tau (chain, draw) float64 16kB 7.726 6.909 ... 5.932 7.461
log_tau (chain, draw) float64 16kB 4.553 4.363 ... 4.076 4.495
mlogtau (chain, draw) float64 16kB nan nan nan ... 4.496 4.511
theta_school_diff (chain, draw, school, school_bis) float64 1MB 3.0 ... 3.0
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500
* school: 8
* school_bis: 8 - Coordinates: (4)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* school_bis
(school_bis)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (6)
* mu
(chain, draw)
float64
10.87 6.385 12.1 ... 6.486 6.404
array([[10.87179637, 6.38455431, 12.10047569, ..., 6.65680422,
8.42727938, 5.73588293],
[ 7.31581657, 7.59770112, 9.21376164, ..., 7.84102392,
8.94610513, 7.66643827],
[ 7.52760336, 8.86262758, 8.91070276, ..., 5.87106698,
7.09553646, 4.77571755],
[10.17950438, 9.53969896, 10.48361981, ..., 4.76673325,
6.48611194, 6.40446391]])
* theta
(chain, draw, school)
float64
15.32 12.91 17.95 ... 9.762 4.295
array([[[15.32068558, 12.90536689, 17.9516155 , ..., 19.90179529,
16.19805933, 18.06136584],
[14.28562322, 12.12932369, 6.13926327, ..., 5.39308809,
13.05522282, 9.17672421],
[ 8.70850575, 8.7579324 , 13.94458539, ..., 11.14332707,
10.60475341, 11.76764689],
...,
[ 2.78617189, 4.35515489, 9.98268796, ..., 9.96589044,
7.93020022, 6.05860034],
[13.40250133, 9.90740688, -1.96413775, ..., 0.16495931,
8.3910607 , 9.38123908],
[ 9.66130764, 10.41376703, -6.32260183, ..., -1.25487418,
10.56657019, 12.98761823]],
[[ 8.59663866, 9.95960523, 6.2412923 , ..., 8.5731038 ,
10.14885429, 6.79090016],
[ 7.96540992, 4.77935809, 9.82078866, ..., 7.63345858,
6.28916128, 8.93731077],
[ 8.89670043, 12.47253003, 8.29354995, ..., 8.65256064,
6.30221324, 10.16213323],
...
[ 7.71860289, 9.3386488 , 10.67278512, ..., 4.85496043,
10.29157333, 2.89973545],
[ 8.67765139, 4.67910823, 5.97637036, ..., 4.61054881,
4.28061498, 10.62765755],
[ 4.62544668, 5.50328085, 3.77298319, ..., 4.47752619,
5.36275624, 0.03200582]],
[[11.34450834, 8.39085524, 7.71615276, ..., 10.87559218,
15.46813994, 15.60779651],
[11.93115045, 9.85296853, 13.07129962, ..., 3.11111666,
10.01397138, 8.13629724],
[12.62317435, 8.10464403, 7.99209455, ..., 14.45121967,
12.45569534, 11.85937825],
...,
[ 6.53251469, 5.00890089, 3.51080602, ..., 7.70724881,
6.07331446, 0.37693108],
[ 7.1827505 , 10.55425055, 7.45603444, ..., 4.5289581 ,
4.09609826, 11.45228161],
[ 3.19295578, 9.4984278 , 2.10557598, ..., 10.93646013,
9.76245459, 4.2950506 ]]])
* tau
(chain, draw)
float64
7.726 6.909 7.844 ... 5.932 7.461
array([[7.72574006, 6.90899361, 7.8440252 , ..., 4.89383828, 8.92006245,
7.32589567],
[4.97083011, 5.04902913, 5.12376496, ..., 5.17459002, 4.32755081,
4.21199466],
[6.50127689, 5.89324317, 7.27328591, ..., 7.08978031, 5.72016996,
4.91701121],
[9.07325982, 6.77186702, 6.17053747, ..., 5.74060666, 5.93237926,
7.46124596]])
* log_tau
(chain, draw)
float64
4.553 4.363 4.578 ... 4.076 4.495
array([[4.55302418, 4.36327995, 4.57774603, ..., 3.6386056 , 4.778347 ,
4.46461921],
[3.67845483, 3.71736608, 3.75319044, ..., 3.77684015, 3.28333575,
3.19226749],
[4.25312773, 4.06237808, 4.45238307, ..., 4.40849125, 4.00069436,
3.65076731],
[4.8038955 , 4.32757011, 4.15390112, ..., 4.00817931, 4.07581413,
4.49542809]])
* mlogtau
(chain, draw)
float64
nan nan nan ... 4.494 4.496 4.511
array([[ nan, nan, nan, ..., 4.16476321, 4.19559572,
4.22597193],
[ nan, nan, nan, ..., 3.12348971, 3.131342 ,
3.13737294],
[ nan, nan, nan, ..., 4.22653292, 4.21500516,
4.20868681],
[ nan, nan, nan, ..., 4.4938526 , 4.49647017,
4.5112594 ]])
* theta_school_diff
(chain, draw, school, school_bis)
float64
3.0 5.415 0.3691 ... -2.467 3.0
array([[[[ 3.00000000e+00, 5.41531869e+00, 3.69070082e-01, ...,
-1.58110972e+00, 2.12262624e+00, 2.59319742e-01],
[ 5.84681314e-01, 3.00000000e+00, -2.04624860e+00, ...,
-3.99642840e+00, -2.92692441e-01, -2.15599894e+00],
[ 5.63092992e+00, 8.04624860e+00, 3.00000000e+00, ...,
1.04982020e+00, 4.75355616e+00, 2.89024966e+00],
...,
[ 7.58110972e+00, 9.99642840e+00, 4.95017980e+00, ...,
3.00000000e+00, 6.70373596e+00, 4.84042946e+00],
[ 3.87737376e+00, 6.29269244e+00, 1.24644384e+00, ...,
-7.03735961e-01, 3.00000000e+00, 1.13669350e+00],
[ 5.74068026e+00, 8.15599894e+00, 3.10975034e+00, ...,
1.15957054e+00, 4.86330650e+00, 3.00000000e+00]],
[[ 3.00000000e+00, 5.15629954e+00, 1.11463600e+01, ...,
1.18925351e+01, 4.23040040e+00, 8.10889901e+00],
[ 8.43700462e-01, 3.00000000e+00, 8.99006042e+00, ...,
9.73623560e+00, 2.07410086e+00, 5.95259947e+00],
[-5.14635996e+00, -2.99006042e+00, 3.00000000e+00, ...,
3.74617518e+00, -3.91595956e+00, -3.74609480e-02],
...
[ 3.46207603e-01, -3.02529245e+00, 7.29236668e-02, ...,
3.00000000e+00, 3.43285984e+00, -3.92332351e+00],
[-8.66522389e-02, -3.45815229e+00, -3.59936175e-01, ...,
2.56714016e+00, 3.00000000e+00, -4.35618335e+00],
[ 7.26953111e+00, 3.89803106e+00, 6.99624717e+00, ...,
9.92332351e+00, 1.03561833e+01, 3.00000000e+00]],
[[ 3.00000000e+00, -3.30547202e+00, 4.08737981e+00, ...,
-4.74350435e+00, -3.56949881e+00, 1.89790518e+00],
[ 9.30547202e+00, 3.00000000e+00, 1.03928518e+01, ...,
1.56196766e+00, 2.73597321e+00, 8.20337720e+00],
[ 1.91262019e+00, -4.39285182e+00, 3.00000000e+00, ...,
-5.83088416e+00, -4.65687862e+00, 8.10525376e-01],
...,
[ 1.07435044e+01, 4.43803234e+00, 1.18308842e+01, ...,
3.00000000e+00, 4.17400554e+00, 9.64140953e+00],
[ 9.56949881e+00, 3.26402679e+00, 1.06568786e+01, ...,
1.82599446e+00, 3.00000000e+00, 8.46740399e+00],
[ 4.10209482e+00, -2.20337720e+00, 5.18947462e+00, ...,
-3.64140953e+00, -2.46740399e+00, 3.00000000e+00]]]]) - Indexes: (4)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school_bis')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- predictions
<xarray.Dataset> Size: 36kB
Dimensions: (chain: 4, draw: 500, new_school: 2)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- new_school (new_school) <U13 104B 'Essex College' 'Moordale'
Data variables:
obs (chain, draw, new_school) float64 32kB 2.041 -2.556 ... -0.2822
Attributes: (2)- Dimensions:
* chain: 4
* draw: 500
* new_school: 2 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* new_school
(new_school)
<U13
'Essex College' 'Moordale'
array(['Essex College', 'Moordale'], dtype='<U13') - Data variables: (1)
* obs
(chain, draw, new_school)
float64
2.041 -2.556 ... -1.015 -0.2822
array([[[ 2.04091912, -2.55566503],
[ 0.41809885, -0.56776961],
[-0.45264929, -0.21559716],
...,
[-0.80265585, 0.40858787],
[ 0.89066617, 0.91324226],
[ 0.30152948, -2.85103878]],
[[-1.02941822, 0.81504467],
[-0.86725243, -1.00340203],
[-2.30495532, 1.26656886],
...,
[-1.40028095, 1.9391935 ],
[-0.37582993, -0.76872586],
[ 0.11466401, -0.89829659]],
[[ 0.02963037, -0.96028439],
[ 0.56533507, 0.05565896],
[-1.36828642, 1.0376982 ],
...,
[ 0.23222422, 0.36513287],
[ 0.31840946, -0.56685801],
[ 2.39826354, 0.91078977]],
[[-1.42283401, -0.74058959],
[ 0.83390251, 0.53293412],
[ 0.13188271, -0.03434879],
...,
[ 1.57846099, 0.24653314],
[ 0.64302486, 1.42710376],
[-1.01529472, -0.28215614]]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Essex College', 'Moordale'], dtype='object', name='new_school')) - Attributes: (2)
created_at :
2024-09-28T19:22:37.147191+00:00
arviz_version :
0.20.0
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 246kB
Dimensions: (chain: 4, draw: 500)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 16kB ...
energy_error (chain, draw) float64 16kB ...
lp (chain, draw) float64 16kB ...
index_in_trajectory (chain, draw) int64 16kB ...
acceptance_rate (chain, draw) float64 16kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 16kB ...
step_size_bar (chain, draw) float64 16kB ...
step_size (chain, draw) float64 16kB ...
energy (chain, draw) float64 16kB ...
tree_depth (chain, draw) int64 16kB ...
perf_counter_diff (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[2000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[2000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[2000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[2000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[2000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[2000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[2000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[2000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[2000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 4kB 1.941 3.388 4.208 ... 0.06893 2.145
theta (chain, draw, school) float64 32kB 4.866 4.59 ... -2.031 6.045
mu (chain, draw) float64 4kB 3.903 3.915 -1.751 ... 0.7908 2.869
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
1.941 3.388 4.208 ... 0.06893 2.145
array([[1.940602, 3.387861, 4.208195, ..., 0.83532 , 0.068935, 2.144881]])
* theta
(chain, draw, school)
float64
4.866 4.59 -0.7404 ... -2.031 6.045
array([[[ 4.866209, 4.589567, ..., 2.654932, 6.018633],
[ 4.379141, 5.969299, ..., 5.052848, 2.6761 ],
...,
[ 0.812074, 0.794271, ..., 0.861043, 0.779306],
[ 3.57737 , 3.537958, ..., -2.030715, 6.045387]]])
* mu
(chain, draw)
float64
3.903 3.915 -1.751 ... 0.7908 2.869
array([[ 3.902531, 3.915007, -1.751143, ..., -2.293566, 0.790828, 2.868798]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
You can also add extra coordinates using map
.
_upper = np.array([ x.upper() for x in idata.observed_data.school.values ]).T idata_with_upper = idata.map( lambda ds, **kwargs: ds.assign_coords(**kwargs), groups="observed_vars", upper=("Upper", _upper), ) idata_with_upper
- posterior
<xarray.Dataset> Size: 1MB
Dimensions: (chain: 4, draw: 500, school: 8, school_bis: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- school_bis (school_bis) <U16 512B 'Choate' ... 'Mt. Hermon'
Data variables:
mu (chain, draw) float64 16kB 7.872 3.385 ... 3.486 3.404
theta (chain, draw, school) float64 128kB 12.32 9.905 ... 1.295
tau (chain, draw) float64 16kB 4.726 3.909 ... 2.932 4.461
log_tau (chain, draw) float64 16kB 1.553 1.363 ... 1.076 1.495
mlogtau (chain, draw) float64 16kB nan nan nan ... 1.496 1.511
theta_school_diff (chain, draw, school, school_bis) float64 1MB 0.0 ... 0.0
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500
* school: 8
* school_bis: 8 - Coordinates: (4)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* school_bis
(school_bis)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (6)
* mu
(chain, draw)
float64
7.872 3.385 9.1 ... 3.486 3.404
array([[7.871796, 3.384554, 9.100476, ..., 3.656804, 5.427279, 2.735883],
[4.315817, 4.597701, 6.213762, ..., 4.841024, 5.946105, 4.666438],
[4.527603, 5.862628, 5.910703, ..., 2.871067, 4.095536, 1.775718],
[7.179504, 6.539699, 7.48362 , ..., 1.766733, 3.486112, 3.404464]])
* theta
(chain, draw, school)
float64
12.32 9.905 14.95 ... 6.762 1.295
array([[[12.320686, 9.905367, ..., 13.198059, 15.061366],
[11.285623, 9.129324, ..., 10.055223, 6.176724],
...,
[10.402501, 6.907407, ..., 5.391061, 6.381239],
[ 6.661308, 7.413767, ..., 7.56657 , 9.987618]],
[[ 5.596639, 6.959605, ..., 7.148854, 3.7909 ],
[ 4.96541 , 1.779358, ..., 3.289161, 5.937311],
...,
[ 7.030604, 6.214465, ..., 4.778138, 4.357112],
[ 4.884931, 3.952247, ..., 5.687935, 6.777772]],
[[11.81417 , -0.040477, ..., 0.318087, 0.661304],
[ 4.743465, 10.175684, ..., 11.271711, 7.12114 ],
...,
[ 5.677651, 1.679108, ..., 1.280615, 7.627658],
[ 1.625447, 2.503281, ..., 2.362756, -2.967994]],
[[ 8.344508, 5.390855, ..., 12.46814 , 12.607797],
[ 8.93115 , 6.852969, ..., 7.013971, 5.136297],
...,
[ 4.182751, 7.554251, ..., 1.096098, 8.452282],
[ 0.192956, 6.498428, ..., 6.762455, 1.295051]]])
* tau
(chain, draw)
float64
4.726 3.909 4.844 ... 2.932 4.461
array([[4.72574 , 3.908994, 4.844025, ..., 1.893838, 5.920062, 4.325896],
[1.97083 , 2.049029, 2.123765, ..., 2.17459 , 1.327551, 1.211995],
[3.501277, 2.893243, 4.273286, ..., 4.08978 , 2.72017 , 1.917011],
[6.07326 , 3.771867, 3.170537, ..., 2.740607, 2.932379, 4.461246]])
* log_tau
(chain, draw)
float64
1.553 1.363 1.578 ... 1.076 1.495
array([[1.55302418, 1.36327995, 1.57774603, ..., 0.6386056 , 1.778347 ,
1.46461921],
[0.67845483, 0.71736608, 0.75319044, ..., 0.77684015, 0.28333575,
0.19226749],
[1.25312773, 1.06237808, 1.45238307, ..., 1.40849125, 1.00069436,
0.65076731],
[1.8038955 , 1.32757011, 1.15390112, ..., 1.00817931, 1.07581413,
1.49542809]])
* mlogtau
(chain, draw)
float64
nan nan nan ... 1.494 1.496 1.511
array([[ nan, nan, nan, ..., 1.16476321, 1.19559572,
1.22597193],
[ nan, nan, nan, ..., 0.12348971, 0.131342 ,
0.13737294],
[ nan, nan, nan, ..., 1.22653292, 1.21500516,
1.20868681],
[ nan, nan, nan, ..., 1.4938526 , 1.49647017,
1.5112594 ]])
* theta_school_diff
(chain, draw, school, school_bis)
float64
0.0 2.415 -2.631 ... -5.467 0.0
array([[[[ 0.00000000e+00, 2.41531869e+00, -2.63092992e+00, ...,
-4.58110972e+00, -8.77373755e-01, -2.74068026e+00],
[-2.41531869e+00, 0.00000000e+00, -5.04624860e+00, ...,
-6.99642840e+00, -3.29269244e+00, -5.15599894e+00],
[ 2.63092992e+00, 5.04624860e+00, 0.00000000e+00, ...,
-1.95017980e+00, 1.75355616e+00, -1.09750340e-01],
...,
[ 4.58110972e+00, 6.99642840e+00, 1.95017980e+00, ...,
0.00000000e+00, 3.70373596e+00, 1.84042946e+00],
[ 8.77373755e-01, 3.29269244e+00, -1.75355616e+00, ...,
-3.70373596e+00, 0.00000000e+00, -1.86330650e+00],
[ 2.74068026e+00, 5.15599894e+00, 1.09750340e-01, ...,
-1.84042946e+00, 1.86330650e+00, 0.00000000e+00]],
[[ 0.00000000e+00, 2.15629954e+00, 8.14635996e+00, ...,
8.89253514e+00, 1.23040040e+00, 5.10889901e+00],
[-2.15629954e+00, 0.00000000e+00, 5.99006042e+00, ...,
6.73623560e+00, -9.25899137e-01, 2.95259947e+00],
[-8.14635996e+00, -5.99006042e+00, 0.00000000e+00, ...,
7.46175179e-01, -6.91595956e+00, -3.03746095e+00],
...
[-2.65379240e+00, -6.02529245e+00, -2.92707633e+00, ...,
0.00000000e+00, 4.32859842e-01, -6.92332351e+00],
[-3.08665224e+00, -6.45815229e+00, -3.35993618e+00, ...,
-4.32859842e-01, 0.00000000e+00, -7.35618335e+00],
[ 4.26953111e+00, 8.98031057e-01, 3.99624717e+00, ...,
6.92332351e+00, 7.35618335e+00, 0.00000000e+00]],
[[ 0.00000000e+00, -6.30547202e+00, 1.08737981e+00, ...,
-7.74350435e+00, -6.56949881e+00, -1.10209482e+00],
[ 6.30547202e+00, 0.00000000e+00, 7.39285182e+00, ...,
-1.43803234e+00, -2.64026792e-01, 5.20337720e+00],
[-1.08737981e+00, -7.39285182e+00, 0.00000000e+00, ...,
-8.83088416e+00, -7.65687862e+00, -2.18947462e+00],
...,
[ 7.74350435e+00, 1.43803234e+00, 8.83088416e+00, ...,
0.00000000e+00, 1.17400554e+00, 6.64140953e+00],
[ 6.56949881e+00, 2.64026792e-01, 7.65687862e+00, ...,
-1.17400554e+00, 0.00000000e+00, 5.46740399e+00],
[ 1.10209482e+00, -5.20337720e+00, 2.18947462e+00, ...,
-6.64140953e+00, -5.46740399e+00, 0.00000000e+00]]]]) - Indexes: (4)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school'))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school_bis')) - Attributes: (6)
created_at :
2022-10-13T14:37:37.315398
arviz_version :
0.13.0.dev0
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- posterior_predictive
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8, Upper: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
upper (Upper) <U16 512B 'CHOATE' 'DEERFIELD' ... 'MT. HERMON'
Dimensions without coordinates: Upper
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8
* Upper: 8 - Coordinates: (4)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* upper
(Upper)
<U16
'CHOATE' ... 'MT. HERMON'
array(['CHOATE', 'DEERFIELD', 'PHILLIPS ANDOVER', 'PHILLIPS EXETER',
'HOTCHKISS', 'LAWRENCEVILLE', "ST. PAUL'S", 'MT. HERMON'],
dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:41.460544
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- predictions
<xarray.Dataset> Size: 36kB
Dimensions: (chain: 4, draw: 500, new_school: 2)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- new_school (new_school) <U13 104B 'Essex College' 'Moordale'
Data variables:
obs (chain, draw, new_school) float64 32kB 2.041 -2.556 ... -0.2822
Attributes: (2)- Dimensions:
* chain: 4
* draw: 500
* new_school: 2 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* new_school
(new_school)
<U13
'Essex College' 'Moordale'
array(['Essex College', 'Moordale'], dtype='<U13') - Data variables: (1)
* obs
(chain, draw, new_school)
float64
2.041 -2.556 ... -1.015 -0.2822
array([[[ 2.04091912, -2.55566503],
[ 0.41809885, -0.56776961],
[-0.45264929, -0.21559716],
...,
[-0.80265585, 0.40858787],
[ 0.89066617, 0.91324226],
[ 0.30152948, -2.85103878]],
[[-1.02941822, 0.81504467],
[-0.86725243, -1.00340203],
[-2.30495532, 1.26656886],
...,
[-1.40028095, 1.9391935 ],
[-0.37582993, -0.76872586],
[ 0.11466401, -0.89829659]],
[[ 0.02963037, -0.96028439],
[ 0.56533507, 0.05565896],
[-1.36828642, 1.0376982 ],
...,
[ 0.23222422, 0.36513287],
[ 0.31840946, -0.56685801],
[ 2.39826354, 0.91078977]],
[[-1.42283401, -0.74058959],
[ 0.83390251, 0.53293412],
[ 0.13188271, -0.03434879],
...,
[ 1.57846099, 0.24653314],
[ 0.64302486, 1.42710376],
[-1.01529472, -0.28215614]]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Essex College', 'Moordale'], dtype='object', name='new_school')) - Attributes: (2)
created_at :
2024-09-28T19:22:37.147191+00:00
arviz_version :
0.20.0
- Dimensions:
- log_likelihood
<xarray.Dataset> Size: 133kB
Dimensions: (chain: 4, draw: 500, school: 8)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
obs (chain, draw, school) float64 128kB ...
Attributes: (4)- Dimensions:
* chain: 4
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[16000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.487399
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- sample_stats
<xarray.Dataset> Size: 246kB
Dimensions: (chain: 4, draw: 500)
Coordinates:- chain (chain) int64 32B 0 1 2 3
- draw (draw) int64 4kB 0 1 2 3 4 5 ... 495 496 497 498 499
Data variables: (12/16)
max_energy_error (chain, draw) float64 16kB ...
energy_error (chain, draw) float64 16kB ...
lp (chain, draw) float64 16kB ...
index_in_trajectory (chain, draw) int64 16kB ...
acceptance_rate (chain, draw) float64 16kB ...
diverging (chain, draw) bool 2kB ...
... ...
smallest_eigval (chain, draw) float64 16kB ...
step_size_bar (chain, draw) float64 16kB ...
step_size (chain, draw) float64 16kB ...
energy (chain, draw) float64 16kB ...
tree_depth (chain, draw) int64 16kB ...
perf_counter_diff (chain, draw) float64 16kB ...
Attributes: (6)- Dimensions:
* chain: 4
* draw: 500 - Coordinates: (2)
* chain
(chain)
int64
0 1 2 3
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499]) - Data variables: (16)
* max_energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy_error
(chain, draw)
float64
...
[2000 values with dtype=float64]
* lp
(chain, draw)
float64
...
[2000 values with dtype=float64]
* index_in_trajectory
(chain, draw)
int64
...
[2000 values with dtype=int64]
* acceptance_rate
(chain, draw)
float64
...
[2000 values with dtype=float64]
* diverging
(chain, draw)
bool
...
[2000 values with dtype=bool]
* process_time_diff
(chain, draw)
float64
...
[2000 values with dtype=float64]
* n_steps
(chain, draw)
float64
...
[2000 values with dtype=float64]
* perf_counter_start
(chain, draw)
float64
...
[2000 values with dtype=float64]
* largest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* smallest_eigval
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size_bar
(chain, draw)
float64
...
[2000 values with dtype=float64]
* step_size
(chain, draw)
float64
...
[2000 values with dtype=float64]
* energy
(chain, draw)
float64
...
[2000 values with dtype=float64]
* tree_depth
(chain, draw)
int64
...
[2000 values with dtype=int64]
* perf_counter_diff
(chain, draw)
float64
...
[2000 values with dtype=float64] - Indexes: (2)
* PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500)) - Attributes: (6)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:37.324929
inference_library :
pymc
inference_library_version :
4.2.2
sampling_time :
7.480114936828613
tuning_steps :
1000
- Dimensions:
- prior
<xarray.Dataset> Size: 45kB
Dimensions: (chain: 1, draw: 500, school: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
tau (chain, draw) float64 4kB 1.941 3.388 4.208 ... 0.06893 2.145
theta (chain, draw, school) float64 32kB 4.866 4.59 ... -2.031 6.045
mu (chain, draw) float64 4kB 3.903 3.915 -1.751 ... 0.7908 2.869
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8 - Coordinates: (3)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (3)
* tau
(chain, draw)
float64
1.941 3.388 4.208 ... 0.06893 2.145
array([[1.940602, 3.387861, 4.208195, ..., 0.83532 , 0.068935, 2.144881]])
* theta
(chain, draw, school)
float64
4.866 4.59 -0.7404 ... -2.031 6.045
array([[[ 4.866209, 4.589567, ..., 2.654932, 6.018633],
[ 4.379141, 5.969299, ..., 5.052848, 2.6761 ],
...,
[ 0.812074, 0.794271, ..., 0.861043, 0.779306],
[ 3.57737 , 3.537958, ..., -2.030715, 6.045387]]])
* mu
(chain, draw)
float64
3.903 3.915 -1.751 ... 0.7908 2.869
array([[ 3.902531, 3.915007, -1.751143, ..., -2.293566, 0.790828, 2.868798]]) - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.602116
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- prior_predictive
<xarray.Dataset> Size: 37kB
Dimensions: (chain: 1, draw: 500, school: 8, Upper: 8)
Coordinates:- chain (chain) int64 8B 0
- draw (draw) int64 4kB 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
upper (Upper) <U16 512B 'CHOATE' 'DEERFIELD' ... 'MT. HERMON'
Dimensions without coordinates: Upper
Data variables:
obs (chain, draw, school) float64 32kB ...
Attributes: (4)- Dimensions:
* chain: 1
* draw: 500
* school: 8
* Upper: 8 - Coordinates: (4)
* chain
(chain)
int64
0
* draw
(draw)
int64
0 1 2 3 4 5 ... 495 496 497 498 499
array([ 0, 1, 2, ..., 497, 498, 499])
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* upper
(Upper)
<U16
'CHOATE' ... 'MT. HERMON'
array(['CHOATE', 'DEERFIELD', 'PHILLIPS ANDOVER', 'PHILLIPS EXETER',
'HOTCHKISS', 'LAWRENCEVILLE', "ST. PAUL'S", 'MT. HERMON'],
dtype='<U16') - Data variables: (1)
* obs
(chain, draw, school)
float64
...
[4000 values with dtype=float64] - Indexes: (3)
* PandasIndex
PandasIndex(Index([0], dtype='int64', name='chain'))
* PandasIndex
PandasIndex(Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
...
490, 491, 492, 493, 494, 495, 496, 497, 498, 499],
dtype='int64', name='draw', length=500))
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.604969
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- observed_data
<xarray.Dataset> Size: 1kB
Dimensions: (school: 8, Upper: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
upper (Upper) <U16 512B 'CHOATE' 'DEERFIELD' ... 'MT. HERMON'
Dimensions without coordinates: Upper
Data variables:
obs (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8
* Upper: 8 - Coordinates: (2)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16')
* upper
(Upper)
<U16
'CHOATE' ... 'MT. HERMON'
array(['CHOATE', 'DEERFIELD', 'PHILLIPS ANDOVER', 'PHILLIPS EXETER',
'HOTCHKISS', 'LAWRENCEVILLE', "ST. PAUL'S", 'MT. HERMON'],
dtype='<U16') - Data variables: (1)
* obs
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.606375
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
- constant_data
<xarray.Dataset> Size: 576B
Dimensions: (school: 8)
Coordinates:- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'
Data variables:
scores (school) float64 64B ...
Attributes: (4)- Dimensions:
* school: 8 - Coordinates: (1)
* school
(school)
<U16
'Choate' ... 'Mt. Hermon'
array(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', "St. Paul's", 'Mt. Hermon'], dtype='<U16') - Data variables: (1)
* scores
(school)
float64
...
[8 values with dtype=float64] - Indexes: (1)
* PandasIndex
PandasIndex(Index(['Choate', 'Deerfield', 'Phillips Andover', 'Phillips Exeter',
'Hotchkiss', 'Lawrenceville', 'St. Paul's', 'Mt. Hermon'],
dtype='object', name='school')) - Attributes: (4)
arviz_version :
0.13.0.dev0
created_at :
2022-10-13T14:37:26.607471
inference_library :
pymc
inference_library_version :
4.2.2
- Dimensions:
- school (school) <U16 512B 'Choate' 'Deerfield' ... 'Mt. Hermon'