Detrend non stationary variables

Hi there, I have a two country DSGE model. There is one equation involving foreign asset, which is nonstationary and increases at a stochastic rate. I am not sure how can I detread this. The equation is:

b_f[t]=(1 + r_f[t])b_f[t-1] + 0.37(EX[t-1] - Q[t-1]) -0.385IM[t-1]

where b_f is foreign asset, r_f is the foreign interest rate which is exogenous. EX, Q and IM are defined as usual. Other equations in the DSGE model are not written here.

All the variables in the system are stationary, except b_f. Apparently, I have to detrend b_f before running dynare. Dose anyone have experience to detrend this?

Any help are highly appreciated.

Yongdeng Xu

Your setup looks strange. Are you sure that your other variables are stationary in this setup? If for example consumption is a function of foreign assets, it will inherit the nonstationarity.

Hi jpfeifer,

Thank you for your reply. Yes, bf is the only non-stationary variables. Consumption is a function of output, EX, IM,K, and government spending. It is a stationary variable.

I am thinking may be I can use an auxiliary variable B[t] = b_f[t] - (1 + r_f[t])b_f[t-1]. And re-write the equation as B[t]= 0.37(EX[t-1] - Q[t-1]) -0.385IM[t-1]. Then all the variables in the model are stationary. Dynare should solve the model. Does it work?


I don’t understand your answer. Net exports are typically a function of net foreign assets. If they are not stationary, so are net exports and consumption and all other variables. What is the mechanism that guarantees that net foreign assets are the only non-stationary variable in the model?

Hi jpfeifer,

Thank you very for your reply. Could you please have a look at my .mod file? I think the problem comes from eq (9) in .mod file.
q[t]=E(q[t+1]) +rf+r.
I’ve tried to multiply the RHS of the above equation by 0.999. Dynare can solve it then. But if I multiply the RHS by any number that is bigger or equal to zero, dynare cannot solve it. I want to keep this equation. Any suggestion to deal with this problem?
Thanks again for your help.

OpenEconomy.mod (3.42 KB)

I cannot stress this enough: you need to understand the economic logic of your model. It will provide an answer to your question. As is, your model does not uniquely determined one of the variables.