Error message that says a variable R has been declared twice

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Error message that says a variable R has been declared twice

Postby tanvintyl5 » Sun May 08, 2016 8:03 pm

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.
Attachments
CS.mod
The code
(3.47 KiB) Downloaded 134 times
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby modin » Sun May 08, 2016 10:22 pm

Just had a brief look but it looks like you have declared R both as an endogenous variable and a parameter.

//modin
modin
 
Posts: 9
Joined: Fri Mar 18, 2016 1:13 pm

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

Postby tanvintyl5 » Mon May 09, 2016 9:18 am

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.
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby jpfeifer » Mon May 09, 2016 9:33 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

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

Postby tanvintyl5 » Mon May 09, 2016 9:41 am

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
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby jpfeifer » Mon May 09, 2016 9:48 am

Then that definition goes into the model as an equation and both R and r_hat are variables.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

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

Postby tanvintyl5 » Mon May 09, 2016 10:19 am

I have already tried that. I still gives the same error for some weird reason.
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby jpfeifer » Mon May 09, 2016 12:44 pm

That means you have still defined R as a parameter and a variable. Delete it from the list of parameters.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

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

Postby tanvintyl5 » Mon May 09, 2016 4:42 pm

I already deleted it. I updated the code.
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby jpfeifer » Tue May 10, 2016 9:01 am

No, you did not:
% Parameters:
parameters s_c ... sigma_tilda R rho_pi n_ch sigma_c sigma_h n_hc alpha;
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

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

Postby tanvintyl5 » Wed May 11, 2016 1:38 pm

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?
Attachments
KS.m
(3.68 KiB) Downloaded 121 times
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby HoutanBastani » Fri May 13, 2016 2:30 pm

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.
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France

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

Postby tanvintyl5 » Sat May 14, 2016 6:52 pm

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.
Attachments
KS.mod
(3.7 KiB) Downloaded 116 times
tanvintyl5
 
Posts: 10
Joined: Fri Feb 26, 2016 7:14 pm

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

Postby jpfeifer » Sun May 15, 2016 9:46 am

Never put statements like
Code: Select all
clear all

or
Code: Select all
clearvars

into a mod-file
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 14 guests