Hello everybody and merry Christmas!

I have a problem with my code. I hope any one of you distinguished scholars could help me.

I am trying to estimate a linear model. This model should be a very simple one because it consists uniquely of linear equations with one exception; exception which is declared as an auxiliary variable.

I keep getting the following preprocessing error:

```
Starting Dynare (version 4.4.3).
Starting preprocessing of the model file .. .
ERROR: ITinCOL.mod: line 110, col 11: syntax error, unexpected '(', expecting COMMA
```

I have seen in other posts with the same problem. Apparently this problem is basically a mistake in the declaration of the blocks, but I donâ€™t see where am I making my mistake.

Could some of you please lend me an eye and check at the code?

It will be very much appreciated.

Yours cordially,

S.T.

PS: The file â€ścoldata.modâ€ť is the database. I can not upload it with its original â€ś.matâ€ť extension.

- There is an
`end;`

missing after ```
estimated_params_init(use_calibration);
```

- The equation

is not linear, because qx contains the variable x and multiplites e.g. y.

Oh Johanes!

You have definitively an excellent eye and an even better mathematical insight!

I appreciate very much your help.

Now I will have to change the equation that defines *qx*. Basically *qx* defines the probability that agents assign to a peg. Do you know how can I specify such probability in Dynare in a way that this system can be estimated with Dynare? (taking into account the linearity of the model, of course. )

I ask you that because I keep having the following error of indeterminacy:

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

In spite of the fact that the rank condition is verified:

[code]There are 4 eigenvalue(s) larger than 1 in modulus

for 4 forward-looking variable(s)

The rank condition is verified.[/code]

I donâ€™t understand.

Yours cordially,

S.T.

Actually, in the Dynare unstable version the program is going to tell if the equations are not linear. Itâ€™s a simple check whether the second derivatives are 0. The question with the probability cannot be answered without a lot of further information, because it is not clear whether this is an endogenous object and which role it plays in your model.

Regarding the error message: have you tried running `model_diagnostics`

?

Hello Johanes!

Again, thank you for your response. You re a very generous person with your knowledge. I appreciate it very much.

Let me explain what the *qx* variable is. This variable, which I use as an auxiliary variable the code (a pounded # variable), defines the probability that agents assign to being in a monetary regime of peg; thus *1-qx* is the probability people assign of being in an inflation targeting regime. This auxiliary variable *qx* (line 37) is an increasing function of the foreign exchange purchases from the central bank. These purchases are defined in the codes as the variable *x* (line 50).

The idea I have in mind is to see if (and in a positive case when) the central bank has conducted foreign exchange policy in the pursue of output growth. I intend to do it by looking at the probability people assign to the pegged interest rate. I will be very happy if I could see the shock decomposition on some variables and identify the periods where the interest rate shocks (the variable *epsiloni* in the code -line 48-) had a significant impact in some variables such as output and inflation. The problem is that I donâ€™t manage to make Dynare to estimate the model.

I have included the *model_diagnostics* block as you proposed me, but (maybe I do not know where to look) I donâ€™t see any difference in Dyaneâ€™s output.

I find very interesting to use the *check* and *resid* blocks because i can see if my eigenvalues and the residuals, which in turn allows me to see which equations may present problems. The problem is that everything seems to be good because i have 4 eigenvalues outside the unit circle for the 4 forward looking variables and all the residuals are zero.

I was thinking that maybe the error Dynare gives me when it tries to estimate the model

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

may come from the fact that the *qx* variable is non-linear, as you very well pointed out. This is the reason why I wanted to see if there is a possible way to define this probability using a linear function of *x*.

What do you think Johanes, does it makes sense? and if so, do you know which formula could I use for this probability?

Yours cordially,

Este

Hello Johannes!

Thank you again for your valuable help!

Your advise of looking for the appropriate starting values solved the problem. I had different starting values on the `estimated_params`

block from the initial values of the parameters. This made fail the rank condition on the estimation but not on the simulation.

Now, I am facing a different problem:

[quote]initial_estimation_checks:: The forecast error variance in the multivariate Kalman filter became singular.

initial_estimation_checks:: This is often a sign of stochastic singularity, but can also sometimes happen by chance

initial_estimation_checks:: for a particular combination of parameters and data realizations.

initial_estimation_checks:: If you think the latter is the case, you should try with different initial values for the estimated parameters.

[/quote]

With the corresponding error:

[quote]Error using initial_estimation_checks (line 143)

initial_estimation_checks:: The forecast error variance in the multivariate Kalman filter became singular.[/quote]

I am attaching the new model file with the data matrix. The data file is in *.mod file but must be transformed to "*.mat" format. The forum does not allows to upload â€ś*.matâ€ť files.

I have made a quick google search for this particular error, but I donâ€™t find any entry about it in the forum. May I be the unlucky one as the error is telling me? : p

I will start to modify the starting values to see if this problem can be solved as the error suggests. Tomorrow I will tell you how did it go. : )

Yours cordially,

Este

This is a fundamental issue with stochastic singularity in your model.Your observables seem to be an exact linear combination in your model, giving rise to the error provided. If you eliminate `k`

from the observables, it works. A common solution to this is to add measurement error, see e.g. Pfeifer(2013): â€śA Guide to Specifying Observation Equations for the Estimation of DSGE Modelsâ€ť sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.

Hello Johannes.

Thank you very much for your response, it was very helpful. Also let me wish you a happy new year and a lot of success for this new year.

I am running now the code without the observable `k`

.

Also, I am running the model in non linear form so the variable `qx`

(which as you may remember is the only non-linear part of the model) can be accounted for.

Nonetheless, I am still intrigued by the fact that the variable `k`

presents problems of collinearity. I donâ€™t know why does it happen, because this variable represents the capital flows and I donâ€™t know how the other variables could be a linear combination of it or vice-versa.

Besides, all the variables are filtered using the HP filter and what remains (I may be wrong) should not have collinearity.

Do you know Johannes why could it happen?

Your guide to Dynare is very complete, I have not fully read it, but for now it have explained me a lot of things.

I will try modifying the observables by including measurement errors and I will keep you posted.

Once more, thank you Johannes and my best wishes.

Yours cordially,

Este

Estimation at

is based on a linearized model so the nonlinearity does not matter. The standard example for the stochastic singularity you encounter is a model with a resource constraint

If you observe all three, you will get stochastic singularity. The reason is that if you observe C and I, you know the value of Y implied by the model. If the observed Y is different, the likelihood assigned by the model to having this value for Y is 0. If you trace which variables are perfectly explained by your observables, you should be able to see that k is perfectly explained.

Hello again Johannes.

Thank you very much for your answer. Quite late for me to say that really, but I think you deserve all thanks from everybody, specially considering the immense favour we are doing to all of us.

Have a nice day Johannes! : )