# Symmetric Countries

Hi all,
I am trying to open up a simple model to a two symmetric country DSGE model.
I am able to run the code but the standard deviation values are different for variables and in some cases, the mean is different as well even if I am assuming that the countries are symmetric. Can someone explain me how to solve that problem when you have two symmetric countries in a model and find that the variables have different mean and/or standard deviation.

Your help will be very appreciated.

Thank you.
simpletwocountry.mod (3.55 KB)

Check you equations. You will see that the found steady state is not symmetric.

OK Thank you very much

Hi can you explain why we might not expect the steady state to be symmetric in this case? I was able to use regular Solve in Matlab for my symmetric two country model, but I took it as an error that my steady state was not symmetric (well, also that all of the values were imaginary). Is this result a consequence of the unit root problem? I have been trying to correct my model equations to avoid issues like that and other causes of indeterminacy, so your advice would be very helpful.

Thank you!

If the model is perfectly symmetric and you do not obtain a symmetric steady state, then either

1. there is a mistake in the model equations so that symmetry does not really hold.
2. the model features more than one steady state, one of them non-symmetric. Often this is a problem for numerical steady state finding. For that reason, I recommend analytical steady state finding.

Thank you for your speedy reply! My model has only 8 variables, but only the interest rates can be defined analytically in steady-state (from Euler), hence I am turning to a nonlinear solver. Using resid before steady suggests that at least one of my variables needs to be determined by an exogenous process, which is not my ideal design, but apparently necessary to get the system a steady state.

What do you mean with

?

I am working in a two-country model with MIU and exogenous endowment income. I have 8 variables (4 per country) and 8 unique, but “interlocked” equations, in the sense that the standard approach of solving for or fixing one variable and then sequentially plugging in to find other steady-state variables is not possible (there’s always 2-3 other endogenous variables that are unfixed in the equations). In other two-country models, for example, BKK, it’s assumed that interest rates are equal. Alternatively, price series are given by some exogenous grid or exchange rates are assumed to be equal each period. I have been scouring the literature for a similar example, but it’s beginning to feel a bit naive to continue to try to solve for all the endogenous steady states this way, unless I can find a really clever way to find the correct initial values.

According to dynare’s diagnostics and output:

Randomize initial guess…
Randomize initial guess…

STEADY: The Jacobian at the initial values contains Inf or NaN. The problem arises from:

Derivative of Equation 3 with respect to Variable c1 (initial value of c1: 20)
Derivative of Equation 3 with respect to Variable p2 (initial value of p2: 50)
Derivative of Equation 3 with respect to Variable m12 (initial value of m12: 0)
Derivative of Equation 3 with respect to Variable m11 (initial value of m11: 50)
Derivative of Equation 3 with respect to Variable r2 (initial value of r2: 0.02)

STEADY: The problem most often occurs, because a variable with
STEADY: exponent smaller than 1 has been initialized to 0. Taking the derivative
STEADY: and evaluating it at the steady state then results in a division by 0.
STEADY: If you are using model-local variables (# operator), check their values as well.

STEADY: numerical initial values or parameters incompatible with the following equations
3
i) if all parameters occurring in these equations are defined
ii) that no division by an endogenous variable initialized to 0 occurs
MODEL_DIAGNOSTICS: The steady state cannot be computed

Residuals of the static equations:

Equation number 1 : 0 : c1
Equation number 2 : 0 : c2
Equation number 3 : NaN : p1
Equation number 4 : 49.9499 : p2
Equation number 5 : 30 : m12
Equation number 6 : 80 : m21
Equation number 7 : 0 : m11
Equation number 8 : -50 : m22
Equation number 9 : -19.98 : r1
Equation number 10 : -9.98 : r2

Randomize initial guess…

Residuals of the static equations:

Equation number 1 : NaN : c1
Equation number 2 : NaN : c2
Equation number 3 : NaN : p1
Equation number 4 : NaN : p2
Equation number 5 : NaN : m12
Equation number 6 : NaN : m21
Equation number 7 : NaN : m11
Equation number 8 : NaN : m22
Equation number 9 : NaN : r1
Equation number 10 : NaN : r2

I am extending Rotemberg and Poterba (1987) to a two-country, two-currency model, so I am pretty sure the algebra behind the system is correct (since it matches the chapter’s). but dynare seems to be able to initially find 9/10…even if the values are not right. That plus the literature makes me think at least one variable cannot be endogenous.

