# Loop to get welfare

Dear professor jpfeifer,
I am ranking monetary policy rules based on a welfare function in terms of the variance of labor (n_t) using a loop over stoch_simulwelfare1.txt (8.1 KB) :

• [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_); and
*variance.n_t(ii)=oo_.var(n_t_pos,n_t_pos);
The code runs perfectly, although the problem is that when I evaluate a taylor rule, I always with four disserent combinations od parameters, I obtain always the same welfare losses, no matters how I change the values of the parameters.
I technically should obtain different results when the parameters are changed

Dear Alisa,
I do not want to overcome Prof. Pfeifer, but I think a problem in your code could be that your model features several unit roots: you are including among the endogenous variables a variable that is not stationary, the nominal exchange rate. In the model, you should have the growth rate of the nominal exchange rate, not the level of the nominal exchange rate. The same holds also for the CPI index p, that is included in your model in levels, while it should show up only in growth rates.

Valerio

Thanks for your reply, I rewrote the code in terms of inflation and variations in the nominal exchange rate, but if the original code had a unit root, why is dynare able to compute the steady state? (my model is linear)

Suppose that your DSGE model consists only of one equation:

y_t=\rho y_{t-1}+e_t

where y is endogenous and e is exogenous. The IRF function is the following:

E_t \left(y_{t+j}\right) = \rho^j e_t

If \rho>1, the BK conditions are not satisfied, because there is no stable solution: y keeps growing over time and will never stop. If \rho=1, BK conditions are still not satisfied, but y will not grow over time and it will go to a new steady state: I think this is the reason why Dynare gives you the IRF. With regard to the ss, if the model has at least one ss, Dynare can compute it. In your case it is easy, the model is linear and the ss is a vector of 0.

1. A unit root implies that there are infinitely many steady states. You simply selected one of those.
2. Having unit roots is not a problem for simulations. Changing these variables to growth rates will not affect the simulations of any other variable in the model.