|
Project Information
Members
|
Endogenous grip point method for solving discrete-continuous sequential decision problemsGeneric and simple to use Matlab code for solving finite horizon discrete time optimal control problems with one continuous and one discrete control. In essence: endogenous grid point method (eg) + additional discrete decisions (d) + additional state variables (st) Typical application in economics: finite horizon lifecycle models with discrete and continuous choice Reference: Iskhakov, Rust, Schjerning "Extending endogenous grid method for solving discrete-continuous sequential decision problems" Corresponding author: Fedor Iskhakov http://fedor.iskh.ru mailto:fediskhakov@gmail.com Please, let me know if you are using this code! Before using the code make sure you can compile C code with mex command in Matlab Some technical details: Implements a class in Matlab which offers an easy to use model specification language. Methods of the class allow for solution of the model, simulation from the model and graphical representation of the results. Main computing tasks are implemented in C code, and the class provides a translator from the internal model definition language to C, enabling you to solve the model and simulate from it with great speed. Run help egdstmodel for complete description. Model definition example: eship=egdstmodel('eship');
eship.t0=0;
eship.T=40;
eship.s={'no additional states',{0,'dummy state value'}};
eship.trpr={'true',1};
eship.d={'Decision to become enterpreneur (next period)',
{0,'worker',1,'enterpreneur'}};
eship.mmax=10; %max cash-at-hand
eship.ngridm=60; %standard number of grid points in M
eship.ngridmax=100;%max number of grid point in M
eship.nthrhmax=100;%max number of treshold points in TH
eship.ny=10; %number of points in discrete representation of income shocks
eship.a0=-0.5; %credit constraint
eship.choiceset={'defaultallow',true};
eship.feasible={'defaultfeasible',true};
%parameters and coefficients
eship.param={'eta','CRRA coefficient',1.5};
eship.param={'delta','Subjective discount rate, %',7};
eship.param={'R','1+ intrest rate',1.05};
sigma_w=.2; % std. dev. wage chock workers
eship.param={'mu_w','mu workers',(-1/2)*(sigma_w)^2}; % Mean of incomeshok (mean=1)
eship.param={'sigma_w','sigma workers',sigma_w};
sigma_e=.3;
eship.param={'theta','Entrepreneurial ability',.9};
eship.param={'ak','Return to capital',.33};
eship.param={'sigma_e','std. dev. productiivity shock',sigma_e};
eship.param={'mu_e','Mean of incomechok (ensures mean=1)',(-1/2)*(sigma_e)^2};
eship.param={'lambda','Credit constraint parameter',1.5};
eship.param={'entry_cost','Entry cost',0.6};
%utility
eship.u={'utility','pow(consumption,(1-eta))/(1-eta)'};
eship.u={'marginal','pow(consumption,-eta)'};
eship.u={'marginalinverse','pow(mutility,-1/eta)'};
%income for enterpreneurs
eship.eq={'y_e','income for enterpreneurs',
'theta*pow(capital,ak)*shock-(R-1)*capital','next'};
eship.eq={'capital','actual level of capital',
'min(lambda*max(savings,0),kstar)','next'};
eship.eq={'kstar','optimum level of capital',
'pow((theta*ak/(R-1)),(1/(1-ak)))','next'};
%intertemporal budget
eship.budget={'cashinhand','savings*R+(id==0)*shock+(id==1)*y_e'};
eship.budget={'marginal',
'R+((id==1)?R*(max((ak*theta*pow(lambda*savings,(ak-1))*shock-(R-1))*lambda,0)):0.0)'};
eship.discount='1/(1+delta/100)';
eship.shock='lognormal';
eship.shock={'sigma','(id==0)*sigma_w+(id==1)*sigma_e'};
eship.shock={'mu', '(id==0)*mu_w+(id==1)*mu_e'};
%do something
eship.compile
eship.solve
eship.plot1('Optimal consumption by time period','c',1)
%simulate from model and graph simulation results
init=[1 1 0.0];
eship.sim(init)
eship.plot2
eship.plot3Text output from running this model on 2.53GHz single CPU: Writing .c and .h files: Overwriting file modelspec.c Overwriting file modelspec.h Done in 0.053 sec. Compiling checkspecc.c done in 0.324 sec. Compiling egdst_solver.c done in 0.571 sec. Compiling egdst_simulator.c done in 0.349 sec. Running the model solver.. done in 0.36619 sec. Using model.randstream Running 1 model simulation(s).. done in 0.021 sec.
|