approximation

Filename: approximation.py

Authors: Thomas Sargent, John Stachurski

tauchen

Discretizes Gaussian linear AR(1) processes via Tauchen’s method

quantecon.markov.approximation.rouwenhorst(n, ybar, sigma, rho)[source]

Takes as inputs n, p, q, psi. It will then construct a markov chain that estimates an AR(1) process of: \(y_t = \bar{y} + \rho y_{t-1} + \varepsilon_t\) where \(\varepsilon_t\) is i.i.d. normal of mean 0, std dev of sigma

The Rouwenhorst approximation uses the following recursive defintion for approximating a distribution:

\[\begin{split}\theta_2 = \begin{bmatrix} p & 1 - p \\ 1 - q & q \\ \end{bmatrix}\end{split}\]
\[\begin{split}\theta_{n+1} = p \begin{bmatrix} \theta_n & 0 \\ 0 & 0 \\ \end{bmatrix} + (1 - p) \begin{bmatrix} 0 & \theta_n \\ 0 & 0 \\ \end{bmatrix} + q \begin{bmatrix} 0 & 0 \\ \theta_n & 0 \\ \end{bmatrix} + (1 - q) \begin{bmatrix} 0 & 0 \\ 0 & \theta_n \\ \end{bmatrix}\end{split}\]
Parameters:

n : int

The number of points to approximate the distribution

ybar : float

The value \(\bar{y}\) in the process. Note that the mean of this AR(1) process, \(y\), is simply \(\bar{y}/(1 - \rho)\)

sigma : float

The value of the standard deviation of the \(\varepsilon\) process

rho : float

By default this will be 0, but if you are approximating an AR(1) process then this is the autocorrelation across periods

Returns:

mc : MarkovChain

An instance of the MarkovChain class that stores the transition matrix and state values returned by the discretization method

quantecon.markov.approximation.std_norm_cdf[source]
quantecon.markov.approximation.tauchen(rho, sigma_u, m=3, n=7)[source]

Computes a Markov chain associated with a discretized version of the linear Gaussian AR(1) process

\[y_{t+1} = \rho y_t + u_{t+1}\]

using Tauchen’s method. Here \({u_t}\) is an i.i.d. Gaussian process with zero mean.

Parameters:

rho : scalar(float)

The autocorrelation coefficient

sigma_u : scalar(float)

The standard deviation of the random process

m : scalar(int), optional(default=3)

The number of standard deviations to approximate out to

n : scalar(int), optional(default=7)

The number of states to use in the approximation

Returns:

mc : MarkovChain

An instance of the MarkovChain class that stores the transition matrix and state values returned by the discretization method