Skip to content

Commit 2311886

Browse files
style: fix 43 issues in additive_functionals
- writing: 43 fixes Rules addressed: - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-008: Remove excessive whitespace between words - qe-writing-001: Use one sentence per paragraph - qe-writing-001: Use one sentence per paragraph - ... and 33 more
1 parent a8a0d8d commit 2311886

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

lectures/additive_functionals.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Asymptotic stationarity and ergodicity are key assumptions needed to make it pos
4343

4444
But there are good ways to model time series that have persistent growth that still enable statistical learning based on a law of large numbers for an asymptotically stationary and ergodic process.
4545

46-
Thus, {cite}`Hansen_2012_Eca` described two classes of time series models that accommodate growth.
46+
Thus, {cite}`Hansen_2012_Eca` described two classes of time series models that accommodate growth.
4747

4848
They are
4949

@@ -65,7 +65,7 @@ We also describe and compute decompositions of additive and multiplicative proce
6565

6666
We describe how to construct, simulate, and interpret these components.
6767

68-
More details about these concepts and algorithms can be found in Hansen {cite}`Hansen_2012_Eca` and Hansen and Sargent {cite}`Hans_Sarg_book`.
68+
More details about these concepts and algorithms can be found in Hansen {cite}`Hansen_2012_Eca` and Hansen and Sargent {cite}`Hans_Sarg_book`.
6969

7070
Let's start with some imports:
7171

@@ -83,10 +83,9 @@ from scipy.stats import norm, lognorm
8383

8484
This lecture focuses on a subclass of these: a scalar process $\{y_t\}_{t=0}^\infty$ whose increments are driven by a Gaussian vector autoregression.
8585

86-
Our special additive functional displays interesting time series behavior while also being easy to construct, simulate, and analyze
87-
by using linear state-space tools.
86+
Our special additive functional displays interesting time series behavior while also being easy to construct, simulate, and analyze by using linear state-space tools.
8887

89-
We construct our additive functional from two pieces, the first of which is a **first-order vector autoregression** (VAR)
88+
We construct our additive functional from two pieces, the first of which is a **first-order vector autoregression** (VAR)
9089

9190
```{math}
9291
:label: old1_additive_functionals
@@ -102,8 +101,7 @@ Here
102101
* $B$ is an $n \times m$ matrix, and
103102
* $x_0 \sim {\cal N}(\mu_0, \Sigma_0)$ is a random initial condition for $x$
104103

105-
The second piece is an equation that expresses increments
106-
of $\{y_t\}_{t=0}^\infty$ as linear functions of
104+
The second piece is an equation that expresses increments of $\{y_t\}_{t=0}^\infty$ as linear functions of
107105

108106
* a scalar constant $\nu$,
109107
* the vector $x_t$, and
@@ -418,14 +416,14 @@ def plot_given_paths(amf, T, ypath, mpath, spath, tpath,
418416
ax[0, 0].set_title("One Path of All Variables")
419417
ax[0, 0].legend(loc="upper left")
420418
421-
# Plot Martingale Component
419+
# Plot martingale component
422420
ax[0, 1].plot(trange, mpath[0, :], "m")
423421
ax[0, 1].plot(trange, mpath.T, alpha=0.45, color="m")
424422
ub = mbounds[1, :]
425423
lb = mbounds[0, :]
426424
427425
ax[0, 1].fill_between(trange, lb, ub, alpha=0.25, color="m")
428-
ax[0, 1].set_title("Martingale Components for Many Paths")
426+
ax[0, 1].set_title("Martingale components for many paths")
429427
ax[0, 1].axhline(horline, color="k", linestyle="-.")
430428
431429
# Plot Stationary Component
@@ -435,12 +433,12 @@ def plot_given_paths(amf, T, ypath, mpath, spath, tpath,
435433
lb = sbounds[0, :]
436434
ax[1, 0].fill_between(trange, lb, ub, alpha=0.25, color="g")
437435
ax[1, 0].axhline(horline, color="k", linestyle="-.")
438-
ax[1, 0].set_title("Stationary Components for Many Paths")
436+
ax[1, 0].set_title("Stationary components for many paths")
439437
440438
# Plot Trend Component
441439
if show_trend:
442440
ax[1, 1].plot(tpath.T, color="r")
443-
ax[1, 1].set_title("Trend Components for Many Paths")
441+
ax[1, 1].set_title("Trend components for many paths")
444442
ax[1, 1].axhline(horline, color="k", linestyle="-.")
445443
446444
return fig
@@ -714,16 +712,14 @@ Notice the irregular but persistent growth in $y_t$.
714712

715713
### Decomposition
716714

717-
Hansen and Sargent {cite}`Hans_Sarg_book` describe how to construct a decomposition of
718-
an additive functional into four parts:
715+
Hansen and Sargent {cite}`Hans_Sarg_book` describe how to construct a decomposition of an additive functional into four parts:
719716

720717
- a constant inherited from initial values $x_0$ and $y_0$
721718
- a linear trend
722719
- a martingale
723720
- an (asymptotically) stationary component
724721

725-
To attain this decomposition for the particular class of additive
726-
functionals defined by {eq}`old1_additive_functionals` and {eq}`old2_additive_functionals`, we first construct the matrices
722+
To attain this decomposition for the particular class of additive functionals defined by {eq}`old1_additive_functionals` and {eq}`old2_additive_functionals`, we first construct the matrices
727723

728724
$$
729725
\begin{aligned}
@@ -759,8 +755,7 @@ A convenient way to do this is to construct an appropriate instance of a [linear
759755

760756
This will allow us to use the routines in [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) to study dynamics.
761757

762-
To start, observe that, under the dynamics in {eq}`old1_additive_functionals` and {eq}`old2_additive_functionals` and with the
763-
definitions just given,
758+
To start, observe that, under the dynamics in {eq}`old1_additive_functionals` and {eq}`old2_additive_functionals` and with the definitions just given,
764759

765760
$$
766761
\begin{bmatrix}
@@ -1126,7 +1121,7 @@ def simulate_paths(amf, T=150, I=5000):
11261121
return storeX, storeY
11271122
11281123
def population_means(amf, T=150):
1129-
# Allocate Space
1124+
# Allocate space
11301125
xmean = np.empty(T)
11311126
ymean = np.empty(T)
11321127
@@ -1173,10 +1168,10 @@ amc, mmc = simulate_martingale_components(amf_2, 1000, 5000)
11731168
amcT = amc[:, -1]
11741169
mmcT = mmc[:, -1]
11751170
1176-
print("The (min, mean, max) of additive Martingale component in period T is")
1171+
print("The (min, mean, max) of additive martingale component in period T is")
11771172
print(f"\t ({np.min(amcT)}, {np.mean(amcT)}, {np.max(amcT)})")
11781173
1179-
print("The (min, mean, max) of multiplicative Martingale component \
1174+
print("The (min, mean, max) of multiplicative martingale component \
11801175
in period T is")
11811176
print(f"\t ({np.min(mmcT)}, {np.mean(mmcT)}, {np.max(mmcT)})")
11821177
```

0 commit comments

Comments
 (0)