Hi I wonder how perturbation theory should affect the following:

I have a mod file in which I have written variables in two types are both present in the mod file.

type1.A variable that has been logged. And thus have equation of the form

exp(a)=exp(b)/exp©

type2. A variable that has not been logged. And thus have equation of the form

d=exp(e)/exp(f)

When I run dynare, I find that the first moment[mean] of some of the variables of type2 are NaN. I wonder if it is perturbation theory at work and I should have consistently turned all variables to type1.

The second observation is that , despite dynare not being able to calculate first moment, second moments are calculated and IRFs are successfully plotted in dynare.

No, you can mix logged and not logged variables in perturbation. There must be something else wrong. Provide the files.

Not ready for public view, May I send it privately to your mannheim email address please?

Your model contains several unit roots. This explains the NaN. Some unconditional moments simply do not exist.

Regarding the file you sent me, the loop you wrote is extremely inefficient. Take a look at [Using dynare for a solver for OSR and calibration)

Thank you.

Maybe the 3 unit roots is related to the 3 colinear relations found in model_diagnostics?

May I know how to remove the unit root in my two country model?

Unit roots will always trigger a collinearity. Without knowing the model, it is impossible to tell where they come from.

Can indeterminancy ie multiple solutions exist , cause unit root? Or unit root exclusively means a variable has trend?

Indeterminacy is a feature resulting from a particular solution. A unit root is part of the solution and thus cannot be caused by “indeterminacy”. It could only be the other way round. The unit root means that at least one of your variables has a stochastic trend and will show permanent IRFs that do not go back to 0 even if irf=1000.