Advertisement
Guest User

Untitled

a guest
May 27th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. clear;
  2.  
  3. clc;
  4.  
  5. % To Graph Dr. Lagerlof Figure 5
  6.  
  7. T = 100; % number of periods in simulation
  8.  
  9.  
  10.  
  11. % Setting parameters -- numbers from Table 1 and/or 2
  12.  
  13. gamma = 0.255;
  14.  
  15. cbar = 1; %this is ctilda in GW+Lagerlof
  16.  
  17. tou = 0.15; % From Table 1
  18.  
  19. alpha = 0.6;
  20.  
  21. theta = 1;
  22.  
  23. nstar = 1;
  24.  
  25. % Endogenous variables
  26.  
  27. gstar = 2.362;
  28.  
  29. estar = 0.075;
  30.  
  31. % Computing ro and astar as described in Footnote 13
  32.  
  33. ro=-(gstar+2*estar)/(2*tou) + ( ((gstar+2*estar)/(2*tou))^2 - (estar^2-tou*gstar)/(tou^2) )^.5;
  34.  
  35. astar = gstar/(estar+ro*tou);
  36.  
  37.  
  38. Lhat = ro/(theta*(1-ro)); % See eq. (21)
  39.  
  40. zbar = cbar/(1-gamma); %this is ztilda in GW+Lagerlof
  41.  
  42.  
  43. % Matrices
  44.  
  45. time=zeros(T+1,1);
  46.  
  47. L=zeros(T,1);
  48.  
  49. n=zeros(T,1);
  50.  
  51. A=zeros(T,1);
  52.  
  53. z=zeros(T+1,1);
  54.  
  55. g=zeros(T+1,1);
  56.  
  57. e=zeros(T,1);
  58.  
  59. a=zeros(T,1);
  60.  
  61. gz=zeros(T+1,1);
  62.  
  63. gA=zeros(T+1,1);
  64.  
  65. gn=zeros(T+1,1);
  66.  
  67.  
  68.  
  69. %Initial values; see Table 2
  70.  
  71. L(1,1) = 0.364; % See p. 20
  72.  
  73. A(1,1) = 0.87;
  74.  
  75. e(1,1) = 0;
  76.  
  77. g(1,1) = 0.048;
  78.  
  79. n(1,1) = 1;
  80.  
  81.  
  82.  
  83.  
  84.  
  85. %Dynamic System
  86.  
  87. for i=1:T
  88.  
  89. time(i+1)=i;
  90.  
  91. z(i) = ((e(i)+ro*tou)/(e(i)+ro*tou+g(i)))^alpha*(A(i)/L(i))^(1-alpha);
  92.  
  93. a(i) = min(theta*L(i), astar);
  94.  
  95. g(i+1) = (e(i)+ro*tou)*a(i);
  96.  
  97. e(i+1) = max(0, sqrt(g(i+1)*tou*(1-ro))-ro*tou);
  98.  
  99. if z(i)<zbar
  100.  
  101. n(i) = (1-cbar/z(i))/(tou+e(i+1));
  102.  
  103. else
  104.  
  105. n(i) = gamma/(tou+e(i+1));
  106.  
  107. end
  108.  
  109. L(i+1) = L(i)*n(i);
  110.  
  111. A(i+1) = A(i)*(1+g(i+1));
  112.  
  113. end
  114.  
  115.  
  116.  
  117. for j=1:T
  118.  
  119. % To make rates annual; each period=20 years
  120. gz(j+1) =100*( [1+(z(j+1)-z(j))/z(j)]^(1/20)-1);
  121. gA(j+1) = 100*([1+(A(j+1)-A(j))/A(j)]^(1/20)-1);
  122. gn(j+1) =100*( [n(j)]^(1/20)-1);
  123.  
  124. end
  125.  
  126. % Getting all vectors of same size
  127.  
  128. e=100*e(2:100);
  129. gn=gn(1:99);
  130. gA=gA(2:100);
  131. gz=gz(2:100);
  132. time=time(1:99);
  133.  
  134.  
  135. % Figure
  136.  
  137. plot(time,e,':',time,gn,'-',time,gA,'.-',time,gz,'--');
  138. h2=legend('education ($e_{t}$) times 100','growth rate of $L_{t}$','growth rate of $A_{t}$','growth rate of $z_{t}$');
  139. h3=title('Figure5');
  140. ylim([-.2,8.2]);
  141. xlabel('Period (t)');
  142. set(h2,'Interpreter','latex');
  143. % set(h3,'Interpreter','latex');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement