"""

import numpy as np
from numpy import array
import lqramsey

# == Parameters == #
beta = 1 / 1.05
rho, mg = .7, .35
A = np.identity(2)
A[0, :] = rho, mg * (1 - rho)
C = np.zeros((2, 1))
C[0, 0] = np.sqrt(1 - rho**2) * mg / 10
Sg = array((1, 0)).reshape(1, 2)
Sd = array((0, 0)).reshape(1, 2)
Sb = array((0, 2.135)).reshape(1, 2)
Ss = array((0, 0)).reshape(1, 2)

economy = lqramsey.Economy(beta=beta,
                           Sg=Sg,
                           Sd=Sd,
                           Sb=Sb,
                           Ss=Ss,
                           discrete=False,
                           proc=(A, C))

T = 50
path = lqramsey.compute_paths(T, economy)
lqramsey.gen_fig_1(path)
示例#2
0
import lqramsey

# == Parameters == #
beta = 1 / 1.05
P = array([[0.8, 0.2, 0.0],
           [0.0, 0.5, 0.5],
           [0.0, 0.0, 1.0]])
# == Possible states of the world == #
# Each column is a state of the world. The rows are [g d b s 1]
x_vals = array([[0.5, 0.5, 0.25],
                [0.0, 0.0, 0.0],
                [2.2, 2.2, 2.2],
                [0.0, 0.0, 0.0],
                [1.0, 1.0, 1.0]])
Sg = array((1, 0, 0, 0, 0)).reshape(1, 5)
Sd = array((0, 1, 0, 0, 0)).reshape(1, 5)
Sb = array((0, 0, 1, 0, 0)).reshape(1, 5)
Ss = array((0, 0, 0, 1, 0)).reshape(1, 5)

economy = lqramsey.Economy(beta=beta,
                           Sg=Sg,
                           Sd=Sd,
                           Sb=Sb,
                           Ss=Ss,
                           discrete=True,
                           proc=(P, x_vals))

T = 15
path = lqramsey.compute_paths(T, economy)
lqramsey.gen_fig_1(path)