import arviz as az
import pystan
import numpy as np
import ujson as json
with open("radon.json", "rb") as f:
radon_data = json.load(f)
key_renaming = {"x": "floor_idx", "county": "county_idx", "u": "uranium"}
radon_data = {
key_renaming.get(key, key): np.array(value) if isinstance(value, list) else value
for key, value in radon_data.items()
}
radon_data["county_idx"] = radon_data["county_idx"] + 1
prior_code = """
data {
int<lower=0> J;
int<lower=0> N;
int floor_idx[N];
int county_idx[N];
real uranium[J];
}
generated quantities {
real g[2];
real<lower=0> sigma_a = exponential_rng(1);
real<lower=0> sigma = exponential_rng(1);
real b = normal_rng(0, 1);
real za_county[J];
real y_hat[N];
real a[J];
real a_county[J];
g[1] = normal_rng(0, 10);
g[2] = normal_rng(0, 10);
for (i in 1:J) {
za_county[i] = normal_rng(0, 1);
a[i] = g[1] + g[2] * uranium[i];
a_county[i] = a[i] + za_county[i] * sigma_a;
}
for (j in 1:N) {
y_hat[j] = normal_rng(a_county[county_idx[j]] + b * floor_idx[j], sigma);
}
}
"""
prior_model = pystan.StanModel(model_code=prior_code, extra_compile_args=['-flto'])
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_51a6e73bb4685d9d898431904d164252 NOW.
prior_data = {key: value for key, value in radon_data.items() if key not in ("county_name", "y")}
prior = prior_model.sampling(data=prior_data, iter=500, warmup=0, algorithm="Fixed_param")
WARNING:pystan:`warmup=0` forced with `algorithm="Fixed_param"`.
radon_code = """
data {
int<lower=0> J;
int<lower=0> N;
int floor_idx[N];
int county_idx[N];
real uranium[J];
real y[N];
}
parameters {
real g[2];
real<lower=0> sigma_a;
real<lower=0> sigma;
real za_county[J];
real b;
}
transformed parameters {
real theta[N];
real a[J];
real a_county[J];
for (i in 1:J) {
a[i] = g[1] + g[2] * uranium[i];
a_county[i] = a[i] + za_county[i] * sigma_a;
}
for (j in 1:N)
theta[j] = a_county[county_idx[j]] + b * floor_idx[j];
}
model {
g ~ normal(0, 10);
sigma_a ~ exponential(1);
za_county ~ normal(0, 1);
b ~ normal(0, 1);
sigma ~ exponential(1);
for (j in 1:N)
y[j] ~ normal(theta[j], sigma);
}
generated quantities {
real log_lik[N];
real y_hat[N];
for (j in 1:N) {
log_lik[j] = normal_lpdf(y[j] | theta[j], sigma);
y_hat[j] = normal_rng(theta[j], sigma);
}
}
"""
stan_model = pystan.StanModel(model_code=radon_code, extra_compile_args=['-flto'])
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_3ab5b33b0aee1c122fca5450e04a6494 NOW.
model_data = {key: value for key, value in radon_data.items() if key not in ("county_name",)}
fit = stan_model.sampling(data=model_data, control={"adapt_delta": 0.99}, iter=1500, warmup=1000)
WARNING:pystan:Maximum (flat) parameter count (1000) exceeded: skipping diagnostic tests for n_eff and Rhat. To run all diagnostics call pystan.check_hmc_diagnostics(fit)
coords = {
"level": ["basement", "floor"],
"obs_id": np.arange(radon_data["y"].size),
"county": radon_data["county_name"],
"g_coef": ["intercept", "slope"],
}
dims = {
"g" : ["g_coef"],
"za_county" : ["county"],
"y" : ["obs_id"],
"y_hat" : ["obs_id"],
"floor_idx" : ["obs_id"],
"county_idx" : ["obs_id"],
"theta" : ["obs_id"],
"uranium" : ["county"],
"a" : ["county"],
"a_county" : ["county"],
}
idata = az.from_pystan(
posterior=fit,
posterior_predictive="y_hat",
prior=prior,
prior_predictive="y_hat",
observed_data=["y"],
constant_data=["floor_idx", "county_idx", "uranium"],
log_likelihood={"y": "log_lik"},
coords=coords,
dims=dims,
).rename({"y_hat": "y"}) # renames both prior and posterior predictive
idata
<xarray.Dataset> Dimensions: (chain: 4, county: 85, draw: 500, g_coef: 2, obs_id: 919) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 ... 492 493 494 495 496 497 498 499 * g_coef (g_coef) <U9 'intercept' 'slope' * county (county) <U17 'AITKIN' 'ANOKA' ... 'WRIGHT' 'YELLOW MEDICINE' * obs_id (obs_id) int64 0 1 2 3 4 5 6 7 ... 912 913 914 915 916 917 918 Data variables: g (chain, draw, g_coef) float64 1.422 0.8193 1.471 ... 1.468 0.553 sigma_a (chain, draw) float64 0.07058 0.1412 0.1446 ... 0.1085 0.1642 sigma (chain, draw) float64 0.7718 0.7581 0.7664 ... 0.753 0.7568 za_county (chain, draw, county) float64 -0.5769 0.272 ... 1.121 2.431 b (chain, draw) float64 -0.6334 -0.6666 -0.6876 ... -0.7367 -0.7349 theta (chain, draw, obs_id) float64 0.1833 0.8167 ... 2.064 2.064 a (chain, draw, county) float64 0.8575 0.7278 1.329 ... 1.419 1.665 a_county (chain, draw, county) float64 0.8167 0.747 1.254 ... 1.603 2.064 Attributes: created_at: 2020-10-14T17:54:38.368054 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1 args: [{"random_seed":"55974540","chain_id":0,"init... inits: [[-0.6890848703967867,1.6651652637888739,0.21... step_size: [0.102456, 0.0748624, 0.0864012, 0.117333] metric: ['diag_e', 'diag_e', 'diag_e', 'diag_e'] inv_metric: [[0.00129703,0.00845106,0.138269,0.000598391,... adaptation_info: ['# Adaptation terminated\n# Step size = 0.10... stan_code: \ndata {\n int<lower=0> J;\n int<lower=0> N...
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array(['intercept', 'slope'], dtype='<U9')
array(['AITKIN', 'ANOKA', 'BECKER', 'BELTRAMI', 'BENTON', 'BIG STONE', 'BLUE EARTH', 'BROWN', 'CARLTON', 'CARVER', 'CASS', 'CHIPPEWA', 'CHISAGO', 'CLAY', 'CLEARWATER', 'COOK', 'COTTONWOOD', 'CROW WING', 'DAKOTA', 'DODGE', 'DOUGLAS', 'FARIBAULT', 'FILLMORE', 'FREEBORN', 'GOODHUE', 'HENNEPIN', 'HOUSTON', 'HUBBARD', 'ISANTI', 'ITASCA', 'JACKSON', 'KANABEC', 'KANDIYOHI', 'KITTSON', 'KOOCHICHING', 'LAC QUI PARLE', 'LAKE', 'LAKE OF THE WOODS', 'LE SUEUR', 'LINCOLN', 'LYON', 'MAHNOMEN', 'MARSHALL', 'MARTIN', 'MCLEOD', 'MEEKER', 'MILLE LACS', 'MORRISON', 'MOWER', 'MURRAY', 'NICOLLET', 'NOBLES', 'NORMAN', 'OLMSTED', 'OTTER TAIL', 'PENNINGTON', 'PINE', 'PIPESTONE', 'POLK', 'POPE', 'RAMSEY', 'REDWOOD', 'RENVILLE', 'RICE', 'ROCK', 'ROSEAU', 'SCOTT', 'SHERBURNE', 'SIBLEY', 'ST LOUIS', 'STEARNS', 'STEELE', 'STEVENS', 'SWIFT', 'TODD', 'TRAVERSE', 'WABASHA', 'WADENA', 'WASECA', 'WASHINGTON', 'WATONWAN', 'WILKIN', 'WINONA', 'WRIGHT', 'YELLOW MEDICINE'], dtype='<U17')
array([ 0, 1, 2, ..., 916, 917, 918])
array([[[1.42199468, 0.81929967], [1.47054685, 0.58978703], [1.4956456 , 0.84566927], ..., [1.46087528, 0.88476807], [1.45534921, 0.8605568 ], [1.48769286, 0.87806223]], [[1.42055553, 0.78547637], [1.50426666, 0.75801619], [1.42572388, 0.74673054], ..., [1.43659007, 0.54895145], [1.42799638, 0.60751334], [1.4975536 , 0.69059939]], [[1.54117695, 0.82953643], [1.33373772, 0.561186 ], [1.49766452, 0.73120845], ..., [1.4686563 , 0.67718512], [1.45494738, 0.71645813], [1.44723196, 0.7695502 ]], [[1.4955135 , 0.80203301], [1.50172456, 0.68620055], [1.41909476, 0.7577638 ], ..., [1.41807743, 0.68019625], [1.44957999, 0.63996491], [1.46842312, 0.55297047]]])
array([[0.07058266, 0.14119245, 0.14459054, ..., 0.08887054, 0.08678728, 0.10335667], [0.13868053, 0.13583505, 0.1048785 , ..., 0.07045195, 0.13057896, 0.12749455], [0.07683681, 0.20973205, 0.12202587, ..., 0.16863782, 0.10734757, 0.18568799], [0.12850701, 0.12668846, 0.16581781, ..., 0.10294785, 0.10852793, 0.1641567 ]])
array([[0.7717723 , 0.75809813, 0.76643142, ..., 0.73060156, 0.72270329, 0.72403288], [0.75340058, 0.76608775, 0.77953111, ..., 0.7854937 , 0.78475895, 0.75928532], [0.77930005, 0.73277925, 0.78027864, ..., 0.75550502, 0.77358513, 0.74932407], [0.75880748, 0.7728672 , 0.74374831, ..., 0.75207111, 0.75295813, 0.75675328]])
array([[[-5.76877839e-01, 2.71955558e-01, -1.06154512e+00, ..., -1.21716874e+00, -8.71855423e-01, -7.28718244e-01], [ 4.60751288e-01, 1.06900494e-01, 5.54949006e-01, ..., -6.08120555e-01, 1.65159585e+00, 8.96055819e-01], [-5.62870005e-01, 9.55858671e-02, 8.81028688e-01, ..., 2.42311012e-01, 1.93605731e-01, -1.51150338e+00], ..., [ 8.05550350e-01, 1.50768740e+00, 2.19981748e+00, ..., 2.07945980e+00, -8.47115266e-01, 1.29268637e+00], [ 4.63862967e-01, 1.79529143e+00, 1.56827242e+00, ..., 1.48717596e+00, -1.29345054e+00, 1.70686887e+00], [-8.60381302e-02, 1.21161347e+00, 7.11444170e-01, ..., 7.24570259e-01, -1.87363989e+00, 1.49083646e+00]], [[-1.96298708e+00, -1.31248926e-01, -5.88709410e-01, ..., 2.43364746e-01, 1.49759619e+00, -5.41409368e-01], [ 1.82046527e+00, 2.58159408e-01, 6.87931827e-01, ..., -5.82432924e-01, -2.67165581e-01, 9.74978689e-02], [-1.71741053e+00, 4.48974567e-01, 1.84688144e-01, ..., 9.59678163e-01, 1.03163500e+00, -6.07376006e-01], ... [-1.39257111e-01, 1.95721788e-01, 1.17379610e+00, ..., -3.42953495e-01, 5.50256701e-01, -4.21100546e-01], [-9.32292972e-02, 4.46224167e-01, -8.74535991e-01, ..., -3.17151893e-01, 7.34538403e-01, -1.93131644e-01], [ 1.04672623e+00, 4.77084740e-01, 1.03196715e+00, ..., -7.22938771e-01, 3.88760241e-01, -1.81367555e-01]], [[ 9.03804593e-01, 8.75776421e-02, -1.74935340e-01, ..., -1.04764145e+00, -4.08267509e-01, 1.61728119e+00], [-9.87605244e-01, -6.02677362e-01, -1.17699480e+00, ..., -3.22889239e-01, 8.02543287e-01, -2.99705672e+00], [-2.40478984e-03, 1.10836290e+00, 1.18322304e+00, ..., -5.29246066e-01, 2.46498939e-01, 3.05474315e+00], ..., [ 4.12764718e-01, -1.79957363e-01, -1.92805831e+00, ..., -8.54914063e-01, 1.14783736e+00, 2.03169617e-01], [ 3.95830348e-01, -4.87534068e-02, -1.10211909e+00, ..., -6.33389191e-01, 7.81905528e-01, -6.63963950e-01], [-7.17741079e-01, -4.84524299e-01, -6.78615728e-01, ..., -7.89287638e-02, 1.12081194e+00, 2.43052190e+00]]])
array([[-0.6334499 , -0.66662098, -0.68761968, ..., -0.69098479, -0.68276843, -0.73796682], [-0.61514373, -0.70510449, -0.63149095, ..., -0.71863978, -0.71085979, -0.66828567], [-0.75087146, -0.62127183, -0.68968207, ..., -0.57685037, -0.69891468, -0.61951886], [-0.65088123, -0.83291497, -0.48928346, ..., -0.66656556, -0.73666359, -0.73494468]])
array([[[ 0.18329075, 0.81674065, 0.81674065, ..., 1.28669995, 1.66164632, 1.66164632], [ 0.46258915, 1.12921012, 1.12921012, ..., 1.65064457, 1.80660682, 1.80660682], [ 0.14393386, 0.83155354, 0.83155354, ..., 1.44750839, 1.5775518 , 1.5775518 ], ..., [ 0.23183288, 0.92281767, 0.92281767, ..., 1.30594109, 1.8901036 , 1.8901036 ], [ 0.21987359, 0.90264202, 0.90264202, ..., 1.26562316, 1.90922834, 1.90922834], [ 0.13580675, 0.87377357, 0.87377357, ..., 1.21499276, 1.95374483, 1.95374483]], [[-0.0080469 , 0.60709683, 0.60709683, ..., 1.55753102, 1.62454212, 1.62454212], [ 0.52413591, 1.22924041, 1.22924041, ..., 1.39973635, 1.78682357, 1.78682357], [ 0.09958061, 0.73107156, 0.73107156, ..., 1.46669634, 1.62732684, 1.62732684], ... [ 0.40170914, 0.97855951, 0.97855951, ..., 1.5004873 , 1.63823788, 1.63823788], [ 0.25235102, 0.95126569, 0.95126569, ..., 1.46929967, 1.68876341, 1.68876341], [ 0.49182088, 1.11133974, 1.11133974, ..., 1.45014187, 1.68696535, 1.68696535]], [[ 0.40813858, 1.05901981, 1.05901981, ..., 1.37084583, 1.98829735, 1.98829735], [ 0.07086656, 0.90378152, 0.90378152, ..., 1.54162282, 1.36583017, 1.36583017], [ 0.40727723, 0.89656069, 0.89656069, ..., 1.39175154, 2.1948492 , 2.1948492 ], ..., [ 0.32531752, 0.99188308, 0.99188308, ..., 1.47501065, 1.68065818, 1.68065818], [ 0.31490876, 1.05157235, 1.05157235, ..., 1.4768262 , 1.60489256, 1.60489256], [ 0.23463347, 0.96957814, 0.96957814, ..., 1.60263114, 2.06387278, 2.06387278]]])
array([[[0.85745822, 0.72779154, 1.32903794, ..., 1.80150401, 1.34823782, 1.71308119], [1.06415552, 0.97081272, 1.40363034, ..., 1.7437432 , 1.4174517 , 1.68009051], [0.91293922, 0.77909915, 1.399697 , ..., 1.88736964, 1.41951484, 1.79610088], ..., [0.85122797, 0.71119992, 1.36049058, ..., 1.87071035, 1.38122468, 1.77522186], [0.86238462, 0.72618837, 1.35771149, ..., 1.85396934, 1.37787821, 1.76109384], [0.88266619, 0.74369943, 1.38806899, ..., 1.8944217 , 1.40864594, 1.79965694]], [[0.87932492, 0.7550113 , 1.33143634, ..., 1.7843975 , 1.34984359, 1.69962505], [0.98195742, 0.86198979, 1.41826307, ..., 1.85538875, 1.4360268 , 1.77357994], [0.911191 , 0.79300949, 1.34100075, ..., 1.77161833, 1.35850001, 1.69102752], ... [1.00204353, 0.89486865, 1.39182371, ..., 1.78233649, 1.40769321, 1.70925136], [0.96127363, 0.8478832 , 1.37365892, ..., 1.78681929, 1.39044876, 1.70949563], [0.91697525, 0.79518218, 1.35991974, ..., 1.80369675, 1.37795376, 1.72064313]], [[0.94287459, 0.81594062, 1.40451582, ..., 1.86702471, 1.42331106, 1.78046539], [1.02889971, 0.920298 , 1.42386908, ..., 1.81958079, 1.43994985, 1.74552268], [0.89695944, 0.77703176, 1.33311981, ..., 1.77009995, 1.35087763, 1.68831838], ..., [0.94938984, 0.8417384 , 1.3409032 , ..., 1.73315241, 1.35684326, 1.65974231], [1.0086137 , 0.90732949, 1.37697035, ..., 1.74601933, 1.39196761, 1.67695119], [1.08740015, 0.99988413, 1.40568377, ..., 1.72456561, 1.41864236, 1.66488633]]])
array([[[0.81674065, 0.74698688, 1.25411127, ..., 1.715593 , 1.28669995, 1.66164632], [1.12921012, 0.98590626, 1.48198495, ..., 1.65788117, 1.65064457, 1.80660682], [0.83155354, 0.79291996, 1.52708541, ..., 1.92240552, 1.44750839, 1.5775518 ], ..., [0.92281767, 0.84518892, 1.55598955, ..., 2.05551307, 1.30594109, 1.8901036 ], [0.90264202, 0.88199682, 1.49381759, ..., 1.98303729, 1.26562316, 1.90922834], [0.87377357, 0.86892777, 1.46160149, ..., 1.96931087, 1.21499276, 1.95374483]], [[0.60709683, 0.73680963, 1.24979381, ..., 1.81814745, 1.55753102, 1.62454212], [1.22924041, 0.89705689, 1.51170832, ..., 1.77627395, 1.39973635, 1.78682357], [0.73107156, 0.84009727, 1.36037057, ..., 1.87226794, 1.46669634, 1.62732684], ... [0.97855951, 0.92787474, 1.58977013, ..., 1.72450156, 1.5004873 , 1.63823788], [0.95126569, 0.89578428, 1.2797796 , ..., 1.7527738 , 1.46929967, 1.68876341], [1.11133974, 0.88377109, 1.55154365, ..., 1.6694557 , 1.45014187, 1.68696535]], [[1.05901981, 0.82719496, 1.3820354 , ..., 1.73239544, 1.37084583, 1.98829735], [0.90378152, 0.84394573, 1.27475742, ..., 1.77867445, 1.54162282, 1.36583017], [0.89656069, 0.96081807, 1.52931927, ..., 1.68234152, 1.39175154, 2.1948492 ], ..., [0.99188308, 0.82321218, 1.14241375, ..., 1.64514085, 1.47501065, 1.68065818], [1.05157235, 0.90203838, 1.25735965, ..., 1.67727891, 1.4768262 , 1.60489256], [0.96957814, 0.92034622, 1.29428445, ..., 1.71160892, 1.60263114, 2.06387278]]])
<xarray.Dataset> Dimensions: (chain: 4, draw: 500, obs_id: 919) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 492 493 494 495 496 497 498 499 * obs_id (obs_id) int64 0 1 2 3 4 5 6 7 ... 911 912 913 914 915 916 917 918 Data variables: y (chain, draw, obs_id) float64 0.3315 1.256 1.357 ... 2.44 0.9659 Attributes: created_at: 2020-10-14T17:54:38.459055 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array([ 0, 1, 2, ..., 916, 917, 918])
array([[[ 0.33153102, 1.25599165, 1.35670003, ..., 0.96693489, 1.32542209, 2.54336556], [ 0.17461584, 1.7043431 , 0.03171802, ..., 2.65794393, 2.70184999, 2.24920401], [-0.29483327, 1.32360547, 2.75898642, ..., 1.09792486, 3.04547833, 2.2593996 ], ..., [-0.76517339, 0.94455521, 2.03113843, ..., 0.91571571, 2.11563932, 2.27999877], [-0.46368264, 0.55390577, 0.176768 , ..., 1.62130932, 1.98252467, 2.3852209 ], [ 0.23359823, 1.05177233, 2.20868891, ..., 2.45449249, 2.69728561, 1.03620119]], [[-0.11964315, 1.1935326 , 0.36282678, ..., 3.43130996, 2.53602194, 0.24208223], [-0.08077917, 1.28266978, 1.86502547, ..., 1.11987165, 1.27021923, 1.23684774], [ 0.72625085, 1.83084428, 0.19753848, ..., 1.67497887, 0.67613321, 2.06781831], ... [-1.10664525, 0.58482988, 2.73013216, ..., 1.34499806, 0.72536799, 2.82859899], [ 0.3205828 , 1.05153152, 1.21979899, ..., 2.07289935, 0.59908072, 1.74833298], [-0.54027374, 2.00096849, 1.11627317, ..., -0.01696112, 2.54825943, 2.01402513]], [[ 1.27072952, 2.27771279, 0.94031246, ..., 0.97038044, 1.78069342, 2.14696955], [ 0.23295517, -0.15188702, 1.78294702, ..., 1.01257318, -0.32538564, 1.53402293], [-0.64290817, -0.33282215, 1.92372971, ..., 1.17739567, 2.23636815, 2.01730981], ..., [-0.82061986, 1.06789278, 0.21621335, ..., 1.30227526, 1.91719437, 2.33002251], [-0.31675094, 1.6816017 , 0.59156751, ..., 0.9250472 , 2.00621226, 1.46829091], [-0.88410116, 1.00158207, 0.9486254 , ..., 1.92760649, 2.43986221, 0.965907 ]]])
<xarray.Dataset> Dimensions: (chain: 4, draw: 500, obs_id: 919) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 492 493 494 495 496 497 498 499 * obs_id (obs_id) int64 0 1 2 3 4 5 6 7 ... 911 912 913 914 915 916 917 918 Data variables: y (chain, draw, obs_id) float64 -0.9673 -0.6605 ... -1.139 -1.512 Attributes: created_at: 2020-10-14T17:54:38.405520 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array([ 0, 1, 2, ..., 916, 917, 918])
array([[[-0.96729949, -0.66054432, -0.71148951, ..., -0.7473091 , -0.76466094, -0.95899357], [-0.73438145, -0.7430139 , -0.64561544, ..., -0.64347334, -0.85799702, -1.12085251], [-1.00651924, -0.65450936, -0.69920077, ..., -0.67524751, -0.71462131, -0.87679491], ..., [-0.89527557, -0.62196179, -0.62391105, ..., -0.69133289, -0.92209045, -1.24321246], [-0.90366648, -0.60666347, -0.61932681, ..., -0.70734357, -0.93984101, -1.27694088], [-1.00229022, -0.60296257, -0.63079244, ..., -0.74441759, -0.99332824, -1.34987929]], [[-1.1946291 , -0.66475399, -0.8202464 , ..., -0.6381537 , -0.7238583 , -0.91185881], [-0.71200201, -0.81800465, -0.67554221, ..., -0.68994416, -0.84753631, -1.09672553], [-1.06034449, -0.6725855 , -0.76146778, ..., -0.68664088, -0.75360337, -0.93032769], ... [-0.76959401, -0.67022666, -0.64507125, ..., -0.6489678 , -0.73390927, -0.92670948], [-0.90235409, -0.68436558, -0.67297186, ..., -0.67862741, -0.78314079, -0.98760304], [-0.70871216, -0.72319143, -0.63229098, ..., -0.65295128, -0.75801824, -0.97515452]], [[-0.76853502, -0.70649983, -0.64295947, ..., -0.69236456, -1.04442558, -1.38366497], [-1.09232692, -0.6724232 , -0.68296903, ..., -0.66514006, -0.66405778, -0.7371898 ], [-0.75422035, -0.63344916, -0.64844307, ..., -0.66571914, -1.33326728, -1.77735242], ..., [-0.82363078, -0.67059584, -0.63870275, ..., -0.64998862, -0.75655965, -0.96939595], [-0.83296153, -0.69624763, -0.63534511, ..., -0.65070217, -0.71275554, -0.89253345], [-0.90801695, -0.66886219, -0.64812223, ..., -0.64026099, -1.1386185 , -1.51185267]]])
<xarray.Dataset> Dimensions: (chain: 4, draw: 500) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499 Data variables: accept_stat (chain, draw) float64 0.9732 0.9973 0.9986 ... 0.9892 0.991 stepsize (chain, draw) float64 0.1025 0.1025 0.1025 ... 0.1173 0.1173 treedepth (chain, draw) int64 5 5 5 5 5 5 5 5 5 5 ... 5 5 5 5 5 5 5 5 5 5 n_leapfrog (chain, draw) int64 31 31 31 63 63 31 63 ... 31 31 31 31 31 31 diverging (chain, draw) bool False False False ... False False False energy (chain, draw) float64 297.0 308.0 302.0 ... 303.6 313.2 296.2 lp (chain, draw) float64 -259.5 -257.5 -251.7 ... -253.1 -242.8 Attributes: created_at: 2020-10-14T17:54:38.383098 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1 args: [{"random_seed":"55974540","chain_id":0,"init... inits: [[-0.6890848703967867,1.6651652637888739,0.21... step_size: [0.102456, 0.0748624, 0.0864012, 0.117333] metric: ['diag_e', 'diag_e', 'diag_e', 'diag_e'] inv_metric: [[0.00129703,0.00845106,0.138269,0.000598391,... adaptation_info: ['# Adaptation terminated\n# Step size = 0.10... stan_code: \ndata {\n int<lower=0> J;\n int<lower=0> N...
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array([[0.97323963, 0.99725243, 0.99858307, ..., 0.99909413, 0.99743539, 0.99967478], [0.99237681, 0.99785963, 0.99158785, ..., 0.98948885, 0.98294618, 0.9975952 ], [0.99377412, 1. , 1. , ..., 0.99902989, 0.97188025, 0.99207784], [0.99451235, 0.99157766, 0.99658286, ..., 0.94281222, 0.98924694, 0.99104099]])
array([[0.10245552, 0.10245552, 0.10245552, ..., 0.10245552, 0.10245552, 0.10245552], [0.07486237, 0.07486237, 0.07486237, ..., 0.07486237, 0.07486237, 0.07486237], [0.08640118, 0.08640118, 0.08640118, ..., 0.08640118, 0.08640118, 0.08640118], [0.11733265, 0.11733265, 0.11733265, ..., 0.11733265, 0.11733265, 0.11733265]])
array([[5, 5, 5, ..., 5, 5, 5], [6, 6, 6, ..., 6, 6, 6], [6, 6, 6, ..., 6, 6, 6], [5, 5, 5, ..., 5, 5, 5]])
array([[31, 31, 31, ..., 31, 31, 31], [63, 63, 63, ..., 63, 63, 63], [63, 63, 63, ..., 63, 63, 63], [31, 31, 31, ..., 31, 31, 31]])
array([[False, False, False, ..., False, False, False], [False, False, False, ..., False, False, False], [False, False, False, ..., False, False, False], [False, False, False, ..., False, False, False]])
array([[297.02826224, 307.95845829, 302.03144022, ..., 299.97034574, 308.98158396, 317.84484539], [307.79284515, 304.49468483, 307.18376639, ..., 302.17276824, 305.56212161, 303.65830129], [318.19886523, 306.42095509, 296.06600682, ..., 287.42699461, 294.40262153, 297.7192269 ], [301.8117987 , 313.05501625, 304.25576443, ..., 303.60507806, 313.20007345, 296.20896036]])
array([[-259.51429206, -257.52110252, -251.70158259, ..., -268.84200206, -274.71504165, -267.82656651], [-259.37013649, -263.28798582, -259.05496097, ..., -259.72315755, -266.12260439, -257.09863784], [-266.90986656, -256.46272665, -248.21044239, ..., -241.37175842, -246.2900887 , -241.85250292], [-260.85832519, -255.24403788, -260.19189144, ..., -265.25258162, -253.10899677, -242.79945444]])
<xarray.Dataset> Dimensions: (chain: 4, county: 85, draw: 500, g_coef: 2) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 ... 492 493 494 495 496 497 498 499 * g_coef (g_coef) <U9 'intercept' 'slope' * county (county) <U17 'AITKIN' 'ANOKA' ... 'WRIGHT' 'YELLOW MEDICINE' Data variables: g (chain, draw, g_coef) float64 -18.13 12.45 ... 0.1568 2.502 sigma_a (chain, draw) float64 0.3894 0.4864 1.839 ... 1.087 0.7622 1.325 sigma (chain, draw) float64 0.674 0.2708 1.013 ... 0.5544 0.6577 0.177 b (chain, draw) float64 -2.32 0.7922 -0.08347 ... 1.517 -0.3149 za_county (chain, draw, county) float64 0.7894 -0.819 ... 0.8195 -2.563 a (chain, draw, county) float64 -26.71 -28.68 ... -0.06844 1.046 a_county (chain, draw, county) float64 -26.4 -29.0 -19.3 ... 1.017 -2.351 Attributes: created_at: 2020-10-14T17:54:38.470706 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1 args: [{"random_seed":"1111484586","chain_id":0,"in... inits: [[-18.130655239984424,12.45383580853858,0.389... step_size: [nan, nan, nan, nan] metric: ['unit_e', 'unit_e', 'unit_e', 'unit_e'] inv_metric: [null,null,null,null] adaptation_info: ['', '', '', ''] stan_code: \ndata {\n int<lower=0> J;\n int<lower=0> N...
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array(['intercept', 'slope'], dtype='<U9')
array(['AITKIN', 'ANOKA', 'BECKER', 'BELTRAMI', 'BENTON', 'BIG STONE', 'BLUE EARTH', 'BROWN', 'CARLTON', 'CARVER', 'CASS', 'CHIPPEWA', 'CHISAGO', 'CLAY', 'CLEARWATER', 'COOK', 'COTTONWOOD', 'CROW WING', 'DAKOTA', 'DODGE', 'DOUGLAS', 'FARIBAULT', 'FILLMORE', 'FREEBORN', 'GOODHUE', 'HENNEPIN', 'HOUSTON', 'HUBBARD', 'ISANTI', 'ITASCA', 'JACKSON', 'KANABEC', 'KANDIYOHI', 'KITTSON', 'KOOCHICHING', 'LAC QUI PARLE', 'LAKE', 'LAKE OF THE WOODS', 'LE SUEUR', 'LINCOLN', 'LYON', 'MAHNOMEN', 'MARSHALL', 'MARTIN', 'MCLEOD', 'MEEKER', 'MILLE LACS', 'MORRISON', 'MOWER', 'MURRAY', 'NICOLLET', 'NOBLES', 'NORMAN', 'OLMSTED', 'OTTER TAIL', 'PENNINGTON', 'PINE', 'PIPESTONE', 'POLK', 'POPE', 'RAMSEY', 'REDWOOD', 'RENVILLE', 'RICE', 'ROCK', 'ROSEAU', 'SCOTT', 'SHERBURNE', 'SIBLEY', 'ST LOUIS', 'STEARNS', 'STEELE', 'STEVENS', 'SWIFT', 'TODD', 'TRAVERSE', 'WABASHA', 'WADENA', 'WASECA', 'WASHINGTON', 'WATONWAN', 'WILKIN', 'WINONA', 'WRIGHT', 'YELLOW MEDICINE'], dtype='<U17')
array([[[-18.13065524, 12.45383581], [-16.17495142, -13.65161665], [ 3.09505934, -2.38557346], ..., [-16.23277317, -13.11585427], [ -7.94862193, 5.09506999], [ 7.35423054, 11.49407642]], [[ 14.43904127, 22.55891446], [ -0.61437425, -25.94007157], [-13.96333217, 6.69815948], ..., [ -7.49998309, -13.19663601], [ 0.72972802, -11.40972584], [ -2.27152861, 2.29405229]], [[ 8.10114345, -2.95242675], [ 3.85781514, 8.4045463 ], [-10.08489296, -0.62714806], ..., [ 16.6250637 , 7.64868908], [ -7.88011156, -4.7197947 ], [ -9.96647288, 10.10053708]], [[-12.12749819, -15.73693614], [ -6.18879151, 8.8034335 ], [ -9.56424793, 7.80518225], ..., [ -2.7792741 , 9.10880692], [ -2.42731845, -2.66207325], [ 0.15677969, 2.50179701]]])
array([[0.38941644, 0.48637254, 1.83853177, ..., 1.93924233, 1.06319884, 1.82254427], [1.69813459, 2.65029943, 4.80675438, ..., 1.10691969, 0.2673847 , 0.62497521], [0.45918548, 0.73455602, 1.69604472, ..., 6.49736332, 0.5005579 , 0.08215566], [1.47481543, 0.68288454, 0.91161799, ..., 1.08717877, 0.76224945, 1.3250801 ]])
array([[0.67397798, 0.27080245, 1.01258511, ..., 0.00663318, 1.42017353, 3.25053319], [3.72809936, 0.93679713, 0.05809487, ..., 5.26819593, 1.28044914, 0.37067963], [0.30011404, 1.30564777, 1.83034944, ..., 1.26091042, 0.03332821, 0.35898313], [1.62767445, 0.44677139, 0.46745279, ..., 0.55439138, 0.65771615, 0.17695562]])
array([[-2.32029602, 0.79220914, -0.08346646, ..., -0.18196281, 1.20867569, 1.07051455], [ 0.14662704, -0.15287632, 0.48406757, ..., -0.46907177, 0.91300797, 0.26150951], [-0.0929491 , 0.65383284, -0.62470179, ..., -0.89131004, -0.01624423, -0.21829918], [-1.21362074, 0.98620316, 0.7647279 , ..., -1.55734121, 1.51725901, -0.31485869]])
array([[[ 7.89373224e-01, -8.18972836e-01, 6.27632743e-01, ..., 5.55207517e-01, -1.08573444e+00, 4.69256703e-02], [-5.58742748e-01, 2.81217958e-01, 7.90875288e-01, ..., 4.52505341e-02, -2.69294519e+00, 4.16129455e-01], [-1.18739972e+00, -1.10673267e+00, 9.80621932e-01, ..., -9.95705260e-02, -8.22903874e-01, 1.32103212e+00], ..., [ 4.32731566e-01, -7.37207060e-01, -3.59616912e-01, ..., -3.69681902e-01, -2.80918889e+00, -3.67654829e-02], [-8.39488904e-01, 3.76683742e-02, -5.31556892e-01, ..., 1.04057346e+00, -1.49896922e-01, -1.24670556e+00], [ 5.48505443e-02, 1.32210115e+00, 2.31739296e+00, ..., -8.58109740e-01, -5.00337675e-01, 2.69592079e-01]], [[-2.57310400e-01, 7.39886509e-02, -5.14829456e-01, ..., -7.67812308e-01, 1.56854460e+00, 5.75933476e-02], [ 4.89013532e-01, -7.10130309e-01, -8.57255986e-01, ..., 4.04435805e-01, 5.42720899e-02, 1.69720650e+00], [-1.11028931e+00, -5.69853292e-01, -4.42597562e-01, ..., -1.51739570e+00, 2.39035873e-01, -4.02381836e-01], ... [-6.32706223e-01, 1.54306237e-01, -1.21225513e+00, ..., 5.55204613e-01, 1.13630802e+00, -5.48279514e-01], [-7.92952213e-01, 1.03553571e+00, -1.67099834e+00, ..., -3.98579560e-02, 4.41411564e-04, -1.93926520e-01], [-1.02677043e+00, -3.22078026e-03, 2.18157090e-01, ..., 3.64927464e-01, -1.51235648e+00, 8.74795659e-01]], [[ 7.94055324e-01, 9.07845672e-01, -5.81060282e-01, ..., -4.16168225e-01, -7.87982148e-01, -3.23814699e-01], [ 4.04994672e-01, 2.69425198e-01, -1.25189406e+00, ..., 2.70644174e-01, -1.07806506e+00, 5.37576110e-01], [-1.40220760e+00, 8.10031973e-01, -6.89375064e-01, ..., 7.97330689e-01, 5.15636899e-01, 1.26148638e+00], ..., [-1.33611932e+00, 1.54796601e+00, 1.87942211e-01, ..., -6.02493128e-01, -1.72177581e+00, 7.74469886e-03], [-1.54277404e+00, 1.05111090e+00, 5.44608192e-01, ..., 3.60824141e-01, 9.39633308e-01, 1.72083848e+00], [ 1.53036612e-01, -4.97099749e-01, -1.21264342e+00, ..., -1.03203106e+00, 8.19529166e-01, -2.56334603e+00]]])
array([[[-26.71194086, -28.68295048, -19.54365218, ..., -12.3618907 , -19.25180278, -13.70596951], [ -6.76833779, -4.60776107, -14.62605573, ..., -22.49854226, -14.94597453, -21.02519309], [ 4.73883299, 5.11638641, 3.36572358, ..., 1.9900334 , 3.30981886, 2.24749614], ..., [ -7.19532533, -5.11954118, -14.74466443, ..., -22.30819252, -15.0520279 , -20.89266544], [-11.45936766, -12.26574026, -8.52670233, ..., -5.58852505, -8.40730191, -6.1384099 ], [ -0.56573517, -2.38484822, 6.05012673, ..., 12.67842315, 6.31948465, 11.43792626]], [[ -1.1051245 , -4.67541708, 11.8795345 , ..., 24.88859816, 12.40819135, 22.45392989], [ 17.25956969, 21.36498199, 2.32875446, ..., -12.63012324, 1.72086188, -9.83054397], [-18.57868285, -19.63876884, -14.72329713, ..., -10.86066521, -14.56632912, -11.58356331], ... [ 11.35475288, 10.14423107, 15.75725282, ..., 20.16802725, 15.93649601, 19.34254335], [ -4.62794838, -3.88096882, -7.34460945, ..., -10.06637648, -7.45521547, -9.55699317], [-16.92622367, -18.52478785, -11.11246743, ..., -5.28778424, -10.87576641, -6.37788356]], [[ -1.28400019, 1.20661019, -10.34200471, ..., -19.41703377, -10.71079193, -17.71862673], [-12.25477619, -13.64805392, -7.18761827, ..., -2.11093664, -6.98131422, -3.06104619], [-14.94239 , -16.17767924, -10.44981434, ..., -5.94879489, -10.26690381, -6.79116829], ..., [ -9.0556756 , -10.49728335, -3.81274816, ..., 1.44003337, -3.59928783, 0.45696642], [ -0.59302328, -0.17170956, -2.12528289, ..., -3.66042238, -2.18766724, -3.37311842], [ -1.56707752, -1.96302509, -0.12707113, ..., 1.31564176, -0.06844277, 1.0456356 ]]])
array([[[-2.64045459e+01, -2.90018720e+01, -1.92992417e+01, ..., -1.21456838e+01, -1.96746056e+01, -1.36876959e+01], [-7.04009492e+00, -4.47098437e+00, -1.42413957e+01, ..., -2.24765336e+01, -1.62557491e+01, -2.08227991e+01], [ 2.55576088e+00, 3.08162323e+00, 5.16862816e+00, ..., 1.80696982e+00, 1.79688394e+00, 4.67625568e+00], ..., [-6.35615396e+00, -6.54916431e+00, -1.54420488e+01, ..., -2.30250953e+01, -2.04997259e+01, -2.09639626e+01], [-1.23519113e+01, -1.22256913e+01, -9.09185300e+00, ..., -4.48218855e+00, -8.56667215e+00, -7.46390580e+00], [-4.65767627e-01, 2.47396465e-02, 1.02736780e+01, ..., 1.11144802e+01, 5.40759709e+00, 1.19292698e+01]], [[-1.54207219e+00, -4.54977439e+00, 1.10052848e+01, ..., 2.35847495e+01, 1.50717912e+01, 2.25517311e+01], [ 1.85556020e+01, 1.94829240e+01, 5.67694099e-02, ..., -1.15582473e+01, 1.86469917e+00, -5.33243854e+00], [-2.39155708e+01, -2.23779136e+01, -1.68507549e+01, ..., -1.81544136e+01, -1.34173424e+01, -1.35177140e+01], ... [ 7.24383068e+00, 1.11468148e+01, 7.88079079e+00, ..., 2.37753933e+01, 2.33195021e+01, 1.57801721e+01], [-5.02486687e+00, -3.36262324e+00, -8.18104087e+00, ..., -1.00863277e+01, -7.45499452e+00, -9.65406463e+00], [-1.70105787e+01, -1.85250525e+01, -1.10945446e+01, ..., -5.25780338e+00, -1.10000151e+01, -6.30601414e+00]], [[-1.12915140e-01, 2.54551499e+00, -1.11989614e+01, ..., -2.00308051e+01, -1.18729202e+01, -1.81961936e+01], [-1.19782116e+01, -1.34640676e+01, -8.04251737e+00, ..., -1.92611791e+00, -7.71750818e+00, -2.69394378e+00], [-1.62206677e+01, -1.54392395e+01, -1.10782610e+01, ..., -5.22193389e+00, -9.79683993e+00, -5.64117462e+00], ..., [-1.05082762e+01, -8.81436756e+00, -3.60842138e+00, ..., 7.85015630e-01, -5.47116595e+00, 4.65386290e-01], [-1.76900195e+00, 6.29499150e-01, -1.71015559e+00, ..., -3.38538437e+00, -1.47143227e+00, -2.06141024e+00], [-1.36429176e+00, -2.62172208e+00, -1.73392079e+00, ..., -5.18820622e-02, 1.01749902e+00, -2.35100320e+00]]])
<xarray.Dataset> Dimensions: (chain: 4, draw: 500, obs_id: 919) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 8 ... 492 493 494 495 496 497 498 499 * obs_id (obs_id) int64 0 1 2 3 4 5 6 7 ... 911 912 913 914 915 916 917 918 Data variables: y (chain, draw, obs_id) float64 -28.69 -26.65 -25.7 ... -2.576 -2.268 Attributes: created_at: 2020-10-14T17:54:38.533183 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array([ 0, 1, 2, ..., 916, 917, 918])
array([[[-2.86925415e+01, -2.66526855e+01, -2.57002863e+01, ..., -1.83682788e+01, -1.47004606e+01, -1.24321000e+01], [-5.98191125e+00, -6.85012502e+00, -7.24191668e+00, ..., -1.61592405e+01, -2.13295319e+01, -2.12455611e+01], [ 2.81722806e+00, 1.83670941e+00, 3.35345503e+00, ..., 1.88122679e+00, 4.89966943e+00, 4.36995414e+00], ..., [-6.53962244e+00, -6.35993049e+00, -6.34600498e+00, ..., -2.04906258e+01, -2.09609929e+01, -2.09690565e+01], [-1.13560631e+01, -1.15088900e+01, -1.13237122e+01, ..., -1.15989573e+01, -8.19007818e+00, -9.32938017e+00], [-4.31695192e+00, -3.13502854e+00, -6.35481157e+00, ..., 8.31564341e+00, 1.62187908e+01, 1.27840095e+01]], [[ 5.25777290e+00, -3.49027858e+00, -3.39705538e+00, ..., 1.82371488e+01, 2.77636704e+01, 2.15453856e+01], [ 1.85128760e+01, 1.87171293e+01, 1.83079007e+01, ..., 3.02788350e-01, -5.33607845e+00, -5.59231881e+00], [-2.33669621e+01, -2.38335368e+01, -2.40377149e+01, ..., -1.34021767e+01, -1.35676408e+01, -1.34878103e+01], ... [ 6.37183519e+00, 8.12686149e+00, 7.40673181e+00, ..., 2.12391737e+01, 1.66934376e+01, 1.45950490e+01], [-5.06023885e+00, -5.00612477e+00, -5.03573656e+00, ..., -7.45590121e+00, -9.71723154e+00, -9.67058725e+00], [-1.70797218e+01, -1.70754836e+01, -1.72159375e+01, ..., -1.07146657e+01, -6.15610687e+00, -6.63256108e+00]], [[ 2.05459052e-02, -1.43329228e+00, 3.09863915e-01, ..., -1.31132885e+01, -1.65658625e+01, -2.10706004e+01], [-1.06177066e+01, -1.22813884e+01, -1.17046917e+01, ..., -8.07559590e+00, -2.46288300e+00, -2.10872863e+00], [-1.56394763e+01, -1.56775216e+01, -1.58519052e+01, ..., -1.01585679e+01, -5.64931780e+00, -5.53692211e+00], ..., [-1.29287835e+01, -1.10705401e+01, -1.08297185e+01, ..., -5.95759491e+00, -2.04949955e-01, -8.63592398e-02], [ 5.25224503e-01, -5.68558446e-01, -1.44386300e+00, ..., -1.79101853e+00, -1.70236561e+00, -2.00614344e+00], [-1.76230499e+00, -1.22230735e+00, -1.24592048e+00, ..., 1.05689526e+00, -2.57631760e+00, -2.26842536e+00]]])
<xarray.Dataset> Dimensions: (chain: 4, draw: 500) Coordinates: * chain (chain) int64 0 1 2 3 * draw (draw) int64 0 1 2 3 4 5 6 7 ... 493 494 495 496 497 498 499 Data variables: accept_stat (chain, draw) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 lp (chain, draw) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 Attributes: created_at: 2020-10-14T17:54:38.479487 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1 args: [{"random_seed":"1111484586","chain_id":0,"in... inits: [[-18.130655239984424,12.45383580853858,0.389... step_size: [nan, nan, nan, nan] metric: ['unit_e', 'unit_e', 'unit_e', 'unit_e'] inv_metric: [null,null,null,null] adaptation_info: ['', '', '', ''] stan_code: \ndata {\n int<lower=0> J;\n int<lower=0> N...
array([0, 1, 2, 3])
array([ 0, 1, 2, ..., 497, 498, 499])
array([[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]])
array([[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]])
<xarray.Dataset> Dimensions: (obs_id: 919) Coordinates: * obs_id (obs_id) int64 0 1 2 3 4 5 6 7 ... 911 912 913 914 915 916 917 918 Data variables: y (obs_id) float64 0.7885 0.7885 1.065 0.0 ... 1.609 1.308 1.065 Attributes: created_at: 2020-10-14T17:54:38.332973 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1
array([ 0, 1, 2, ..., 916, 917, 918])
array([ 0.78845736, 0.78845736, 1.06471074, 0. , 1.13140211, 0.91629073, 0.40546511, 0. , -0.35667494, 0.18232156, 0.18232156, 0.26236426, 0.33647224, -0.91629073, 0.09531018, 1.5040774 , 0.26236426, 0.74193734, 1.77495235, 1.19392247, 0.58778666, 1.68639895, 1.84054963, 0.64185389, 1.88706965, 1.13140211, 1.91692261, 1.94591015, 2.04122033, 1.64865863, 1.5040774 , 1.48160454, 1.02961942, 2.09186406, 0.47000363, 1.43508453, 1.68639895, 1.38629436, 0.83290912, 1.06471074, 0.33647224, 1.19392247, 1.06471074, 0.58778666, -1.60943791, 0.87546874, 0.09531018, 0.78845736, -0.51082562, 0.53062825, 1.06471074, 0.78845736, 0.53062825, 0.33647224, 0.64185389, 0.58778666, 0.18232156, 1.45861502, 1.5040774 , 1.84054963, 1.5260563 , 1.74046617, 0.78845736, -0.91629073, 1.5260563 , 1.48160454, 1.88706965, 0.99325177, 1.06471074, 1.06471074, 1.97408103, 1.60943791, 0.95551145, 1.60943791, 2.56494936, 1.97408103, 1.91692261, 2.54944517, 1.75785792, 2.2512918 , 1.79175947, 1.33500107, 2.66025954, 0.58778666, 1.93152141, 1.54756251, 2.2512918 , 0.91629073, 1.90210753, 1.38629436, 2.31253542, 0.78845736, 0.58778666, 1.22377543, 1.7227666 , 1.45861502, 1.36097655, 0.26236426, 1.43508453, -0.22314355, ... 1.79175947, 1.06471074, 1.90210753, 2.9601051 , 1.38629436, 1.77495235, 2.19722458, 2.12823171, 0.09531018, 1.13140211, 2.44234704, 2.2617631 , 1.06471074, -0.35667494, 1.16315081, 1.54756251, 1.56861592, -0.91629073, 2.2300144 , 0.53062825, -0.10536052, 2.32238772, 2.04122033, 0.78845736, 1.87180218, 2.50143595, 1.5260563 , 1.82454929, 1.87180218, 1.02961942, 0.64185389, 0.18232156, 0.87546874, 0. , 0.18232156, 0.47000363, -0.22314355, 0.53062825, 1.54756251, 0.53062825, 1.19392247, -0.22314355, 2.28238239, 1.66770682, 2.14006616, 0.64185389, 1.88706965, 1.33500107, 1.77495235, 1.58923521, 0.91629073, 2.37024374, 0.87546874, 0.74193734, 1.54756251, 1.30833282, 2.59525471, 1.06471074, 1.45861502, 1.33500107, 0.58778666, 0.40546511, 0.58778666, 0.26236426, 1.88706965, 3.0155349 , 1.79175947, 2.62466859, 2.32238772, 1.74046617, 2.2300144 , 1.22377543, 1.41098697, 2.4510051 , 1.97408103, 1.54756251, 0.58778666, -0.35667494, 1.54756251, 2.32238772, 2.42480273, 2.02814825, 2.46809953, -0.69314718, 1.90210753, 1.66770682, 1.13140211, 0.74193734, 1.98787435, 1.62924054, 0.78845736, 0.83290912, 2.76631911, 2.2512918 , 1.85629799, 1.5040774 , 1.60943791, 1.30833282, 1.06471074])
<xarray.Dataset> Dimensions: (county: 85, obs_id: 919) Coordinates: * obs_id (obs_id) int64 0 1 2 3 4 5 6 7 ... 912 913 914 915 916 917 918 * county (county) <U17 'AITKIN' 'ANOKA' ... 'WRIGHT' 'YELLOW MEDICINE' Data variables: floor_idx (obs_id) int64 1 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 1 0 0 0 0 0 0 0 county_idx (obs_id) int64 1 1 1 1 2 2 2 2 2 ... 84 84 84 84 84 84 84 85 85 uranium (county) float64 -0.689 -0.8473 -0.1135 ... -0.09002 0.3553 Attributes: created_at: 2020-10-14T17:54:38.335649 arviz_version: 0.10.0 inference_library: pystan inference_library_version: 2.19.1.1
array([ 0, 1, 2, ..., 916, 917, 918])
array(['AITKIN', 'ANOKA', 'BECKER', 'BELTRAMI', 'BENTON', 'BIG STONE', 'BLUE EARTH', 'BROWN', 'CARLTON', 'CARVER', 'CASS', 'CHIPPEWA', 'CHISAGO', 'CLAY', 'CLEARWATER', 'COOK', 'COTTONWOOD', 'CROW WING', 'DAKOTA', 'DODGE', 'DOUGLAS', 'FARIBAULT', 'FILLMORE', 'FREEBORN', 'GOODHUE', 'HENNEPIN', 'HOUSTON', 'HUBBARD', 'ISANTI', 'ITASCA', 'JACKSON', 'KANABEC', 'KANDIYOHI', 'KITTSON', 'KOOCHICHING', 'LAC QUI PARLE', 'LAKE', 'LAKE OF THE WOODS', 'LE SUEUR', 'LINCOLN', 'LYON', 'MAHNOMEN', 'MARSHALL', 'MARTIN', 'MCLEOD', 'MEEKER', 'MILLE LACS', 'MORRISON', 'MOWER', 'MURRAY', 'NICOLLET', 'NOBLES', 'NORMAN', 'OL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, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, ... 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 85])
array([-0.6890476 , -0.84731286, -0.11345877, -0.59335253, -0.14289048, 0.38705671, 0.27161366, 0.2775787 , -0.33231549, 0.09586457, -0.60821981, 0.27368456, -0.73532009, 0.34378118, -0.05986041, -0.50499598, 0.33956032, -0.6333907 , -0.02414516, 0.26385546, 0.15571232, 0.29502505, 0.41491366, 0.22420699, 0.19661065, -0.09652081, 0.50352907, -0.40059698, -0.75187223, -0.66334763, 0.30902028, -0.05338601, 0.10973294, -0.00780337, -0.88182892, 0.31102988, -0.69159638, -0.68170885, 0.19444774, 0.44490375, 0.39473441, 0.14960034, 0.01376483, 0.16586184, 0.14042259, 0.02395087, -0.21005952, -0.09322665, 0.26093247, 0.39884994, 0.24804687, 0.40545177, 0.26522172, 0.24315008, -0.20473037, -0.07402767, -0.16329217, 0.47860404, 0.26611108, 0.28114827, -0.41805351, 0.36632226, 0.38057798, 0.19314609, 0.52802487, -0.21204536, 0.06311563, -0.68343648, 0.23721212, -0.47467372, 0.11639541, 0.26980574, 0.47077833, 0.31602898, -0.04684007, 0.49759448, 0.15008242, -0.67202973, 0.2124142 , -0.14748428, 0.1832378 , 0.23603608, 0.46321187, -0.09002427, 0.35528698])
idata.to_netcdf("pystan.nc")
'pystan.nc'