Skip to content

Have pooling model images be local as they keep disappearing. #282

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
889 changes: 878 additions & 11 deletions examples/case_studies/multilevel_modeling.ipynb

Large diffs are not rendered by default.

Binary file added examples/case_studies/partial_pooled_model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/case_studies/pooled_model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/case_studies/unpooled_model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions examples/generalized_linear_models/GLM-hierarchical.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
"\n",
"Where $i$ represents the measurement, $c$ the county and floor contains a 0 or 1 if the house has a basement or not, respectively. If you need a refresher on Linear Regressions in `PyMC`, check out my [previous blog post](http://twiecki.github.io/blog/2013/08/12/bayesian-glms-1/). Critically, we are only estimating *one* intercept and *one* slope for all measurements over all counties pooled together as illustrated in the graphic below ($\\theta$ represents $(\\alpha, \\beta)$ in our case and $y_i$ are the measurements of the $i$th county).\n",
"\n",
"![pooled](http://f.cl.ly/items/0R1W063h1h0W2M2C0S3M/Screen%20Shot%202013-10-10%20at%208.22.21%20AM.png)\n",
"<img src=\"pooled_model.png\"/>\n",
"\n",
"### Unpooled measurements: separate regressions\n",
"But what if we are interested in whether different counties actually have different relationships (slope) and different base-rates of radon (intercept)? Then you might say \"OK then, I'll just estimate $n$ (number of counties) different regressions -- one for each county\". In math-speak that model would be:\n",
Expand All @@ -242,7 +242,7 @@
"\n",
"Note that we added the subindex $c$ so we are estimating $n$ different $\\alpha$s and $\\beta$s -- one for each county.\n",
"\n",
"![unpooled](http://f.cl.ly/items/38020n2t2Y2b1p3t0B0e/Screen%20Shot%202013-10-10%20at%208.23.36%20AM.png)\n",
"<img src=\"unpooled_model.png\"/>\n",
"\n",
"This is the extreme opposite model; where above we assumed all counties are exactly the same, here we are saying that they share no similarities whatsoever. As we show below, this type of model can be very noisy when we have little data per county, as is the case in this data set.\n",
"\n",
Expand All @@ -255,7 +255,7 @@
"\n",
"We thus assume the intercepts $\\alpha$ and slopes $\\beta$ to come from a normal distribution centered around their respective group mean $\\mu$ with a certain standard deviation $\\sigma^2$, the values (or rather posteriors) of which we also estimate. That's why this is called a multilevel, hierarchical or partial-pooling modeling.\n",
"\n",
"![hierarchical](http://f.cl.ly/items/1B3U223i002y3V2W3r0W/Screen%20Shot%202013-10-10%20at%208.25.05%20AM.png)\n",
"<img src=\"partial_pooled_model.png\"/>\n",
"\n",
"How do we estimate such a complex model you might ask? Well, that's the beauty of Probabilistic Programming -- we just formulate the model we want and press our [Inference Button(TM)](http://twiecki.github.io/blog/2013/08/12/bayesian-glms-1/). \n",
"\n",
Expand Down Expand Up @@ -1883,7 +1883,7 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1897,7 +1897,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.6"
},
"latex_envs": {
"bibliofile": "biblio.bib",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.