%Macro 202a Homework #2 Solution Anton A Cheremukhin 19 October 2005 clear; %predefined parameters beta=0.97; g=0.018; ro=2; alpha=1/3; gamma=0.5; fi=0.5; lambda=0.95; delta=0.1; sigma=0.006; %new parameters - definitions teta=((((1+g)^(1-fi*(1-ro)))/beta)-(1-delta))/alpha;%%=cap/gdp nu=1-(delta+g)/teta; %=cons/gdp labor=1-1/(1+fi*(1-alpha)/(nu*(1-fi))); %steady state values %cap=(1+(1-(delta+g)/teta)*(1-fi)/(fi*(1-alpha)))/(teta^(1/(1-alpha))); cap=labor/(teta^(1/(1-alpha))); gdp=teta*cap; cons=nu*gdp; %check cons-gdp+(g+delta)*cap beta*(1-delta+alpha*gdp/cap)-(1+g)^(1-fi*(1-ro)) (1-labor)*(1+fi*gdp*(1-alpha)/(cons*(1-fi)))-1 (cap^alpha)*(labor^(1-alpha))-gdp %more parameter definitions phi=alpha*beta*gdp/((1+g)*cap);%=1/(1+((1-delta)*cap)/(alpha*gdp)); omega=fi*(1-ro)-1; a1=labor/(1-labor); pi=(1-fi)*(1-ro)*a1; %check phi-alpha*beta*gdp/((1+g)*cap) %matrices D=[ 0,-phi,-omega,pi,0,phi,omega,-pi; -gdp,(1+g)*cap,cons,0,0,0,0,0; 1,0,0,-(1-alpha),-1,0,0,0; 1,0,-1,-(1+a1),0,0,0,0; 0,0,0,0,1,0,0,0; 1,0,0,0,0,0,0,0; 0,1,0,0,0,0,0,0; 0,0,1,0,0,0,0,0;]; E=[ 0,0,0,0,0,0,0,0; 0,(1-delta)*cap,0,0,0,0,0,0; 0,alpha,0,0,0,0,0,0; 0,0,0,0,0,0,0,0; 0,0,0,0,lambda,0,0,0; 0,0,0,0,0,1,0,0; 0,0,0,0,0,0,1,0; 0,0,0,0,0,0,0,1;]; %use gensys [G2,C2,impact2,fmat,fwt,ywt,gev,eu]=gensys(D,E,zeros(8,1),[0;0;0;0;1;0;0;0],[0,0,0; 0,0,0; 0,0,0; 0,0,0; 0,0,0; 1,0,0; 0,1,0; 0,0,1]) %technology shocks definition N=200; %generate sequence for t=1:N z=sigma*randn(1,N); %z=zeros(1,N); %z(10)=2*sigma; x=zeros(8,N); for i=2:1:N x(:,i)=G2*x(:,(i-1))+impact2*z(i); end for i=1:1:N x(1,i)=gdp*2.71828.^x(1,i); x(2,i)=cap*2.71828.^x(2,i); x(3,i)=cons*2.71828.^x(3,i); x(4,i)=labor*2.71828.^x(4,i); x(5,i)=2.71828.^x(5,i); x(6,i)=gdp*2.71828.^x(6,i); x(7,i)=cons*2.71828.^x(7,i); x(8,i)=labor*2.71828.^x(8,i); end %plot results t=1:1:N; figure(1) subplot(2,3,4); plot(t,x(2,:),'b') legend('capital') subplot(2,3,5); plot(t,x(5,:),'b') legend('technology') subplot(2,3,1); plot(t,x(1,:),'b',t,x(6,:),'r') legend('gdp','exp gdp') subplot(2,3,2); plot(t,x(3,:),'b',t,x(7,:),'r') legend('cons','exp cons') subplot(2,3,3); plot(t,x(4,:),'b',t,x(8,:),'r') legend('labor','exp labor')