lucastree.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:QuantEcon.lectures.code 作者: QuantEcon 项目源码 文件源码
def __init__(self, 
                 ?=2, 
                 ?=0.95, 
                 ?=0.90, 
                 ?=0.1, 
                 grid_size=100):

        self.?, self.?, self.?, self.? = ?, ?, ?, ?

        # == Set the grid interval to contain most of the mass of the
        # stationary distribution of the consumption endowment == #
        ssd = self.? / np.sqrt(1 - self.?**2)
        grid_min, grid_max = np.exp(-4 * ssd), np.exp(4 * ssd)
        self.grid = np.linspace(grid_min, grid_max, grid_size)
        self.grid_size = grid_size

        # == set up distribution for shocks == #
        self.? = lognorm(?)
        self.draws = self.?.rvs(500)

        # == h(y) = ? * int G(y,z)^(1-?) ?(dz) == #
        self.h = np.empty(self.grid_size)
        for i, y in enumerate(self.grid):
            self.h[i] = ? * np.mean((y**? * self.draws)**(1 - ?))



## == Now the functions that act on a Lucas Tree == #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号