Unrecognized function or variable 'ytot'.

Hi there,

I am trying to replicate Abbritti and Fahr’s 2013 publication, Downward Wage Rigidity and Business Cycle Asymmetries, and I am getting the following error code when I run .mod file in Dynare:

Unrecognized function or variable ‘ytot’.

Error in dwmoments (line 49)
lOUT = lPROD.*ytot;

→ the variable ‘ytot’ is defined as a variable in the ‘var’ block;
→ ytot Inshaa Allahgiven a value in the ‘initval;’ block - it is defined as ytot=Yss; Yss is a parameter and it is defined in the workspace.
→ ytot is defined with an equation based on other defined variables and parameters in the model section

before i get the error term, the steady state results appear in the Command Window, and ytot is indeed= the value of Yss seen in the workspace.
Then when the .mod file calls another file ‘dwmoments.m’ this is where the issue arises. Supposedly, ‘dwmoments.m’ does not recognize the variable ‘ytot’.

For a fuller picture: ytot never appears in the workspace, I am not sure if that is normal or not. Also, when I used the ‘whos’ command in the command window, ytot does not appear at all.

I have spent hours trying to figure out what the problem is, why ‘ytot’ is not recognized… please help!

Many thanks in advance.

Without the files it is hard to tell. Are you using Dynare 6? If yes, you may be missing a


to restore backward compatibility.

Can you please upload the files to run instead of the plain text?

Please find the attached files (this is from the provided code files from Abrritti and Fahr’s 2013 paper, with some of my amendments) : I am now pinpointing another issue.

The model includes 31 endogenous variables, as is seen in M_.endo_nbr, and when simulated for 566 periods, the results appear in oo_.endo_simul. However, in the workspace only 30 of the 31 variables appear with 566 x 1 vector, the variable ‘v’ is appearing as a constant. However, when I check its index position in oo_.endo_simul it appears to have the correct results. It also prints those results in the command window, when I type this command:

v_simulated = oo_.endo_simul(find(strcmp(M_.endo_names, ‘v’)), :);

So it recognizes the variable v, and can print its simulated values, but I don’t know why it keeps appearing in the Workspace as a constant.

I even included this command under the simulation to ensure it would appear as a vector, but no dice.

for idx = 1:M_.endo_nbr
assignin(‘base’, M_.endo_names{idx}, oo_.endo_simul(idx,:)');
if strcmp(M_.endo_names{idx}, ‘v’)

The difference in array sizes is causing issues for the rest of the code.

Help would be highly appreciated!
dw_AF13.mod (7.5 KB)
dwmoments.m (5.1 KB)

You need to provide all necessary files. There are various m-files missing.

Please just upload a zip or rar file with everything contained.

Ok thank you for your response. I will do this in a moment.

ScienceDirect_files_06Jun2024_08-59-06.459.zip (1.2 MB)

Here it is. Again, this is the files provided by the authors as mentioned above, with amendments I made within their .mod file.

The call to stoch_simul was still incorrect:
dwmoments.m (5.1 KB)

Now there is a problem with logging simulated negative values.