GitHub

@@ -36,7 +36,7 @@ These simple models are used again and again in economic research to represent t

3636

* productivity, etc.

37373838

We are going to study AR(1) processes partly because they are useful and

39-

partly because they help us understand important concepts.

39+

partly because they help us understand important concepts.

40404141

Let's start with some imports:

4242

@@ -56,14 +56,14 @@ The **AR(1) model** (autoregressive model of order 1) takes the form

5656

X_{t+1} = a X_t + b + c W_{t+1}

5757

```

585859-

where $a, b, c$ are scalar-valued parameters

59+

where $a, b, c$ are scalar-valued parameters

60606161

(Equation {eq}`can_ar1` is sometimes called a **stochastic difference equation**.)

62626363

```{prf:example}

6464

:label: ar1_ex_ar

656566-

For example, $X_t$ might be

66+

For example, $X_t$ might be

67676868

* the log of labor income for a given household, or

6969

* the log of money demand in a given economy.

@@ -356,9 +356,7 @@ In this equation, we can use observed data to evaluate the left hand side of {eq

356356357357

And we can use a theoretical AR(1) model to calculate the right hand side.

358358359-

If $\frac{1}{m} \sum_{t = 1}^m X_t$ is not close to $\psi^*(x)$, even for many

360-

observations, then our theory seems to be incorrect and we will need to revise

361-

it.

359+

If $\frac{1}{m} \sum_{t = 1}^m h(X_t)$ is not close to $\int h(x)\psi^*(x) dx$, even for many observations, then our theory seems to be incorrect and we will need to revise it.

362360363361364362

## Exercises

@@ -427,8 +425,8 @@ def true_moments_ar1(k):

427425

return 0

428426429427

k_vals = np.arange(6) + 1

430-

sample_moments = np.empty_like(k_vals)

431-

true_moments = np.empty_like(k_vals)

428+

sample_moments = np.empty(len(k_vals), dtype=float)

429+

true_moments = np.empty(len(k_vals), dtype=float)

432430433431

for k_idx, k in enumerate(k_vals):

434432

sample_moments[k_idx] = sample_moments_ar1(k)

@@ -464,8 +462,8 @@ $$

464462

For $K$ use the Gaussian kernel ($K$ is the standard normal

465463

density).

466464467-

Write the class so that the bandwidth defaults to Silvermans rule (see

468-

the rule of thumb discussion on [this

465+

Write the class so that the bandwidth defaults to Silverman's rule (see

466+

the "rule of thumb" discussion on [this

469467

page](https://en.wikipedia.org/wiki/Kernel_density_estimation)). Test

470468

the class you have written by going through the steps

471469

Read the original on github.com ↗