GitHub

@@ -339,7 +339,7 @@ We define a class that will store parameters, grids and transition

339339

probabilities.

340340341341

```{code-cell} python

342-

class Arellano_Economy:

342+

class ArellanoEconomy:

343343

" Stores data and creates primitives for the Arellano economy. "

344344345345

def __init__(self,

@@ -496,20 +496,20 @@ def update_values_and_prices(v_c, v_d, # Current guess of value functions

496496

return new_v_c, new_v_d

497497

```

498498499-

We can now write a function that will use the `Arellano_Economy` class and the

499+

We can now write a function that will use the `ArellanoEconomy` class and the

500500

functions defined above to compute the solution to our model.

501501502502

We do not need to JIT compile this function since it only consists of outer

503503

loops (and JIT compiling makes almost zero difference).

504504505505

In fact, one of the jobs of this function is to take an instance of

506-

`Arellano_Economy`, which is hard for the JIT compiler to handle, and strip it

506+

`ArellanoEconomy`, which is hard for the JIT compiler to handle, and strip it

507507

down to more basic objects, which are then passed out to jitted functions.

508508509509

```{code-cell} python

510510

def solve(model, tol=1e-8, max_iter=10_000):

511511

"""

512-

Given an instance of Arellano_Economy, this function computes the optimal

512+

Given an instance of ArellanoEconomy, this function computes the optimal

513513

policy and value functions.

514514

"""

515515

# Unpack

@@ -551,7 +551,7 @@ def simulate(model, T, v_c, v_d, q, B_star, y_idx=None, B_idx=None):

551551

"""

552552

Simulates the Arellano 2008 model of sovereign debt

553553554-

Here `model` is an instance of `Arellano_Economy` and `T` is the length of

554+

Here `model` is an instance of `ArellanoEconomy` and `T` is the length of

555555

the simulation. Endogenous objects `v_c`, `v_d`, `q` and `B_star` are

556556

assumed to come from a solution to `model`.

557557

@@ -562,9 +562,9 @@ def simulate(model, T, v_c, v_d, q, B_star, y_idx=None, B_idx=None):

562562

B_grid, y_grid, P = model.B_grid, model.y_grid, model.P

563563564564

# Set initial conditions to middle of grids

565-

if y_idx == None:

565+

if y_idx is None:

566566

y_idx = np.searchsorted(y_grid, y_grid.mean())

567-

if B_idx == None:

567+

if B_idx is None:

568568

B_idx = B0_idx

569569

in_default = False

570570

@@ -616,7 +616,7 @@ Let's start by trying to replicate the results obtained in

616616617617

In what follows, all results are computed using Arellano's parameter values.

618618619-

The values can be seen in the `__init__` method of the `Arellano_Economy`

619+

The values can be seen in the `__init__` method of the `ArellanoEconomy`

620620

shown above.

621621622622

For example, `r=0.017` matches the average quarterly rate on a 5 year US treasury over the period 1983--2001.

@@ -686,7 +686,7 @@ Periods of relative stability are followed by sharp spikes in the discount rate

686686687687

To the extent that you can, replicate the figures shown above

688688689-

* Use the parameter values listed as defaults in `Arellano_Economy`.

689+

* Use the parameter values listed as defaults in `ArellanoEconomy`.

690690

* The time series will of course vary depending on the shock draws.

691691692692

```{exercise-end}

@@ -699,7 +699,7 @@ To the extent that you can, replicate the figures shown above

699699

Compute the value function, policy and equilibrium prices

700700701701

```{code-cell} python

702-

ae = Arellano_Economy()

702+

ae = ArellanoEconomy()

703703

```

704704705705

```{code-cell} python

Read the original on github.com ↗