Skip to content

Commit

Permalink
deploy: d6549ba
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcky committed Jan 30, 2024
1 parent 9e4779f commit 0c149e1
Show file tree
Hide file tree
Showing 276 changed files with 5,348 additions and 4,250 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c2212723b942c4c0cc05e28651470234
config: 39202ae9e692261b8df2d28975837e40
tags: 645f666f9bcd5a90fca523b33c5a78b7
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
70 changes: 35 additions & 35 deletions _notebooks/ar1_bayes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "e3c19ac4",
"id": "5007980c",
"metadata": {},
"source": [
"# Posterior Distributions for AR(1) Parameters\n",
Expand All @@ -13,7 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "194738d6",
"id": "69fcaa79",
"metadata": {
"hide-output": false
},
Expand All @@ -25,7 +25,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a810f395",
"id": "9d75d29e",
"metadata": {
"hide-output": false
},
Expand All @@ -49,7 +49,7 @@
},
{
"cell_type": "markdown",
"id": "8903c2ed",
"id": "d93f7169",
"metadata": {},
"source": [
"This lecture uses Bayesian methods offered by [pymc](https://www.pymc.io/projects/docs/en/stable/) and [numpyro](https://num.pyro.ai/en/stable/) to make statistical inferences about two parameters of a univariate first-order autoregression.\n",
Expand Down Expand Up @@ -145,7 +145,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6080c7e5",
"id": "7e8770b2",
"metadata": {
"hide-output": false
},
Expand Down Expand Up @@ -175,7 +175,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2ec5bab0",
"id": "3b6cc9e4",
"metadata": {
"hide-output": false
},
Expand All @@ -187,7 +187,7 @@
},
{
"cell_type": "markdown",
"id": "0329be6f",
"id": "4975397b",
"metadata": {},
"source": [
"Now we shall use Bayes’ law to construct a posterior distribution, conditioning on the initial value of $ y_0 $.\n",
Expand All @@ -199,7 +199,7 @@
},
{
"cell_type": "markdown",
"id": "287851ae",
"id": "2dd66b45",
"metadata": {},
"source": [
"## PyMC Implementation\n",
Expand All @@ -211,7 +211,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e3ebfdd8",
"id": "e57c9272",
"metadata": {
"hide-output": false
},
Expand All @@ -234,7 +234,7 @@
},
{
"cell_type": "markdown",
"id": "90996156",
"id": "a9f3a795",
"metadata": {},
"source": [
"[pmc.sample](https://www.pymc.io/projects/docs/en/v5.10.0/api/generated/pymc.sample.html#pymc-sample) by default uses the NUTS samplers to generate samples as shown in the below cell:"
Expand All @@ -243,7 +243,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "356d6214",
"id": "a028b74c",
"metadata": {
"hide-output": false
},
Expand All @@ -256,7 +256,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "770f0cde",
"id": "f326cee2",
"metadata": {
"hide-output": false
},
Expand All @@ -268,22 +268,22 @@
},
{
"cell_type": "markdown",
"id": "658500ab",
"id": "11430d7c",
"metadata": {},
"source": [
"Evidently, the posteriors aren’t centered on the true values of $ .5, 1 $ that we used to generate the data.\n",
"\n",
"This is a symptom of the classic **Hurwicz bias** for first order autoregressive processes (see Leonid Hurwicz [[Hur50](https://python.quantecon.org/zreferences.html#id246)].)\n",
"This is a symptom of the classic **Hurwicz bias** for first order autoregressive processes (see Leonid Hurwicz [[Hur50](https://stats.quantecon.org/zreferences.html#id246)].)\n",
"\n",
"The Hurwicz bias is worse the smaller is the sample (see [[OW69](https://python.quantecon.org/zreferences.html#id245)]).\n",
"The Hurwicz bias is worse the smaller is the sample (see [[OW69](https://stats.quantecon.org/zreferences.html#id245)]).\n",
"\n",
"Be that as it may, here is more information about the posterior."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a2f4febf",
"id": "26d33b69",
"metadata": {
"hide-output": false
},
Expand All @@ -297,7 +297,7 @@
},
{
"cell_type": "markdown",
"id": "f7465ac3",
"id": "a7ce9f80",
"metadata": {},
"source": [
"Now we shall compute a posterior distribution after seeing the same data but instead assuming that $ y_0 $ is drawn from the stationary distribution.\n",
Expand All @@ -314,7 +314,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b629c3d3",
"id": "710865d8",
"metadata": {
"hide-output": false
},
Expand All @@ -340,7 +340,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8be43f79",
"id": "8088ee58",
"metadata": {
"hide-output": false
},
Expand All @@ -355,7 +355,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1139dd10",
"id": "934cd8e9",
"metadata": {
"hide-output": false
},
Expand All @@ -368,7 +368,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b696cc4e",
"id": "0f2c1168",
"metadata": {
"hide-output": false
},
Expand All @@ -382,7 +382,7 @@
},
{
"cell_type": "markdown",
"id": "c4b2d8df",
"id": "3a9587cf",
"metadata": {},
"source": [
"Please note how the posterior for $ \\rho $ has shifted to the right relative to when we conditioned on $ y_0 $ instead of assuming that $ y_0 $ is drawn from the stationary distribution.\n",
Expand All @@ -399,7 +399,7 @@
},
{
"cell_type": "markdown",
"id": "728ea887",
"id": "5d96556a",
"metadata": {},
"source": [
"## Numpyro Implementation"
Expand All @@ -408,7 +408,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "15ad0d76",
"id": "63cacd53",
"metadata": {
"hide-output": false
},
Expand Down Expand Up @@ -444,7 +444,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5c2dc83b",
"id": "40cfa703",
"metadata": {
"hide-output": false
},
Expand All @@ -465,7 +465,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d04c5e88",
"id": "1419c360",
"metadata": {
"hide-output": false
},
Expand All @@ -485,7 +485,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9d6d5ac3",
"id": "4ed4811e",
"metadata": {
"hide-output": false
},
Expand All @@ -497,7 +497,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b365d10f",
"id": "77aeeb71",
"metadata": {
"hide-output": false
},
Expand All @@ -508,7 +508,7 @@
},
{
"cell_type": "markdown",
"id": "1f29a3d6",
"id": "9b3f4fab",
"metadata": {},
"source": [
"Next, we again compute the posterior under the assumption that $ y_0 $ is drawn from the stationary distribution, so that\n",
Expand All @@ -523,7 +523,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "236f75ac",
"id": "3b80f561",
"metadata": {
"hide-output": false
},
Expand All @@ -548,7 +548,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "434a6c10",
"id": "b742a68f",
"metadata": {
"hide-output": false
},
Expand All @@ -568,7 +568,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "04f5d399",
"id": "3e73b71c",
"metadata": {
"hide-output": false
},
Expand All @@ -580,7 +580,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5b948fb9",
"id": "55701c6f",
"metadata": {
"hide-output": false
},
Expand All @@ -591,7 +591,7 @@
},
{
"cell_type": "markdown",
"id": "072e44cf",
"id": "58721193",
"metadata": {},
"source": [
"Look what happened to the posterior!\n",
Expand All @@ -606,7 +606,7 @@
}
],
"metadata": {
"date": 1706493928.679338,
"date": 1706589239.7037954,
"filename": "ar1_bayes.md",
"kernelspec": {
"display_name": "Python",
Expand Down
Loading

0 comments on commit 0c149e1

Please sign in to comment.