 # Simulate and estimate a constant gain learning model

Hello all,

I have tried to simulate, using Dynare, a constant gain learning model outlined in Branch, Evans, McGough (2014) here: https://economics.uoregon.edu/wp-content/uploads/sites/4/2015/07/Branch.pdf

The actual economy behaves according to y_t = \alpha + \beta E_ty_{t+1} + \delta y_{t-1} + \varepsilon_t

In this model, agents estimate y_t = a+ cy_{t-1} + \varepsilon_t

The dynamic system of the economy, with estimated coefficients a_t,c_t is described by the Actual Law of Motion:

y_t = \alpha +\beta c_{t-1}(1+a_{t-1})+(\beta a_{t-1}^2 + \delta)y_{t-1} + \varepsilon_t

The constant gain learning equations are captured by the coefficient vector \theta_t = \begin{bmatrix} a_t \\ c_t \end{bmatrix} = \theta_{t-1} + \gamma R_t^{-1}x_t(y_t-\theta_{t-1}'x_t) \\ R_t = R_{t-1} + \gamma (x_tx_t'-R_{t-1})

I get the following message when I implement the .mod file:

Residuals of the static equations:

Equation number 1 : NaN
Equation number 2 : NaN
Equation number 3 : NaN
Equation number 4 : NaN
Equation number 5 : NaN
Equation number 6 : NaN
Equation number 7 : NaN
Equation number 8 : NaN
Equation number 9 : NaN

Error using print_info (line 90)
The steady state contains NaN or Inf

print_info(info,options_.noprint, options_);

Error in learning2 (line 140)

Error in dynare (line 235)
evalin(‘base’,fname) ;

Branch.pdf (764.3 KB)
learning2.mod (569 Bytes)learning2.log (1.8 KB)

learning2.log (1.8 KB)

Perhaps this will help

You are using 0 as the initial value, but invdet must not be 0

1 Like

Thank you for your prompt response!

I played around with the mod file and have eliminated the et and invdet variables and instead substituted those directly into the equations for the coefficients.

The new output tells me that steady state residuals for the learning coefficients are NaN.

When I choose gamma, the learning parameter, to equal zero then dynare has no problem finding a steady state.

learning2.mod (673 Bytes) learning2.log (118.0 KB)

You need to approach this more systematically. Your model is extremely simply. Please compute the steady state values analytically.

1 Like

Hello again all,

As of now, I encounter very few problems when simulating the model. However, estimation has proven far more difficult. In checking the model, Dynare tells me that there are no eigenvalues with modulus greater than 1, but when estimating that same model it tells me that there the Blanchard-Kahn conditions are not satisfied and that there is no stable equilibrium

data.mat (15.0 KB) learning2.mod (776 Bytes) learning2est.mod (908 Bytes)

The learning2est estimates the model while learning2 only simulates it. I’ve read posts expressing similar problems elsewhere and the advice given was to check the IRFs for a variable that does not return to zero. However, the IRFs show clearly that all variables do return to zero asymptotically.

You can verify in the output of the check command you have a unit root in your model. It seems to affect a. So if you do estimation, you need to use the diffuse_filter option.

1 Like

You just saved my bacon, that was amazing!

How did you know that the unit root affects a?

If you look at the theoretical moments, you can see the NaN for a. This indicates the the moments do not exist, which happens for unit roots.