Ejemplo n.º 1
0
     cohort_scale_array = np.tile(np.reshape(cohort_scale,(Params.total_T+1,1)),(1,Params.sim_pop_size))
     
     # Make base consumer types for each education level
     DropoutType = cstwMPCagent(**Params.init_dropout)
     DropoutType.a_init = a_init
     DropoutType.cohort_scale = cohort_scale_array
     HighschoolType = deepcopy(DropoutType)
     HighschoolType(**Params.adj_highschool)
     CollegeType = deepcopy(DropoutType)
     CollegeType(**Params.adj_college)
     DropoutType.update()
     HighschoolType.update()
     CollegeType.update()
     
     # Make initial distributions of permanent income for each education level
     p_init_base = drawMeanOneLognormal(N=Params.sim_pop_size, sigma=Params.P0_sigma, seed=Params.P0_seed)
     DropoutType.p_init = Params.P0_d*p_init_base
     HighschoolType.p_init = Params.P0_h*p_init_base
     CollegeType.p_init = Params.P0_c*p_init_base
             
     # Set the type list for the lifecycle estimation
     short_type_list = [DropoutType, HighschoolType, CollegeType]
     spec_add = 'LC'       
 
 else:
     # Make the base infinite horizon type and assign income shocks
     InfiniteType = cstwMPCagent(**Params.init_infinite)
     InfiniteType.tolerance = 0.0001
     InfiniteType.a_init = 0*np.ones_like(a_init)
     
     # Make histories of permanent income levels for the infinite horizon type
Ejemplo n.º 2
0
        # Make base consumer types for each education level
        DropoutType = cstwMPCagent(**Params.init_dropout)
        DropoutType.a_init = a_init
        DropoutType.cohort_scale = cohort_scale_array
        HighschoolType = deepcopy(DropoutType)
        HighschoolType(**Params.adj_highschool)
        CollegeType = deepcopy(DropoutType)
        CollegeType(**Params.adj_college)
        DropoutType.update()
        HighschoolType.update()
        CollegeType.update()

        # Make initial distributions of permanent income for each education level
        p_init_base = drawMeanOneLognormal(N=Params.sim_pop_size,
                                           sigma=Params.P0_sigma,
                                           seed=Params.P0_seed)
        DropoutType.p_init = Params.P0_d * p_init_base
        HighschoolType.p_init = Params.P0_h * p_init_base
        CollegeType.p_init = Params.P0_c * p_init_base

        # Set the type list for the lifecycle estimation
        short_type_list = [DropoutType, HighschoolType, CollegeType]
        spec_add = 'LC'

    else:
        # Make the base infinite horizon type and assign income shocks
        InfiniteType = cstwMPCagent(**Params.init_infinite)
        InfiniteType.tolerance = 0.0001
        InfiniteType.a_init = 0 * np.ones_like(a_init)
Ejemplo n.º 3
0
# contained in the HARK folder. Also import ConsumptionSavingModel
import sys 
import os
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('../ConsumptionSaving'))

import numpy as np
import matplotlib.pyplot as plt
from HARKsimulation import drawMeanOneLognormal

N = 10000
T = 10000
PermShkStd = np.sqrt(0.00436)
LivPrb = 0.995
DiePrb = 1 - LivPrb

pLvl_t = np.ones(N)
pLvl_hist = np.ones((T,N))
for t in range(T):
    draws = np.random.rand(N)
    who_dies = draws < DiePrb
    pLvl_t[who_dies] = 1.0
    Shks = drawMeanOneLognormal(N,sigma=PermShkStd,seed=np.random.randint(0,2**31-1))
    pLvl_t = pLvl_t*Shks
    pLvl_hist[t,:] = pLvl_t
    
plt.plot(np.std(pLvl_hist,axis=1))
plt.show()

plt.plot(np.std(np.log(pLvl_hist),axis=1))
plt.show()