Exchange rate peg and level irfs

Dear dynare-users,
In my model Ive got the change of the nominal exchange rate DS_t as an endogenous variable. I define an exchange rate peg as a policy which sets DS_t=1. My question is, how can I retrieve the level of the exchange ratewithout getting an unit root? Wheb I define exp(DS_t)=exp(S_t- S_t-1) I get the unit root problem…
Thanks for the support

I don’t understand your question. If an exchange rate peg is defined as a policy which sets DS_t=1, then the nominal exchange rate S_t will always be at its initial (undefined) value. There cannot be any movements.

Okey admittedly the question was really illposed. Let me try again: My small open economy model works fine, I compare a money supply rule with an exchange rate peg. So far, the equation on foreign bonds was defined as

//5 Foreign bonds exp(lb)*(1+phib*bf)= beta*exp(Rs+ds(+1)+lb(+1)-dps(+1));

with ds(+1) being the change in the nominal exchange rate. As a reader of the paper it is hard to understand, what a positive deviation from steady state of ds means, i.e. does the nominal exchange rate appreciate or depreciate? To this end, I would like to report the IRF not of the change of the nominal exchange rate but of the level, S_level.
Hence I define* ds(+1)=(s_level(+1)-s_level)*. Of course, when the policy sets a peg, then s_level is at its initial value. It would be nice to have that the steady state deviation of s_level in this case is zero, not NaN.

Suppose I replaced ds in all the equations with s_level-s_level(-1), then my system works fine for a pegged regime and I get what I want, but when I use the money supply rule, then I get an unit root, and I am not quite sure where it comes from. I set the steady state of s_level=1, the model is in logs.

Are you talking about simulations or just IRFs at first order?

In many models it is common that the price level is indeterminate due to a unit root. The only thing that is determinate is the change in the price level, i.e. inflation or in your case the change in the exchange rate. Due to the unit root, the unconditional variance does not exist and is not displayed. That being said, the IRFs at first order should still be valid and be displayed. The presence of a unit root is generally not a problem. The only issue is that the steady state for the variable with the unit root cannot be computed endogenously. Rather, there are infinitely many potential steady states. Thus, Dynare will take any initval or steady_state_model value you assign to s_level as the steady state. Hence, setting s_level=1 in initval and adding the definition

should be sufficient to generate IRFs for ds. They should show a permanent shift in the level of the exchange rate. Note the different timing here compared to what you wrote. My version is correct, yours is not.

However at higher order you will run into problems, because there simulations are used and the s_level will move over time and not have a tendency to return to the initial level.

Dear jpfeifer,

thanks for your reply. After some digging in the dynare forum I also encountered that the presence of a unit root perse is not a problem when computing first order approximations. Yet, I decided to back out the series for the nominal exchange rate in a separate m.file. The way I proceed for completeness is as follows:

We have that \hat{\Delta S}t=\log(\Delta S_t)-\log(\bar{\Delta S})=\log(\Delta S_t)-0=\log(S_t/S{t-1})=\log(S_t)-\log(S_{t-1}).
The IRF is given by: \frac{\partial \hat{\Delta S}t}{\partial \epsilon_t}=\frac{\partial\log(S_t)-\log(S{t-1})}{\partial \epsilon_t}, with \frac{\partial \hat{\Delta S}{t-1}}{\partial \epsilon_t}=0, we then have
\frac{\partial \log(S
{t+j}}{\partial \epsilon_t}=\frac{\partial \hat{\Delta S}{t+j}}{\partial \epsilon_t}+\frac{\partial \hat{\Delta S}{t+j-1}}{\partial \epsilon_t}+…+\frac{\partial \hat{\Delta S}{t}}{\partial \epsilon_t}
which is equal to the cumulative sum of \frac{\partial \log(S
{t+j}}{\partial \epsilon_t}

and the code I use is

I hope this helps for future reference.
Philipp