Financial accelerator with asset price bubble

I everyone,
I am new with dynare and probably my question is silly, but anyone knows how to write the code for the model of BGG with the asset price bubble they describe in “monetary policy and asset price volatiliy”? I found the code for the BGG baseline model here in the forum, but I attach it for you if you want to try to implement it with the “bubble”. attached you find also the article I cited.

I have tried for many days to modify it but I couldn’t find a solution. could you help me? I am trying to do some exercise with it.

Thanks for your help
BGG.mod (1.92 KB)
monetary_policyBernanke.pdf (311 KB)

I have unsuccessfully tried to write the code of the financial accelerator with asset prices bubbles as BG do in the appendix of the paper I attached last time.
I think that one problem of my code could be the equation of net wealth, in fact they write the evolution of the state variable as a function of
(rs -E_t-1(rs))
How can I write in dynare this expression? I changed it in dynare, but I am not sure it is right.
Can someone help me?
Here you can find the code I wrote.
thanks for your help
BGGEUflpro.mod (1.98 KB)

first of all, in the parameter declaration you need to move delta before the computation of b. Otherwise, it is still initialized at 0 at this point, so that

yields a division by 0. This is the reason why b is NaN when the program stops with an error.
Second, you could have seen this problem, if you would have moved the steady command before the check command.
Third, even after correcting the above error, the Blanchard-Kahn conditions are not fulfilled. So there are still problems.

Regarding the problem with the conditional expectation, have a look at If I understand it correctly, you need an additional variable AUX_EXPECT_1_1 and the lines

AUX_EXPECT_1_1 = rU(-1); nU = Rk*((kn*(rsU - AUX_EXPECT_1_1(-1)) + ((1-tau*Rk)/tau)*yU) + nU(-1));

thanks a lot for your help, it worked…almost.
first of all I tried to use the aux variable, but dynare doesn’t recognize it. So I used the expextation variable and it worked, but after caclulating the steady state values dynare shows the following message:
??? Error using ==> disp_dr>subst_auxvar
Invalid auxiliary type: AUX_EXPECT_LAG_1_11

Error in ==> disp_dr at 101
str1 = subst_auxvar(k1(klag(k,1)),klag(k,2)-M_.maximum_lag-2);

Error in ==> stoch_simul at 68

Error in ==> bgguspro at 252
info = stoch_simul(var_list_);

Error in ==> dynare at 132
evalin(‘base’,fname) ;
What does it means? and why the aux variable doesn’t work? I attach here the file I modified.
thanks a lot again
BGGUSpro.mod (2.02 KB)

I implemented the BG model with asset price bubble, it runs and gives me back stable steady state values, but the results are not satisfying at all as it could be easily seen comparing graphs of may model to the BG’s (in the file attached in previous post).
Why is that? Where is my mistake now?
thanks for your help
BGGUSpro.mod (2.26 KB)


Concerning the expectation auxiliary variable, the wiki page that was mentionned above is obsolete and was misleading. This explains the error that you got.

For the right usage of the EXPECTATION operator, see these pages: (in the section dedicated to the EXPECTATION operator) (idem)