Skip to content

Updated multilevel modeling to v4 #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cec20e0
Updated multilevel modeling to v4, added missing figures locally
fonnesbeck Feb 27, 2022
433b0fc
Fixes to multilevel modeling notebook
fonnesbeck Feb 27, 2022
b1639bc
Fixrs to multilevel modeling in response to feedback
fonnesbeck Mar 4, 2022
343a12a
Merge remote-tracking branch 'upstream/main' into multilevel_v4_update
fonnesbeck Apr 11, 2022
8c6451a
Added missing mutable argument to pooled model; re-rendered notebook
fonnesbeck Apr 11, 2022
4d25788
Add guide on how to wrap a JAX function in a Aesara Op (#302)
ricardoV94 Apr 14, 2022
2137095
update twitter link (#314)
Sync271 Apr 16, 2022
58fecd3
update Gaussian Mixture Model example with `pm.NormalMixture` (#310)
Apr 17, 2022
e4b67c0
add `*.DS_Store` to `.gitignore` (#315)
Apr 17, 2022
2c7777b
Regression discontinuity example (#308)
Apr 21, 2022
5b854be
Add a pre-commit check to prevent urls pointing to pymc docs (#311)
juanitorduz Apr 22, 2022
5abdbfb
Item response jupyter style update (#309)
ltoniazzi Apr 24, 2022
38f2a50
GP Mauna Loa with PyMC3 best practices (#316)
danhphan May 6, 2022
20efccc
Pre-commit fixes
fonnesbeck May 7, 2022
0c322b6
Format fixes; removed multilevel modeling from excluded list
fonnesbeck May 9, 2022
40d1474
Update myst_nbs/case_studies/multilevel_modeling.myst.md
OriolAbril May 9, 2022
979e517
Update myst_nbs/case_studies/multilevel_modeling.myst.md
OriolAbril May 9, 2022
10c9f9f
Merge branch 'main' into multilevel_v4_update
OriolAbril May 9, 2022
ca33a3c
update notebook
OriolAbril May 9, 2022
8e352bb
fix CI
OriolAbril May 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ repos:
examples/case_studies/blackbox_external_likelihood.ipynb|
examples/case_studies/blackbox_external_likelihood_numpy.ipynb|
examples/case_studies/item_response_nba.ipynb|
examples/case_studies/multilevel_modeling.ipynb|
examples/diagnostics_and_criticism/sampler-stats.ipynb|
examples/gaussian_processes/GP-MaunaLoa2.ipynb|
examples/generalized_linear_models/GLM-logistic.ipynb|
Expand Down
18 changes: 15 additions & 3 deletions examples/case_studies/multilevel_modeling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"(notebook_name)=\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"(notebook_name)=\n",
"(multilevel_modeling)=\n",

"# A Primer on Bayesian Methods for Multilevel Modeling\n",
"\n",
":::{post} 27 February, 2022\n",
":tags: hierarchical, pymc.Data, pymc.Deterministic, pymc.Exponential, pymc.LKJCholeskyCov, pymc.Model, pymc.MvNormal, pymc.Normal\n",
":tags: hierarchical, Data, Deterministic, Exponential, LKJCholeskyCov, Model, MvNormal, Normal\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
":tags: hierarchical, Data, Deterministic, Exponential, LKJCholeskyCov, Model, MvNormal, Normal\n",
":tags: hierarchical model, case study\n",

":category: intermediate\n",
":author: Chris Fonnesbeck, Colin Carroll, Alex Andorra, Oriol Abril, Farhan Reynaldo\n",
":::"
Expand Down Expand Up @@ -570,7 +571,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You may be wondering why we are using the `pm.Data` container above even though the variable `floor_idx` is not an observed variable nor a parameter of the model. As you'll see, this will make our lives much easier when we'll plot and diagnose our model. In short, this will tell [ArviZ](https://arviz-devs.github.io/arviz/index.html) that `floor_idx` is information used by the model to index variables. ArviZ will thus include `floor_idx` as a variable in the `constant_data` group of the resulting [`InferenceData`](https://arviz-devs.github.io/arviz/notebooks/XarrayforArviZ.html) object. Moreover, including `floor_idx` in the `InferenceData` object makes sharing and reproducing analysis much easier, all the data needed to analyze or rerun the model is stored there."
"You may be wondering why we are using the `pm.Data` container above even though the variable `floor_idx` is not an observed variable nor a parameter of the model. As you'll see, this will make our lives much easier when we'll plot and diagnose our model. In short, this will tell {doc}`Arviz <arviz:index>` that `floor_idx` is information used by the model to index variables. ArviZ will thus include `floor_idx` as a variable in the `constant_data` group of the resulting {ref}`InferenceData <xarray_for_arviz>` object. Moreover, including `floor_idx` in the `InferenceData` object makes sharing and reproducing analysis much easier, all the data needed to analyze or rerun the model is stored there."
]
},
{
Expand Down Expand Up @@ -4222,12 +4223,23 @@
"%load_ext watermark\n",
"%watermark -n -u -v -iv -w"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
":::{include} ../page_footer.md\n",
":::"
]
}
],
"metadata": {
"celltoolbar": "Raw Cell Format",
"interpreter": {
"hash": "5429d053af7e221df99a6f00514f0d50433afea7fb367ba3ad570571d9163dca"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.9.10 ('pymc-dev-py39')",
"language": "python",
"name": "python3"
},
Expand Down
10 changes: 7 additions & 3 deletions myst_nbs/case_studies/multilevel_modeling.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ jupytext:
format_version: 0.13
jupytext_version: 1.13.7
kernelspec:
display_name: Python 3 (ipykernel)
display_name: Python 3.9.10 ('pymc-dev-py39')
language: python
name: python3
---

(notebook_name)=
# A Primer on Bayesian Methods for Multilevel Modeling

:::{post} 27 February, 2022
:tags: hierarchical, pymc.Data, pymc.Deterministic, pymc.Exponential, pymc.LKJCholeskyCov, pymc.Model, pymc.MvNormal, pymc.Normal
:tags: hierarchical, Data, Deterministic, Exponential, LKJCholeskyCov, Model, MvNormal, Normal
:category: intermediate
:author: Chris Fonnesbeck, Colin Carroll, Alex Andorra, Oriol Abril, Farhan Reynaldo
:::
Expand Down Expand Up @@ -167,7 +168,7 @@ with pm.Model(coords=coords, rng_seeder=RANDOM_SEED) as pooled_model:
pm.model_to_graphviz(pooled_model)
```

You may be wondering why we are using the `pm.Data` container above even though the variable `floor_idx` is not an observed variable nor a parameter of the model. As you'll see, this will make our lives much easier when we'll plot and diagnose our model. In short, this will tell [ArviZ](https://arviz-devs.github.io/arviz/index.html) that `floor_idx` is information used by the model to index variables. ArviZ will thus include `floor_idx` as a variable in the `constant_data` group of the resulting [`InferenceData`](https://arviz-devs.github.io/arviz/notebooks/XarrayforArviZ.html) object. Moreover, including `floor_idx` in the `InferenceData` object makes sharing and reproducing analysis much easier, all the data needed to analyze or rerun the model is stored there.
You may be wondering why we are using the `pm.Data` container above even though the variable `floor_idx` is not an observed variable nor a parameter of the model. As you'll see, this will make our lives much easier when we'll plot and diagnose our model. In short, this will tell {doc}`Arviz <arviz:index>` that `floor_idx` is information used by the model to index variables. ArviZ will thus include `floor_idx` as a variable in the `constant_data` group of the resulting {ref}`InferenceData <xarray_for_arviz>` object. Moreover, including `floor_idx` in the `InferenceData` object makes sharing and reproducing analysis much easier, all the data needed to analyze or rerun the model is stored there.

+++

Expand Down Expand Up @@ -1134,3 +1135,6 @@ mcelreath2018statistical
%load_ext watermark
%watermark -n -u -v -iv -w
```

:::{include} ../page_footer.md
:::