Skip to content

Commit

Permalink
update pages
Browse files Browse the repository at this point in the history
  • Loading branch information
HumphreyYang committed Dec 14, 2023
1 parent a70b3bc commit fb239cd
Show file tree
Hide file tree
Showing 26 changed files with 969 additions and 969 deletions.
60 changes: 30 additions & 30 deletions _sources/ar1_bayes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "72effc27",
"id": "7c238fee",
"metadata": {},
"source": [
"# Posterior Distributions for AR(1) Parameters\n",
Expand All @@ -13,7 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b67ad1cf",
"id": "b072f409",
"metadata": {
"tags": [
"hide-output"
Expand All @@ -27,7 +27,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "44d43cd1",
"id": "1a27d1d7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -51,7 +51,7 @@
},
{
"cell_type": "markdown",
"id": "26dcb8ab",
"id": "67c9c8bb",
"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 @@ -151,7 +151,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "18801aba",
"id": "e0084bf1",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -179,7 +179,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9b5f16ad",
"id": "901a8651",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -189,7 +189,7 @@
},
{
"cell_type": "markdown",
"id": "0c84f527",
"id": "ed7db8e5",
"metadata": {},
"source": [
"Now we shall use Bayes' law to construct a posterior distribution, conditioning on the initial value of $y_0$.\n",
Expand All @@ -207,7 +207,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "873767a8",
"id": "362a936d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -228,7 +228,7 @@
},
{
"cell_type": "markdown",
"id": "598ac142",
"id": "0fa601db",
"metadata": {},
"source": [
"[pmc.sample](https://www.pymc.io/projects/docs/en/latest/api/generated/pymc.sample.html?highlight=sample#pymc.sample) by default uses the NUTS samplers to generate samples as shown in the below cell:"
Expand All @@ -237,7 +237,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2366312a",
"id": "5a8169bd",
"metadata": {
"tag": [
"hide-output"
Expand All @@ -252,7 +252,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bbc6ada2",
"id": "b1f911df",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -262,7 +262,7 @@
},
{
"cell_type": "markdown",
"id": "b64b836a",
"id": "2c6ea064",
"metadata": {},
"source": [
"Evidently, the posteriors aren't centered on the true values of $.5, 1$ that we used to generate the data.\n",
Expand All @@ -278,7 +278,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c9e03686",
"id": "cf8dcc3d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -290,7 +290,7 @@
},
{
"cell_type": "markdown",
"id": "6f068765",
"id": "0244625b",
"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 @@ -307,7 +307,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6334f7a9",
"id": "7d90d5b5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -331,7 +331,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "99b19051",
"id": "9bf71f8d",
"metadata": {
"tag": [
"hide-output"
Expand All @@ -348,7 +348,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "779abdb1",
"id": "19f883cd",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -359,7 +359,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c947a186",
"id": "41364b04",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -371,7 +371,7 @@
},
{
"cell_type": "markdown",
"id": "fd397fb6",
"id": "4651b1b9",
"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 @@ -393,7 +393,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0302e381",
"id": "5b6b381e",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -427,7 +427,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5ab84088",
"id": "7d467c60",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -446,7 +446,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0e41ae17",
"id": "8719cf0f",
"metadata": {
"tag": [
"hide-output"
Expand All @@ -468,7 +468,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2da58118",
"id": "863457f5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -478,7 +478,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "dc38743f",
"id": "de2060df",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -487,7 +487,7 @@
},
{
"cell_type": "markdown",
"id": "f5068a7b",
"id": "a30d2b08",
"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 @@ -502,7 +502,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5d3d354b",
"id": "b4e4ec6d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -525,7 +525,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "357a39a8",
"id": "5c5477c2",
"metadata": {
"tag": [
"hide-output"
Expand All @@ -547,7 +547,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ff78ade5",
"id": "0e77732c",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -557,7 +557,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2f3d5335",
"id": "36e6dd4b",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -566,7 +566,7 @@
},
{
"cell_type": "markdown",
"id": "c44d7c8c",
"id": "d1b9532a",
"metadata": {},
"source": [
"Look what happened to the posterior!\n",
Expand Down
Loading

0 comments on commit fb239cd

Please sign in to comment.