Hi, thank you so much as always!
I perfomed a check on the panel simulation commands and I found some potential problem. I computed the life-cycle profile of a variable of interest, say, earnings, using the distribution as
x = AgeConditionalStats.earnings.Mean
Then I simulate a T*N panel with N=50000 and I average out across the individuals,
y = mean(simPanelValues.earnings,2)
For N large enough, x and y should be very close. Unfortunately, this does not seem to be the case for earnings (assets are ok-ish). I show here the results of my check:
Note that the discrepancy between the âsimulationâ and the âdistributionâ tends to disappear for older ages. This suggests that there might be a problem with the initial condition for the simulation. I donât understand why though, because I pass the following initial distribution to both functions, so with N large there should not be any significant difference:
jequaloneDist = zeros([n_a,n_semiz],âgpuArrayâ);
% All agents start with zero assets, 80% are employed (both male and
% female), there is an expansion (good state). lm and lf are statistically
% independent, so that the prob that both m and f are employed is 0.80.8,
% etc.
% jequaloneDist(a,lm,lf,za)
jequaloneDist(1,:,:,1) = [0.80.8,0.80.2;
0.20.8,0.2*0.2];
Please let me know if I am overlooking something
NOTES
(1) I have programmed my own simulation on the cpu and it confirms the life-cycles obtained using the distribution (the cpu code is commented out). This means that the potential problem is in the panel simulation codes.
(2) I have tried also N larger but the results are pretty much the same
(3) Everything in this post refers to main_v3.