# Variable gradual response to permanent shock

Hi, I’m doing Shmidt Grohe, Uribe “Open economy macroeconomics” chapter3 code.
I want to give permanent productivity shock.
As Y=A*K, I want output (Y) to increase first because of productivity (A), then later increase because of capital (K). Capital doesn’t respond to shock immediately as K_0 is given. How can I do that ?

Here is the code

``````var
k // capital
y // output
i // investment
c // consumption
ca // current account
d; // external debt

varexo a;

parameters
r //interest rate
alpha ;

r=0.02;
alpha=1;

model;
//1.Budget constraint
c+i+(1+r)*d(-1)=y+d;

//2.investment
i=k-k(-1);

//3.output
y=a*(k^alpha);

//4.consuption
c=c(+1);

//5. capital
k=(r/a(+1))^(1/alpha-1);

//6. current account
ca=d-d(-1);

tb=ca+r*d(-1);
end;

d=0;
k=(r/a)^(1/alpha-1);
y=a*(k^alpha);
i=0;
c=y-i-r*d;
ca=0;
tb=r*d;
end;

initval;
a=1;
end;

endval;
a=2;
end;

perfect_foresight_setup(periods=100);
perfect_foresight_solver;
rplot a;
rplot k;
rplot y;
``````

chapter3.mod (750 Bytes)

1. Your timing and FOC for capital were wrong. Also, alpha needs to be smaller than 1. Use chapter3.mod (766 Bytes)
2. Please do not cross-post. I deleted the other posts with the same issue.

Thank you so much professor, and sorry for overwriting