I have a question regarding the coding for a multi-country model. Suppose I have 4 countries with the following declarations for my countries and variables

@#define countries = “a”, “b”, “c”, “d” ]

@#for co in countries
var w_@{co} c_@{co};

For the model declaration, I would like to include a set of equations that has the following structure:

I had the same problem and couldn’t find anyway to do it in loops,
you can separate independent equations from interrelated ones. do independent ones in loops and bring the rest at the end after your loop.

Nevertheless, I still have a few equations with residues different from zero mainly associated with the international links blocs .

I must confess my lack of knowledge in this matter.
Could someone, please, give me a help or send me some references about the subject. nonlinearomega-2.zip (602 KB)

If all countries are symmetric, you should get the same steady state values for each country. Thus, going from the running two country to the three country version should be straightforward. If this is not the case and you encounter residuals, there must be a mistake in your model equations.

Yes, all countries are symmetric. In my view the problem arises from equations such as the clearing oil market… Actually I put these equations all together at the end of my model bloc, so they are quite easy to identify. I understand, however, that Professors have other things to do than to resolve students’ s problems.
In any case I am sincerely grateful for the reply.

Actually, that’s not completely true. It is the job of professors to help resolve their own students’ problems. So if you have a supervisor, ask him for help. He may have more time for you than I have.

It seens you uploaded the wrong code. It looks like a two country model. One thing that is definitely wrong is the incorrect accounting for parameter dependence. See e.g. [Question about IRFs)