Page 1 of 1

Error message that says a variable R has been declared twice

PostPosted: Sun May 08, 2016 8:03 pm
by tanvintyl5
My code displays this:

Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.4.3).
Starting preprocessing of the model file ...
ERROR: CS.mod: line 55, cols 12-129: Symbol R declared twice with different types!

Error using dynare (line 174)
DYNARE: preprocessing failed

I tried a bunch of things but I do not know what I am doing wrong.

Re: Error message that says a variable R has been declared t

PostPosted: Sun May 08, 2016 10:22 pm
by modin
Just had a brief look but it looks like you have declared R both as an endogenous variable and a parameter.

//modin

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 9:18 am
by tanvintyl5
It would be wrong to have R and R_hat as endogenous variable also (at the same time), right? So I have to eliminate either of them or is there a solution where I can keep both in my program.

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 9:33 am
by jpfeifer
It's unusual, but you did not tell use what R and R_hat are and what you are trying to achieve. So it is hard to tell what is going on.

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 9:41 am
by tanvintyl5
Oh I am sorry, I forgot to mention that. R_hat is the deviation of R from it's steady state.

So r_hat = (R-R_ss)/R_ss

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 9:48 am
by jpfeifer
Then that definition goes into the model as an equation and both R and r_hat are variables.

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 10:19 am
by tanvintyl5
I have already tried that. I still gives the same error for some weird reason.

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 12:44 pm
by jpfeifer
That means you have still defined R as a parameter and a variable. Delete it from the list of parameters.

Re: Error message that says a variable R has been declared t

PostPosted: Mon May 09, 2016 4:42 pm
by tanvintyl5
I already deleted it. I updated the code.

Re: Error message that says a variable R has been declared t

PostPosted: Tue May 10, 2016 9:01 am
by jpfeifer
No, you did not:
% Parameters:
parameters s_c ... sigma_tilda R rho_pi n_ch sigma_c sigma_h n_hc alpha;

Re: Error message that says a variable R has been declared t

PostPosted: Wed May 11, 2016 1:38 pm
by tanvintyl5
I am sorry I sent you the old file. I changed everything and tried to run it but now it gives me some other error which isn't related to my code. Can anyone interpret it?

Re: Error message that says a variable R has been declared t

PostPosted: Fri May 13, 2016 2:30 pm
by HoutanBastani
The error I get when running dynare KS.mod is:
Code: Select all
ERROR: KS.mod: line 122, col 35: Unknown symbol: m
The message is rather clear: On line 122, column 35 the variable m is encountered yet it is unknown to the preprocessor. You must declare this variable first.

Re: Error message that says a variable R has been declared t

PostPosted: Sat May 14, 2016 6:52 pm
by tanvintyl5
This is what Matlab gives me:

Reference to non-existent field 'exo_nbr'.

Error in KS (line 322)

if M_.exo_nbr > 0;

Error in dynare (line 180)

evalin('base',fname) ;

Thanks in advance.

Re: Error message that says a variable R has been declared t

PostPosted: Sun May 15, 2016 9:46 am
by jpfeifer
Never put statements like
Code: Select all
clear all

or
Code: Select all
clearvars

into a mod-file