Adding a variable to model, other theoretical moments change

Dear all,

I’m coming across a somewhat strange occurrence. See attached two mod files, where the only difference between the two models is the addition of a single variable, shwVFF, which is in test1.mod but not test2.mod. test1.mod (13.7 KB)
test2.mod (13.5 KB)

The new variable does not change any of the other equations — it is simply a statistic calculated from the other variables.

And yet, the addition of this new variable slightly changes the theoretical moments of the model. For example, running the following code:

dynare test1

stat1 = num2str(oo_.mean(strmatch(‘R’,M_.endo_names,‘exact’)),’%04.25f’)

dynare test2

stat2 = num2str(oo_.mean(strmatch(‘R’,M_.endo_names,‘exact’)),’%04.25f’)

My output is as follows:
stat1 =

'1.0057634351836060027096664'

stat2

stat2 =

'1.0057634351837181352351536'

It may seem like no big deal as the theoretical moments are quite close – but this causes other issues for me. I am using SMM to calibrate some parameters of a macro model, using moments from Dynare. These slight differences, combined with the flatness of my SMM objective function, means that I get slightly different estimation results from the two different mod files.

My MATLAB version is R2019b, using MacOS Catalina. Dynare version is 4.5.0.

Anyone have any clues to what is going on? Many thanks in advance,

Jake

Jake

Numerical computations on the computer do not have arbitrary precision. In your case, the difference is in the 13th digit. Such differences are expected if e.g. the dimensions of matrices to be inverted change.

Yes, this was my suspicion as well. Thank you for your response.