GitHub

@@ -42,6 +42,10 @@ To investigate sample path properties we'll use a simulation procedure recommend

42424343

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

444445+

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.

46504751

```{code-cell} ipython3

@@ -69,14 +73,16 @@ key = random.PRNGKey(0)

69737074

## A Univariate First-Order Autoregressive Process

717572-

Consider the univariate AR(1) model:

76+

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

73777478

$$

7579

y_{t+1} = \rho y_t + \sigma \epsilon_{t+1}, \quad t \geq 0

7680

$$ (ar1-tp-eq1)

778178-

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$.

80868187

The initial condition $y_{0}$ is a known number.

8288

@@ -447,7 +453,11 @@ $$

447453448454

The next code cells use `numpyro` to compute the time $t$ posterior distribution of $\rho, \sigma$.

449455450-

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$.

451461452462

```{code-cell} ipython3

453463

---

@@ -666,6 +676,12 @@ plot_Wecker(ar1, initial_path, ax)

666676

plt.show()

667677

```

668678679+

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

670686671687

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

```

737753754+

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

739759740760

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.

Read the original on github.com ↗