Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions EvaluateFnOnAgentDist/EvalFnOnAgentDist_AggVars_Case1_withV.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
N_a=prod(n_a);
N_z=prod(n_z);

% l_daprime=size(Policy,1);
% if simoptions.gridinterplayer==1
% l_daprime=l_daprime-1;
% end
l_daprime=size(Policy,1);
if simoptions.gridinterplayer==1
l_daprime=l_daprime-1;
end


%% Output as structure
Expand All @@ -42,9 +42,9 @@

AggVars=zeros(length(FnsToEvaluate),1,'gpuArray');

PolicyValues=PolicyInd2Val_Case1(Policy,n_d,n_a,n_z,d_grid,a_grid);
PolicyValues=PolicyInd2Val_Case1(Policy,n_d,n_a,n_z,d_grid,a_grid,simoptions);
permuteindexes=[1+(1:1:(l_a+l_z)),1];
PolicyValuesPermute=permute(PolicyValues,permuteindexes); %[n_a,n_s,l_d+l_a]
PolicyValuesPermute=permute(PolicyValues,permuteindexes); %[n_a,n_z,l_d+l_a]

for i=1:length(FnsToEvaluate)
% Includes check for cases in which no parameters are actually required
Expand Down Expand Up @@ -187,12 +187,12 @@
for kk=1:length(CondlRestnFnNames)
% Includes check for cases in which no parameters are actually required
if isempty(CondlRestnFnParamNames(kk).Names) % check for '={}'
CondlRestnFnParamsVec=[];
CondlRestnFnParamsCell={};
else
CondlRestnFnParamsVec=CreateVectorFromParams(Parameters,CondlRestnFnParamNames(kk).Names);
CondlRestnFnParamsCell=CreateCellFromParams(Parameters,CondlRestnFnParamNames(kk).Names);
end

Values=EvalFnOnAgentDist_Grid_Case1(CondlRestnFns{kk}, CondlRestnFnParamsVec,PolicyValuesPermute,n_d,n_a,n_z,a_grid,z_grid,simoptions.parallel);
Values=EvalFnOnAgentDist_Grid(CondlRestnFns{kk}, CondlRestnFnParamsCell,PolicyValuesPermute,l_daprime,n_a,n_z,a_grid,z_grid);
Values=reshape(Values,[N_a*N_z,1]);

RestrictedStationaryDistVec=StationaryDistVec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
[V,Policy]=ValueFnIter_Case1(n_d,n_a,n_z,d_grid,a_grid,z_gridvals, pi_z, ReturnFn, Parameters, DiscountFactorParamNames,ReturnFnParamNames,vfoptions);
%Step 2: Calculate the Steady-state distn (given this price) and use it to assess market clearance
StationaryDist=StationaryDist_Case1(Policy,n_d,n_a,n_z,pi_z,simoptions,Parameters);
AggVars=EvalFnOnAgentDist_AggVars_Case1(StationaryDist, Policy, FnsToEvaluateCell, Parameters, FnsToEvaluateParamNames, n_d, n_a, n_z, d_grid, a_grid, z_gridvals, simoptions);

if isfield(simoptions,'eval_valuefn')
AggVars=EvalFnOnAgentDist_AggVars_Case1(StationaryDist, Policy, FnsToEvaluate, Parameters, FnsToEvaluateParamNames, n_d, n_a, n_z, d_grid, a_grid, z_gridvals, simoptions);
else
AggVars=EvalFnOnAgentDist_AggVars_Case1(StationaryDist, Policy, FnsToEvaluateCell, Parameters, FnsToEvaluateParamNames, n_d, n_a, n_z, d_grid, a_grid, z_gridvals, simoptions);
end

%% Put GE parameters and AggVars in structure, so they can be used for intermediateEqns and GeneralEqmEqns
% already did the basic GE params
Expand Down