Good afternoon
First of all, thanks @robertdkirkby for having developed the toolkit and having made it publicly available!
I am writing here because I’ve had some problems working with the toolkit. For an undergraduate project, I’m trying to replicate the model used in Castaneda et al. (2003) and calibrate it on the Italian economy. I, therefore, found very useful the replication of the paper you have made available. However, I don’t have access to a machine that can run MATLAB with a GPU. I changed the options in order to make the code compatible with a CPU and eliminated any instance in which an array would have been stored on GPU.
When I try to run the code, however, I get an error. This happens both for my modified version for Italy and the original replication code. Below I have copied the error message I receive. Moreover, in this GoogleDrive folder, there are the codes I’m using for both the Italian model and for running Castaneda on CPU. Do you know what could be wrong, and how I could get the model to work?
Thank you in advance!
Andrea
https://drive.google.com/drive/folders/10_NXMBkSV3nnozl9gOFt8xNN7A1Yl0Zz?usp=sharing
Not enough input arguments.
Error in
CPU_Italy_Model>@(d1_val,d2_val,a_val,z_val,r,sigma1,sigma2,chi,elle,theta,delta,e1,e2,e3,e4,e5,omega,a0,a1,a2,a3)CPU_Italy_Model_ReturnFn(d1_val,d2_val,a_val,z_val,r,sigma1,sigma2,chi,elle,theta,delta,e1,e2,e3,e4,e5,omega,a0,a1,a2,a3)
(line 194)
ReturnFn=@(d1_val, d2_val, a_val, z_val,r,sigma1,sigma2,chi,elle,theta,delta,e1,e2,e3,e4,e5,omega,a0,a1,a2,a3)
CPU_Italy_Model_ReturnFn(d1_val, d2_val, a_val, z_val,r,sigma1,sigma2,chi,elle,theta,delta,e1,e2,e3,e4,e5,omega,a0,a1,a2,a3);
Error in CreateReturnFnMatrix_Case2_Disc (line 58)
-
Fmatrix(i1,i2,i3)=ReturnFn(d_gridvals(i1,:),a_gridvals(i2,:),z_gridvals(i3,:));*
Error in ValueFnIter_Case2 (line 126)
-
ReturnMatrix=CreateReturnFnMatrix_Case2_Disc(ReturnFn, n_d, n_a, n_z, d_grid, a_grid, z_grid, vfoptions.parallel);*
Error in HeteroAgentStationaryEqm_Case2_subfn (line 12)
[~, Policy]=ValueFnIter_Case2(V0Kron, n_d, n_a, n_s, d_grid, a_grid, s_grid, pi_s, Phi_aprimeKron, Case2_Type, ReturnFn, Parameters,
DiscountFactorParamNames, ReturnFnParamNames, PhiaprimeParamNames, vfoptions);
Error in
HeteroAgentStationaryEqm_Case2>@§HeteroAgentStationaryEqm_Case2_subfn(p,V0Kron,n_d,n_a,n_s,pi_s,d_grid,a_grid,s_grid,Phi_aprimeKron,Case2_Type,ReturnFn,FnsToEvaluate,GeneralEqmEqns,Parameters,DiscountFactorParamNames,ReturnFnParamNames,PhiaprimeParamNames,FnsToEvaluateParamNames,GeneralEqmEqnParamNames,GEPriceParamNames,heteroagentoptions,simoptions,vfoptions)
(line 69)
GeneralEqmConditionsFn=@§ HeteroAgentStationaryEqm_Case2_subfn(p, V0Kron, n_d, n_a, n_s, pi_s, d_grid, a_grid, s_grid, Phi_aprimeKron,
Case2_Type, ReturnFn, FnsToEvaluate, GeneralEqmEqns, Parameters, DiscountFactorParamNames, ReturnFnParamNames, PhiaprimeParamNames,
FnsToEvaluateParamNames, GeneralEqmEqnParamNames, GEPriceParamNames,heteroagentoptions, simoptions, vfoptions)
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in HeteroAgentStationaryEqm_Case2 (line 80)
- [p_eqm,GeneralEqmConditions]=fminsearch(GeneralEqmConditionsFn,p0);*
Error in CPU_Italy_Model (line 250) - [p_eqm,p_eqm_index,MarketClearance]=HeteroAgentStationaryEqm_Case2(V0, n_d, n_a, n_z, 0, pi_z, d_grid, a_grid, z_grid,Phi_aprimeMatrix,*
- Case2_Type, ReturnFn, FnsToEvaluate, GeneralEqmEqns, Params, DiscountFactorParamNames, ReturnFnParamNames, PhiaprimeParamNames,*
- FnsToEvaluateParamNames, GeneralEqmEqnParamNames, GEPriceParamNames,heteroagentoptions, simoptions, vfoptions);*
Error in run (line 91)
evalin(‘caller’, strcat(script, ‘;’));