-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPdist_iter.m
20 lines (15 loc) · 985 Bytes
/
Pdist_iter.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
% Computes the steady state of Pdist and Pdisteroded
% version 17 april 2008
PdistDIFF=inf; % reset difference of Pdist
Pdistiter=0; % reset counter
while (PdistDIFF>tol && Pdistiter<1500) % iterate to convergence of Pdist
Pdistiter=Pdistiter+1; % increment counter
Pdisteroded = RECURSEMAT*Pdist*TRANSMAT'; % distribution after productivity shock and deflation
if adjtype>5
PdistNew = (1-lambda).*Pdisteroded + logitprobMAT.*(ones(nump,1)*sum(lambda.*Pdisteroded));
else
PdistNew = (1-lambda).*Pdisteroded + Pmatrix(pstar, Pgrid, pstep).*(ones(nump,nump)*(lambda.*Pdisteroded));
end
PdistDIFF=gridsize*max(max(abs(PdistNew-Pdist))); % sup norm normalized by gridsize
Pdist=PdistNew; % updating Pdist
end