Skip to content

Commit 59c6877

Browse files
jstacclaude
andauthored
Link ar1_turningpts to ar1_bayes and improve exposition (#969)
Redone on top of the numpyro/JAX rewrite of ar1_turningpts (#584). - Cross-reference ar1_bayes from ar1_turningpts (overview, model setup, and posterior section) and add a forward {seealso} link back - Frame the posterior computation as the "conditioning assumption" of ar1_bayes, apt here since the path starts from an atypical y_0 - Match the AR(1) model introduction to the bulleted style of ar1_bayes (and write IID rather than i.i.d.) - Add a Conclusion and interpretation for the original/extended Wecker figures, tying back to the two sources of uncertainty Note: N_t is already defined and figures already use MyST captions in the rewritten lecture, so those earlier fixes are no longer needed. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d406800 commit 59c6877

2 files changed

Lines changed: 48 additions & 4 deletions

File tree

lectures/ar1_bayes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,7 @@ A simple rule of thumb:
584584
585585
- use the conditioning assumption when early observations look transient or the starting point may be atypical;
586586
- use the stationary assumption when you are confident the process has been running near its long-run behaviour.
587+
588+
```{seealso}
589+
{doc}`ar1_turningpts` builds on the posterior computed here to forecast nonlinear sample-path statistics of an AR(1) process, such as the time until the next turning point.
590+
```

lectures/ar1_turningpts.md

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ To investigate sample path properties we'll use a simulation procedure recommend
4242

4343
To acknowledge uncertainty about parameters, we'll deploy `numpyro` to construct a Bayesian joint posterior distribution for unknown parameters.
4444

45+
This lecture builds on {doc}`ar1_bayes`, which studies Bayesian inference for the parameters of exactly this AR(1) model in detail.
46+
47+
We recommend reading that lecture first, since here we treat the construction of the posterior more briefly.
48+
4549
Let's start with some imports.
4650

4751
```{code-cell} ipython3
@@ -69,14 +73,16 @@ key = random.PRNGKey(0)
6973

7074
## A Univariate First-Order Autoregressive Process
7175

72-
Consider the univariate AR(1) model:
76+
Consider the univariate AR(1) model, which is the same model studied in {doc}`ar1_bayes`:
7377

7478
$$
7579
y_{t+1} = \rho y_t + \sigma \epsilon_{t+1}, \quad t \geq 0
7680
$$ (ar1-tp-eq1)
7781
78-
where the scalars $\rho$ and $\sigma$ satisfy $|\rho| < 1$ and $\sigma > 0$;
79-
$\{\epsilon_{t+1}\}$ is a sequence of i.i.d. normal random variables with mean $0$ and variance $1$.
82+
where
83+
84+
* the scalars $\rho$ and $\sigma$ satisfy $|\rho| < 1$ and $\sigma > 0$
85+
* $\{\epsilon_{t+1}\}$ is a sequence of IID normal random variables with mean $0$ and variance $1$.
8086
8187
The initial condition $y_{0}$ is a known number.
8288
@@ -447,7 +453,11 @@ $$
447453
448454
The next code cells use `numpyro` to compute the time $t$ posterior distribution of $\rho, \sigma$.
449455
450-
Note that in defining the likelihood function, we choose to condition on the initial value $y_0$.
456+
We construct this posterior just as in {doc}`ar1_bayes`, to which we refer for a detailed discussion.
457+
458+
As there, in defining the likelihood function we condition on the initial value $y_0$.
459+
460+
This is the **conditioning assumption** of {doc}`ar1_bayes`, and it is the appropriate choice here because our initial path starts from an atypical value $y_0 = 10$.
451461
452462
```{code-cell} ipython3
453463
---
@@ -666,6 +676,12 @@ plot_Wecker(ar1, initial_path, ax)
666676
plt.show()
667677
```
668678
679+
Apart from the top-left panel, which repeats the initial path and coverage intervals, each panel shows the predictive distribution of one sample path statistic.
680+
681+
These are computed by simulating many future paths with the parameters held fixed at their true values.
682+
683+
The distributions therefore reflect only the uncertainty that comes from future shocks.
684+
669685
## Extended Wecker Method
670686
671687
Now we apply our "extended" Wecker method based on predictive densities of $y$ defined by
@@ -735,6 +751,10 @@ plot_extended_Wecker(ar1, post_samples, initial_path, ax)
735751
plt.show()
736752
```
737753
754+
The panels show the same statistics, but now each future path is simulated with parameters drawn from the posterior.
755+
756+
These distributions therefore combine two sources of uncertainty: randomness in future shocks and our uncertainty about $(\rho, \sigma)$.
757+
738758
## Comparison
739759
740760
Finally, we plot both the original Wecker method and the extended method with parameter values drawn from the posterior together to compare the differences that emerge from pretending to know parameter values when they are actually uncertain.
@@ -753,3 +773,23 @@ plot_extended_Wecker(ar1, post_samples, initial_path, ax)
753773
ax[0, 1].legend(fontsize=10)
754774
plt.show()
755775
```
776+
777+
The two sets of predictive distributions reveal the cost of pretending that we know the parameters.
778+
779+
The extended Wecker method draws $(\rho, \sigma)$ from their posterior each time it simulates a future path.
780+
781+
It therefore layers parameter uncertainty on top of the shock uncertainty already present in the original method.
782+
783+
As a result, its predictive distributions are more dispersed than those computed with the parameters fixed at their true values.
784+
785+
## Conclusion
786+
787+
This lecture combined two tools to forecast nonlinear functions of the future path of an AR(1) process.
788+
789+
Wecker's simulation method let us approximate predictive distributions of sample path statistics, such as the time until the next turning point.
790+
791+
A Bayesian posterior over $(\rho, \sigma)$, computed as in {doc}`ar1_bayes`, let us also account for our uncertainty about the parameters that govern the process.
792+
793+
Putting these together, the extended Wecker method produces predictive distributions that reflect both sources of uncertainty identified at the outset.
794+
795+
Ignoring parameter uncertainty, as the original Wecker method does, yields tighter distributions that overstate how much we really know about these future statistics.

0 commit comments

Comments
 (0)