You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/ar1_turningpts.md
+62-42Lines changed: 62 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ We consider two sorts of statistics:
40
40
41
41
To investigate sample path properties we'll use a simulation procedure recommended by Wecker {cite}`wecker1979predicting`.
42
42
43
-
To acknowledge uncertainty about parameters, we'll deploy `pymc` to construct a Bayesian joint posterior distribution for unknown parameters.
43
+
To acknowledge uncertainty about parameters, we'll deploy `numpyro` to construct a Bayesian joint posterior distribution for unknown parameters.
44
44
45
45
Let's start with some imports.
46
46
@@ -110,7 +110,7 @@ Predictive distribution {eq}`ar1-tp-eq3` assumes that parameters $(\rho,\sigma)$
110
110
111
111
Predictive distribution {eq}`ar1-tp-eq4` assumes that parameters $(\rho,\sigma)$ are uncertain, but have known probability distribution $\pi_t(\rho,\sigma | y^t )$. Notice the second equality follows that $\{y_t\}$ is a AR(1) process when $(\rho, \sigma)$ are given.
112
112
113
-
We also want to compute some predictive distributions of "sample path statistics" that might include, for example
113
+
We also want to compute some predictive distributions of "sample path statistics" that might include, for example
114
114
115
115
- the time until the next "recession",
116
116
- the minimum value of $Y$ over the next 8 periods,
@@ -152,8 +152,8 @@ class AR1(NamedTuple):
152
152
T1 : int, optional
153
153
Length of the future path to simulate (default is 100).
In the following code, we name this statistic *time until the next recession* to distinguish it from another concept of *turning point*.
357
+
358
+
Moreover, the statistic *time until the next severe recession* is defined in a similar way, except the decline between periods is greater than $0.02$.
359
+
352
360
Wecker {cite}`wecker1979predicting` also studied **the minimum value of $Y$ over the next 8 quarters**
353
361
which can be defined as the random variable.
354
362
@@ -383,8 +391,12 @@ This is designed to express the event
383
391
384
392
- "after one or two decrease(s), $Y$ will grow for two consecutive quarters"
385
393
394
+
The **negative turning point today or tomorrow** $N_t$ is defined in the same way.
395
+
386
396
Following {cite}`wecker1979predicting`, we can use simulations to calculate probabilities of $P_t$ and $N_t$ for each period $t$.
387
397
398
+
However, in the following code, we only use $T_{t+1}(\omega)=1$ to determine $P_t(\omega)$ and $N_t(\omega)$, because we only want to find out the first positive turning point.
399
+
388
400
## A Wecker-Like Algorithm
389
401
390
402
The procedure consists of the following steps:
@@ -404,7 +416,7 @@ $$
404
416
405
417
## Using Simulations to Approximate a Posterior Distribution
406
418
407
-
The next code cells use `pymc` to compute the time $t$ posterior distribution of $\rho, \sigma$.
419
+
The next code cells use `numpyro` to compute the time $t$ posterior distribution of $\rho, \sigma$.
408
420
409
421
Note that in defining the likelihood function, we choose to condition on the initial value $y_0$.
@@ -469,28 +481,30 @@ Our next step is to prepare Python code to compute our sample path statistics.
469
481
470
482
These statistics were originally defined as random variables with respect to $\omega$, but here we use $\{Y_t\}$ as the argument because $\omega$ is implicit.
471
483
472
-
Also, these two kinds of definitions are equivalent because $\omega$ determins path statistics only through $\{Y_t\}$
484
+
These two kinds of definitions are equivalent because $\omega$ determins path statistics only through $\{Y_t\}$.
485
+
486
+
Moreover, we ignore all equality in the definitions, as equality occurs with zero probablity for countinuous random variables.
0 commit comments