Why the same linear equations generate different rusults？

hello, professor Pfeifer

I am replicating the model of Gali(2005) ,i simplified your code Gali_Monacelli_2005.mod,but the same linear equations generate different rusults .
Gali2005_1.mod

[code]var
pih x y ynat rnat r s pi p
ph e ystar pistar n nx real_wage a c deprec_rate ;
varexo
eps_star eps_a ;
parameters
sigma eta gamma phi epsilon theta beta alpha
phi_pi rhoa rhoy rho omega sigma_a Theta lambda kappa_a Gamma Psi;

sigma = 1;
eta = 1 ;
gamma = 1;
phi =3;
epsilon = 6;
theta = 0.75;
beta = 0.99;
alpha = 0.4;
phi_pi = 1.5;
rhoa = 0.9;
rhoy = 0.86;
rho = beta^(-1)-1;
omega = sigmagamma+(1-alpha)(sigmaeta-1);
sigma_a =sigma/((1-alpha)+alpha
omega);
Theta=(sigmagamma-1)+(1-alpha)(sigmaeta-1);
lambda = (1-(beta
theta))(1-theta)/theta;
kappa_a =lambda
(sigma_a+phi);
Gamma = (1+phi)/(sigma_a+phi);
Psi = -Theta*sigma_a/(sigma_a+phi);

model(linear);
//1. Equation (37), IS Curve
x = x(+1) - sigma_a^(-1)*(r - pih(+1) - rnat) ;

//2. Equation (36), Philips Curve
pih = beta * pih(+1)+ kappa_a*x;

//3. Equation below (37)
rnat = -sigma_aGamma(1-rhoa)a + alphasigma_a*(Theta+Psi)*(ystar(+1)-ystar);

//4. Equation (35), definition natural level of output
ynat = Gammaa + alphaPsiystar;
//5. Equation above (35), definition output gap
x = y - ynat;
//6. Equation (29)
y = ystar + sigma_a^(-1)s;
//7. Equation (14)
pi = pih + alpha
(s-s(-1));
//8. Equation 15 (first difference)
s = s(-1) + e - e(-1) + pistar - pih;
//9. Constant world inflation, see p.724 (Given constant world prices)
pistar = 0;
//10. Equation (22), employment
y = a + n;
//11. Equation (31), net exports
nx = alpha
(omega/sigma-1)s;
//12. Equation (27), defines consumption
y = c+alpha
omega/sigmas;
//13. Above equation (11), defines real wage
real_wage = sigma
c+phin;
//10-12. Equations on p. 723, stochastic processes
a = rhoa
a(-1) + eps_a;
ystar= rhoy*ystar(-1) + eps_star;
//definition consumer price level
pi = p - p(-1);
//definition domestic price level
pih = ph - ph(-1);
//definition nominal depreciation rate of exchange rate
deprec_rate=e-e(-1);
pih=0;
end;

shocks;
var eps_a = 1;
end;
stoch_simul(order=1,irf=20,irf_plot_threshold=0)pih ;[/code]
the result is correct
but when i change the order of equation 3 Gali2005_2.mod

```//1. Equation (37), IS Curve x = x(+1) - sigma_a^(-1)*(r - pih(+1) - rnat) ; //3. Equation below (37) rnat = -sigma_a*Gamma*(1-rhoa)*a + alpha*sigma_a*(Theta+Psi)*(ystar(+1)-ystar); //2. Equation (36), Philips Curve pih = beta * pih(+1)+ kappa_a*x; //4. Equation (35), definition natural level of output ynat = Gamma*a + alpha*Psi*ystar; //5. Equation above (35), definition output gap x = y - ynat; ```
the irf of pih is strange

[code]oo_.irfs.pih_eps_a’

ans =

1.0e-32 *

``````0.5208
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
``````

[/code]
the irf value of pih should be zero and the policy function is :

``` pih s(-1) 0 p(-1) 0 ph(-1) 0 e(-1) 0 a(-1) 0 ystar(-1) 0 eps_star 0 eps_a 0 ```
Gali2005_2.mod (2.26 KB)
Gali2005_1.mod (2.26 KB)

There is no difference. For all practical purposes the IRF is 0 in both cases. Just look at the scaling of the IRFs. It is 10^-30