Page 1 of 1

by group statistics? - excluding a country

Posted: Mon Aug 04, 2014 1:44 pm
by questionmaster
Hello forum users,
I use EViews 7 and have a question regarding the by group statistics. I want to compute a panel regression. You see the mentioned part of the regression in the following form:

ln FDI_i_jt = α1 ln FDI_other_jt + ……

E.g FDI_i_jt is the inward FDI from i=USA to j=Germany. Now I need the sum of all other FDI (except USA) to Germany for each year, because I expect that other FDI to Germany have a negative impact on the FDI from USA to Germany.

That means i need a series which gives me the sum of FDI from every country (except country i) to country j for each year.
I tried it with the by group statistics, but the only thing I got was to get the sum of FDI of all countries to country j for the aggregated years with the following command:

series fdi_other = @sumsby(fdi_stock, ctr_o)

Does anybody know how I could exclude a country embedded in a for-loop or sth like that?
Thanks in advance!

Re: by group statistics? - excluding a country

Posted: Mon Aug 04, 2014 7:08 pm
by EViews Glenn
I want to make certain that I understand the question completely. You have a dated (annual) panel where origin-destination is the cross-section identifier. This identifier variable is coded in CTR_O2CTR_D. The variable CTR_O to which you refer in your post is the first part of CTR_O2CTR_D, and denotes the country of origin. I assume that this series once existed in the workfile, as did CTR_D which was used to create the last part of the identifier, though neither are there now.

What you want, i\if I understand correctly, is for each observation to aggregate all of the values to the specified destination in that year, save for the values from the origin associated with that that observation in that year. That's kind of a mouthful, but I think is what you want :)

Assuming you have separate CTR_O and CTR_D for each observation in the workfile, wouldn't something like

Code: Select all

series aggvalues = @sumsby(fdi_stock, @year, ctr_d) - fdi_stock
perform the desired computation since it computes the sums by destination for the year in question, then removes the value corresponding to the origin-destination-year?

Re: by group statistics? - excluding a country

Posted: Tue Aug 05, 2014 5:07 am
by questionmaster
Exactly! Ctr_o and Ctr_d had both been in the workfile, i deleted them because the workfile was to big (>2 MB) to load it up. And i thought that maybe the cross section identifier ctr_o2ctr_d in some way make things easier, of which i'm not really sure :mrgreen:

Thank you very much for your fast help! The command computes exactly the aggregated values that i need :)