Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- pip
- pip:
- jupyter-book==1.0.4post1
- quantecon-book-theme==0.13.1
- quantecon-book-theme==0.13.2
- sphinx-tojupyter==0.4.0
- sphinxext-rediraffe==0.2.7
- sphinx-exercise==1.2.0
Expand Down
20 changes: 10 additions & 10 deletions lectures/finite_markov.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ One natural way to answer questions about Markov chains is to simulate them.

(To approximate the probability of event $E$, we can simulate many times and count the fraction of times that $E$ occurs).

Nice functionality for simulating Markov chains exists in [QuantEcon.py](https://quantecon.org/quantecon-py).
Nice functionality for simulating Markov chains exists in [QuantEcon.py](https://quantecon.org/quantecon-py/).

* Efficient, bundled with lots of other useful routines for handling Markov chains.

However, it's also a good exercise to roll our own routines --- let's do that first and then come back to the methods in [QuantEcon.py](https://quantecon.org/quantecon-py).
However, it's also a good exercise to roll our own routines --- let's do that first and then come back to the methods in [QuantEcon.py](https://quantecon.org/quantecon-py/).

In these exercises, we'll take the state space to be $S = 0,\ldots, n-1$.

Expand All @@ -231,7 +231,7 @@ The Markov chain is then constructed as discussed above. To repeat:

To implement this simulation procedure, we need a method for generating draws from a discrete distribution.

For this task, we'll use `random.draw` from [QuantEcon](https://quantecon.org/quantecon-py), which works as follows:
For this task, we'll use `random.draw` from [QuantEcon](https://quantecon.org/quantecon-py/), which works as follows:

```{code-cell} python3
ψ = (0.3, 0.7) # probabilities over {0, 1}
Expand Down Expand Up @@ -294,7 +294,7 @@ always close to 0.25, at least for the `P` matrix above.

### Using QuantEcon's Routines

As discussed above, [QuantEcon.py](https://quantecon.org/quantecon-py) has routines for handling Markov chains, including simulation.
As discussed above, [QuantEcon.py](https://quantecon.org/quantecon-py/) has routines for handling Markov chains, including simulation.

Here's an illustration using the same P as the preceding example

Expand All @@ -306,7 +306,7 @@ X = mc.simulate(ts_length=1_000_000)
np.mean(X == 0)
```

The [QuantEcon.py](https://quantecon.org/quantecon-py) routine is [JIT compiled](https://python-programming.quantecon.org/numba.html#numba-link) and much faster.
The [QuantEcon.py](https://quantecon.org/quantecon-py/) routine is [JIT compiled](https://python-programming.quantecon.org/numba.html#numba-link) and much faster.

```{code-cell} ipython
%time mc_sample_path(P, sample_size=1_000_000) # Our homemade code version
Expand Down Expand Up @@ -556,7 +556,7 @@ $$
It's clear from the graph that this stochastic matrix is irreducible: we can eventually
reach any state from any other state.

We can also test this using [QuantEcon.py](https://quantecon.org/quantecon-py)'s MarkovChain class
We can also test this using [QuantEcon.py](https://quantecon.org/quantecon-py/)'s MarkovChain class

```{code-cell} python3
P = [[0.9, 0.1, 0.0],
Expand Down Expand Up @@ -775,7 +775,7 @@ One option is to regard solving system {eq}`eq:eqpsifixed` as an eigenvector pr
$\psi$ such that $\psi = \psi P$ is a left eigenvector associated
with the unit eigenvalue $\lambda = 1$.

A stable and sophisticated algorithm specialized for stochastic matrices is implemented in [QuantEcon.py](https://quantecon.org/quantecon-py).
A stable and sophisticated algorithm specialized for stochastic matrices is implemented in [QuantEcon.py](https://quantecon.org/quantecon-py/).

This is the one we recommend:

Expand Down Expand Up @@ -1322,7 +1322,7 @@ $$

Tauchen's method {cite}`Tauchen1986` is the most common method for approximating this continuous state process with a finite state Markov chain.

A routine for this already exists in [QuantEcon.py](https://quantecon.org/quantecon-py) but let's write our own version as an exercise.
A routine for this already exists in [QuantEcon.py](https://quantecon.org/quantecon-py/) but let's write our own version as an exercise.

As a first step, we choose

Expand Down Expand Up @@ -1363,13 +1363,13 @@ The exercise is to write a function `approx_markov(rho, sigma_u, m=3, n=7)` that
$\{x_0, \ldots, x_{n-1}\} \subset \mathbb R$ and $n \times n$ matrix
$P$ as described above.

* Even better, write a function that returns an instance of [QuantEcon.py's](https://quantecon.org/quantecon-py) MarkovChain class.
* Even better, write a function that returns an instance of [QuantEcon.py's](https://quantecon.org/quantecon-py/) MarkovChain class.
```

```{solution} fm_ex3
:class: dropdown

A solution from the [QuantEcon.py](https://quantecon.org/quantecon-py) library
A solution from the [QuantEcon.py](https://quantecon.org/quantecon-py/) library
can be found [here](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/markov/approximation.py).

```
Expand Down
6 changes: 3 additions & 3 deletions lectures/kalman.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,11 @@ In this case, for any initial choice of $\Sigma_0$ that is both non-negative and
```{index} single: Kalman Filter; Programming Implementation
```

The class `Kalman` from the [QuantEcon.py](https://quantecon.org/quantecon-py) package implements the Kalman filter
The class `Kalman` from the [QuantEcon.py](https://quantecon.org/quantecon-py/) package implements the Kalman filter

* Instance data consists of:
* the moments $(\hat x_t, \Sigma_t)$ of the current prior.
* An instance of the [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) class from [QuantEcon.py](https://quantecon.org/quantecon-py).
* An instance of the [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) class from [QuantEcon.py](https://quantecon.org/quantecon-py/).

The latter represents a linear state space model of the form

Expand All @@ -530,7 +530,7 @@ $$
Q := CC' \quad \text{and} \quad R := HH'
$$

* The class `Kalman` from the [QuantEcon.py](https://quantecon.org/quantecon-py) package has a number of methods, some that we will wait to use until we study more advanced applications in subsequent lectures.
* The class `Kalman` from the [QuantEcon.py](https://quantecon.org/quantecon-py/) package has a number of methods, some that we will wait to use until we study more advanced applications in subsequent lectures.
* Methods pertinent for this lecture are:
* `prior_to_filtered`, which updates $(\hat x_t, \Sigma_t)$ to $(\hat x_t^F, \Sigma_t^F)$
* `filtered_to_forecast`, which updates the filtering distribution to the predictive distribution -- which becomes the new prior $(\hat x_{t+1}, \Sigma_{t+1})$
Expand Down
2 changes: 1 addition & 1 deletion lectures/linear_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ Weaker sufficient conditions for convergence associate eigenvalues equaling or
## Code

Our preceding simulations and calculations are based on code in
the file [lss.py](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) from the [QuantEcon.py](https://quantecon.org/quantecon-py) package.
the file [lss.py](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) from the [QuantEcon.py](https://quantecon.org/quantecon-py/) package.

The code implements a class for handling linear state space models (simulations, calculating moments, etc.).

Expand Down
2 changes: 1 addition & 1 deletion lectures/lqcontrol.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ for $t = 0, \ldots, T-1$ attains the minimum of {eq}`lq_object` subject to our c
## Implementation

We will use code from [lqcontrol.py](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lqcontrol.py)
in [QuantEcon.py](https://quantecon.org/quantecon-py)
in [QuantEcon.py](https://quantecon.org/quantecon-py/)
to solve finite and infinite horizon linear quadratic control problems.

In the module, the various updating, simulation and fixed point methods
Expand Down
6 changes: 3 additions & 3 deletions lectures/markov_perf.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ This is the approach we adopt in the next section.

### Implementation

We use the function [nnash](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lqnash.py) from [QuantEcon.py](https://quantecon.org/quantecon-py) that computes a Markov perfect equilibrium of the infinite horizon linear-quadratic dynamic game in the manner described above.
We use the function [nnash](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lqnash.py) from [QuantEcon.py](https://quantecon.org/quantecon-py/) that computes a Markov perfect equilibrium of the infinite horizon linear-quadratic dynamic game in the manner described above.

## Application

Expand Down Expand Up @@ -439,7 +439,7 @@ From these, we compute the infinite horizon MPE using the preceding code

Running the code produces the following output.

One way to see that $F_i$ is indeed optimal for firm $i$ taking $F_2$ as given is to use [QuantEcon.py](https://quantecon.org/quantecon-py)'s LQ class.
One way to see that $F_i$ is indeed optimal for firm $i$ taking $F_2$ as given is to use [QuantEcon.py](https://quantecon.org/quantecon-py/)'s LQ class.

In particular, let's take F2 as computed above, plug it into {eq}`eq_mpe_p1p` and {eq}`eq_mpe_p1d` to get firm 1's problem and solve it using LQ.

Expand Down Expand Up @@ -520,7 +520,7 @@ Replicate the {ref}`pair of figures <mpe_vs_monopolist>` showing the comparison

Parameters are as in duopoly_mpe.py and you can use that code to compute MPE policies under duopoly.

The optimal policy in the monopolist case can be computed using [QuantEcon.py](https://quantecon.org/quantecon-py)'s LQ class.
The optimal policy in the monopolist case can be computed using [QuantEcon.py](https://quantecon.org/quantecon-py/)'s LQ class.
```

```{solution-start} mp_ex1
Expand Down
4 changes: 2 additions & 2 deletions lectures/perm_income_cons.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ In this lecture, we'll

* show how the solution to the LQ permanent income model can be obtained using LQ control methods.
* represent the model as a linear state space system as in {doc}`this lecture <linear_models>`.
* apply [QuantEcon](https://quantecon.org/quantecon-py)'s [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) class to characterize statistical features of the consumer's optimal consumption and borrowing plans.
* apply [QuantEcon](https://quantecon.org/quantecon-py/)'s [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) class to characterize statistical features of the consumer's optimal consumption and borrowing plans.

We'll then use these characterizations to construct a simple model of cross-section wealth and
consumption dynamics in the spirit of Truman Bewley {cite}`Bewley86`.
Expand Down Expand Up @@ -204,7 +204,7 @@ $$

Here we solve the same model using {doc}`LQ methods <lqcontrol>` based on dynamic programming.

After confirming that answers produced by the two methods agree, we apply [QuantEcon](https://quantecon.org/quantecon-py)'s [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py)
After confirming that answers produced by the two methods agree, we apply [QuantEcon](https://quantecon.org/quantecon-py/)'s [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py)
class to illustrate features of the model.

Why solve a model in two distinct ways?
Expand Down
2 changes: 1 addition & 1 deletion lectures/rational_expectations.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Let the firm's belief function $H$ be as given in {eq}`ree_hlom2`.

Formulate the firm's problem as a discounted optimal linear regulator problem, being careful to describe all of the objects needed.

Use the class `LQ` from the [QuantEcon.py](https://quantecon.org/quantecon-py) package to solve the firm's problem for the following parameter values:
Use the class `LQ` from the [QuantEcon.py](https://quantecon.org/quantecon-py/) package to solve the firm's problem for the following parameter values:

$$
a_0= 100, a_1= 0.05, \beta = 0.95, \gamma=10, \kappa_0 = 95.5, \kappa_1 = 0.95
Expand Down
4 changes: 2 additions & 2 deletions lectures/samuelson.md
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ plt.show()

## Using the LinearStateSpace class

It turns out that we can use the [QuantEcon.py](https://quantecon.org/quantecon-py)
It turns out that we can use the [QuantEcon.py](https://quantecon.org/quantecon-py/)
[LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) class to do
much of the work that we have done from scratch above.

Expand Down Expand Up @@ -1410,5 +1410,5 @@ in {cite}`Samuelson1939`.
We saw that different parameter values led to different output paths, which
could either be stationary, explosive, or oscillating.

We also were able to represent the model using the [QuantEcon.py](https://quantecon.org/quantecon-py)
We also were able to represent the model using the [QuantEcon.py](https://quantecon.org/quantecon-py/)
[LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py) class.
2 changes: 1 addition & 1 deletion lectures/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ on how to update Anaconda.

Another option is to simply remove Anaconda and reinstall.

You also need to keep the external code libraries, such as [QuantEcon.py](https://quantecon.org/quantecon-py) up to date.
You also need to keep the external code libraries, such as [QuantEcon.py](https://quantecon.org/quantecon-py/) up to date.

For this task you can either

Expand Down
Loading