Error variable not allowed inside model declaration

I encountered this error: ERROR: refugee.mod: line 98, cols 11-15: Variable R not allowed inside model declaration. Its scope is only outside model.

I don’t quite understand this problem. I have R as my variable. Its steady state value is a ratio and it is a constant, and I have already included the steady state value of R as my parameter. Could anyone help me out? Thank you very much!

refugee.mod (6.8 KB)

Dear joann,
I found a couple of typos in your code. The first one is that instead of “var”, you wrote “narvar” at the beginning of the code: I think it is a typo, but it could be that I do not know this Dynare command. The second one is line 38 of your code: I think it should be Rss.

I also guess that the model is linearized, so you shoud specify it:
model (linear);

Given that the model is linear, the steady state of the linearized model is a vector of 0: given that you know the steady state you should specify:


instead of initval

The code still does not work because parameter hnss is 0 but it shows up in a denominator in equation 12. I attach the modified code.


refugee.mod (6.8 KB)

Thank you very much Valerio!

I made some relevant changes and the error did not occur anymore. However, I have 4 new errors, as follows:

Error using print_info (line 45)
Blanchard Kahn conditions are not satisfied: indeterminacy

Error in stoch_simul (line 100)
print_info(info, options_.noprint, options_);

Error in trial080520 (line 401)
info = stoch_simul(var_list_);

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

I am a rookie at Dynare, do you mind sharing with me what do these errors mean and what should I focus on to rectify them?

Thank you very much! Appreciate it.

refugee1.mod.mod (6.7 KB)

Try to use the command


after steady;

You will see that:

“There are 5 eigenvalue(s) larger than 1 in modulus
for 6 forward-looking variable(s)
The rank condition ISN’T verified!”

If your model has less eigenvalues than forward looking variables, the model has infinite solutions. Instead, if your model has more eigenvalues than forward looking variables, than the model does not have a stationary solution. In both cases Dynare stops. As proven by Blanchard and Khan in their Econometica paper, you need as much eigenvalues as forward looking variables in order to have a uniqe stationary solution. Bottom line: there is something wrong with the model. Maybe you did some mistake when you linearized it.

Actually, I have noticed that you use the wrong timing for capital. There are many topics in the forum for this issue, give a look at them, in order to understand this problem. To solve it, you should add:

predetermined_variables kn ;

after the var block, so you get the correct number of eigenvalues. But still there is something wrong with the BK conditions.

1 Like

Dear Valerio,

Thank you for the tips! They helped a lot. I made some relevant changes and in order not to complicate things I removed the government sector first. It seems to work, but I was expecting multiple IRFs but instead only 1 popped out, which isn’t useful at all. What should I do? Or is there anything wrong with the model even though the model seemed to be able to run?

Thank you so much for your help!! Appreciate it.

replication.mod (5.9 KB)

Happy to hear that I was helpful!

Dynare shows only the IRFs of those variables whose response is not zero. In your model the shock affects only alphar, which does not show up in any other equation. So why should other variables respond to the shock?

1 Like

I realized that I had made a typo, hence the shock affected only alphar. After correcting it, I have multiple IRFs now. I’m so happy! I thought I would never be able to generate any IRFs. I know I would face more problems as I progress to extend the model but I am elated knowing that I am a step closer to extending to model! Thank you very much Valerio!