I am still not fully understanding what you mean. Many models have non-unique steady states, i.e. a unit root implies that some things need to exogenously fixed to select one of the steady states (i.e. the exchange rate is 1). In those case, you may have to analytically compute the steady states as the unit root will imply that Dynare cannot compute it endogenously.

Yes, thank you! I read through parts of your online guide and rewrote the model to be in terms of exchange rates and inflation rates. I also changed a few of the model’s equations to make it more tractable.

I have since been able to find a steady state using fsolve, but now I’m getting the following error:

Using 64-bit preprocessor
Starting Dynare (version 4.6.2).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 13 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
terminate called after throwing an instance of ‘std::filesystem::__cxx11::filesystem_error’
what(): filesystem error: cannot create directory [test2]

It seems that dynare isn’t able to find the model’s derivatives. In my model, I have a couple variables that should be evaluated at their levels (debt, interest rates). Is my problem that I need to log-linearize my system before I write it into dynare or does it look like I have a more fundamental problem?

I have attached my mod file here, in case you are able to look at it and get a sense of my error. The model is not fully calibrated (I am just trying to get it to run for now), but as much as I could, I included initial values and parameters that delivered steady-state values via fsolve. I would like to get some results from a kind of toy model before I take it to any data.

Thank you very much! test2.mod (1.4 KB)

The error you posted above is not about the model, but about file access to your harddisk if you run the same file repeatedly. Closing Matlab and reopening it typically helps.

Regarding the steady state: it looks to me as if you are having a unit root (meaning the steady state cannot be endogenously computed) and that some equations are inconsistent.

``````Bj=(1+ri(-1)+sigh*(exp(Bj(-1)-Bjbar)-1))*Bj
``````

suggests that `Bj` should be equal to `Bjbar`, which is 0.

In a nutshell, go the analytical way.

Thank you! The steady-state problem is exactly the problem I keep facing. Analytically, yes, the steady-state values of each Bond (Bi, Bj) are zero and that is what I have been using to test my dynare program most recently. I am using Fsolve in another program to recover the steady-state values of the four M variables. What I think might be one problem I have is the initial value to use for consumption, which falls out of the steady state Euler. Specifying the initial values seems like a common problem–how does one go about identifying such values which solve the global optimum?

I would definitely prefer to take an analytical approach to define the steady-state, but it seems that the four simultaneous money demand functions require a fixed point solution.

The equation for Bj there, ironically, includes an external debt elastic interest rate for country j–which I included specifically as a means to address the unit root/nonstationary problem. The full equation for Bj is:
Bj=(1+ri(-1)+sigh*(exp(Bj(-1)-Bjbar)-1))*Bj(-1)+mjj(-1)+(1/ee(-1))*mji-mjj-(1/ee(-1))*mji;

I have been assuming Bj=0 for simplicity in tests, but the literature seems to suggest that EDEIR interest rates in this form should allow a steady state level of debt that is non-zero.

I have most recently tried a model without shocks (output is constant) to see where the problem equations are. I have defined my inflation variables via the Euler equations, and these seem to be where the problem is–since pi is the only variable related to consumption, I am wondering if this goes back to the way I set my initial values for consumption. Can you recommend a resource to learn about finding the global optimum in this kind of setting? I’m referring to this earlier post: How do solve the initialization problem?

Residuals of the static equations:

Equation number 1 : 0.46052 : ci
Equation number 2 : 0.46052 : cj
Equation number 3 : 0.014585 : pi_i
Equation number 4 : 0.014585 : pi_j
Equation number 5 : -8.1633e-06 : ri
Equation number 6 : 0 : rj
Equation number 7 : 0 : 7
Equation number 8 : 0 : 8
Equation number 9 : 0 : 9
Equation number 10 : 0 : 10
Equation number 11 : 0 : bi
Equation number 12 : 0 : bj
Equation number 13 : 0 : ee

Error using print_info (line 32)
Impossible to find the steady state (the sum of square residuals of the static equations is 0.4246). Either the model doesn’t have a steady state, there are an
infinity of steady states, or the guess values are too far from the solution
test7.mod (1.4 KB)

Thank you for maintaining this forum–I have found it incredibly useful for learning about modeling. Hitting this problem and searching for solutions has made me realize I probably need to explore an alternative second- or third-order approximation approach a la Devereux and Sutherland (2006/2009/2010/2011). If you have any suggestions about resources beyond their papers to learn about incomplete markets/portfolio problems, I would love to hear them. Thank you!