"aXtraCount":48, # Number of points in assets grid "aXtraExtra":[None], # Additional points to include in assets grid "exp_nest":3, # Degree of exponential nesting when constructing assets grid "LivPrb":[1.0], # Survival probability "DiscFac":[base_primitives['DiscFac']], # Intertemporal discount factor 'Nagents':1, # Number of agents in a simulation (irrelevant) 'tax_rate':0.0, # Tax rate on labor income (irrelevant) 'vFuncBool':False, # Whether to calculate the value function 'CubicBool':True, # Whether to use cubic splines (False --> linear splines) 'MrkvArray':MrkvArray # State transition probabilities } MarkovType = MarkovConsumerType(**init_consumer_objects) # Make a basic consumer type employed_income_dist = [np.ones(1),np.ones(1),np.ones(1)] # Income distribution when employed unemployed_income_dist = [np.ones(1),np.ones(1),np.zeros(1)] # Income distribution when permanently unemployed MarkovType.IncomeDstn = [[employed_income_dist,unemployed_income_dist]] # set the income distribution in each state MarkovType.MrkvArray = MrkvArray MarkovType.cycles = 0 # Solve the "Markov TBS" model t_start = clock() MarkovType.solve() t_end = clock() MarkovType.unpack_cFunc() print('Solving the same model "the long way" took ' + str(t_end-t_start) + ' seconds.') #plotFuncs([ExampleType.solution[0].cFunc,ExampleType.solution[0].cFunc_U],0,m_upper) plotFuncs(MarkovType.cFunc[0],0,m_upper) diffFunc = lambda m : ExampleType.solution[0].cFunc(m) - MarkovType.cFunc[0][0](m) print('Difference between the (employed) consumption functions:') plotFuncs(diffFunc,0,m_upper)