Page 1 of 1

Question: Multi-Country-Model

PostPosted: Mon Apr 22, 2013 3:57 pm
by kanimbla
Dear all,

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:

c_a(+1) - c_b(+1)) = c_a - c_b
c_a(+1) - c_c(+1)) = c_a - c_c
c_a(+1) - c_d(+1)) = c_a - c_d

and in addition:

w_b + w_c + w_d = c_a - c_b
w_b + w_c + w_d = c_a - c_c
w_b + w_c + w_d = c_a - c_d


I would be very happy to get a hint how a structure like this can be coded up in Dynare.

Thanks,
kanimbla

Re: Question: Multi-Country-Model

PostPosted: Tue Apr 23, 2013 3:15 pm
by mghazias
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.

Re: Question: Multi-Country-Model

PostPosted: Tue Apr 23, 2013 6:02 pm
by kanimbla
Thanks for your message!

I found a way for the first three equations by defining a second group of countries:

@#define group = [ "b", "c", "d" ]

and then write a loop:

@#for gr in group
c_a(+1) - c_@{gr}(+1)) = c_a - c_@{gr}
@#endfor

Re: Question: Multi-Country-Model

PostPosted: Sun Mar 22, 2015 4:11 pm
by Oriana
Hi,

I am trying to convert a two country model into a three country model. I already can run the former model despite both countries are not in autarky.

The uncovered interest rate parity condition for the two country version is: :

exp(c2lambdaq_pot(+1))/exp(c2lambdaq_pot)*exp(c2rpcpd_pot(+1))/exp(c2rpcpd_pot) =(exp(
c1phibparm*c1b_pot))*exp(c1rer_pot(+1))/exp(c1rer_pot)*exp(c1lambdaq_pot(+1))/exp(c1lambdaq_pot)*exp(c1rpcpd_pot(+1))/exp(c1rpcpd_pot);

So, I supposed that for a third country would be :

exp.(c2lambdaq_pot(+1))/exp(c2lambdaq_pot)*exp(c2rpcpd_pot(+1))/exp(c2rpcpd_pot) =(exp(
c3phibparm*c3b_pot))*exp(c3rer_pot(+1))/exp(c3rer_pot)*exp(c3lambdaq_pot(+1))/exp(c3lambdaq_pot)*exp(c3rpcpd_pot(+1))/exp(c3rpcpd_pot);

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.

Re: Question: Multi-Country-Model

PostPosted: Mon Mar 23, 2015 1:55 pm
by Oriana
I know this is a rather complex issue but I would highly appreciate any help in this matter, please!

Re: Question: Multi-Country-Model

PostPosted: Mon Mar 23, 2015 3:51 pm
by jpfeifer
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.

Re: Question: Multi-Country-Model

PostPosted: Mon Mar 23, 2015 4:19 pm
by Oriana
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.

Re: Question: Multi-Country-Model

PostPosted: Tue Mar 24, 2015 9:32 am
by jpfeifer
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. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5999