Compare subsamples of cross-sections

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

laurensjan
Posts: 5
Joined: Tue Feb 16, 2010 9:59 am

Compare subsamples of cross-sections

Postby laurensjan » Tue Feb 16, 2010 10:09 am

Hello,

I have created a panel dataset. How do I compare means or medians of variables of samples of cross-section ID's with eachother? For example; If I have 100 cross-sections for 10 years, how can I compare the mean of return on equity of cross-sections 2,4,6 with the mean of 5,8,9? I use 'date' as dateid and 'id' as cross-section id.

I hope this is possible, but I can not figure out how.

Thanks for your help.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Compare subsamples of cross-sections

Postby EViews Glenn » Tue Feb 16, 2010 10:32 am

"Compare" could mean a lot of things. Depending on what you want to do there are better and worse ways of performing the computation. Could you be (a lot) more specific about what you want to do? In particular, do you want to treat cross-sections 2,4,6 as one group and 5,8,9 as another? What sorts of comparisons do you want to do? Do you just want to look at the numbers or do something with them? etc...

laurensjan
Posts: 5
Joined: Tue Feb 16, 2010 9:59 am

Re: Compare subsamples of cross-sections

Postby laurensjan » Thu Feb 18, 2010 6:20 am

Ok, I will be more specific.

I have different companies with different credit ratings and also firm-specific volatility. This data is all included in my panel dataset, which has cross-section id's and daily data. Company 2,4 and 6 (Group 1) are non-investment grade and company 5,8 and 9 (Group 2) are investment grade and I want to compare the means between the volatility series of these 2 groups. How can I construct a group of cross-sections 2,4 and 6 in Eviews? And how can I construct the mean of volatility of a group of cross-sections 2,4 and 6?

I hope this is more specific

Thanks in advance for your help.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Compare subsamples of cross-sections

Postby EViews Glenn » Thu Feb 18, 2010 10:21 am

That helps a great deal...

In what follows, I'm assuming that you only have companies 2, 4, 6 and 5, 8, 9. If not, there will need to be a bit (not much) of modification of what I write below.

First, you'll need to create an identifier for your groups. The easiest way to do this is to generate an indicator series.

Code: Select all

smpl @all series grpid = @recode(id=2 or id=4 or id=6, 1, 0)
creates the dummy variable for the groups of interest.

Then you can open the volatility series, and go to the view menu and compute Descriptive Statistics & Tests/Stats by Classification.... Select the statistics of interest (means and some others are the defaults), enter the name of the group id series GRPID in the "Series/Group for classify" edit field, then click on OK. EViews will compute the means for the (in this case) two subgroups.

If instead you wanted to compute tests of equality for the means, you would select Descriptive Statistics & Tests/Equality Tests by Classification... and enter the GRPID in the appropriate place. For a test of means, this is simply one-way ANOVA with two groups.

If you are interested, the command forms of these commands are statby and testby, respectively.

Note also that in the more common case where the panel structure defines the classification structure, you would simply have used ID in place of GROUPID.

laurensjan
Posts: 5
Joined: Tue Feb 16, 2010 9:59 am

Re: Compare subsamples of cross-sections

Postby laurensjan » Fri Feb 19, 2010 5:35 am

Thanks for the useful reply.

I am a lot of steps closer to the complete answer. However, I do need some more specifications since I want to compare multiple groups. Thus, to be more specific:
- I have multiple companies; 269
- I want to create 4 subsets of companies by making use of the cross-section ID's, there is no overlap of companies
- Then I want to compare the mean volatility of these 4 subsets with eachother, for example in a 4 by 4 matrix using a F-test.

Thus, actually I have to create dummies for these 4 groups. I already tried this with the commands you gave me, however I can not figure out how to create multiple dummies in one group. I hope it is possible to compare (means of) subsets with eachother and not only with the total sample.

Thanks again for your help

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Compare subsamples of cross-sections

Postby EViews Glenn » Fri Feb 19, 2010 10:33 am

Is there anything other than IDs that distinguishes your 4 groups? Or absent that, is there an easy way to identify them via IDs (e.g., ID ranges)?

laurensjan
Posts: 5
Joined: Tue Feb 16, 2010 9:59 am

Re: Compare subsamples of cross-sections

Postby laurensjan » Fri Feb 19, 2010 11:03 am

I classify the 4 groups by using credit qualities of companies (Investment grade and non-investment grade). Only it is slightly more complicated, since I also classify firms in several types of migration in credit rating (from IG to NIG, from NIG to IG, etc.). Therefore, I think it would be quite complicated to transfer this classification to an Eviews command. Also, ID ranges is also not working, since the ID's of these groups are mixed.
In what follows, I'm assuming that you only have companies 2, 4, 6 and 5, 8, 9. If not, there will need to be a bit (not much) of modification of what I write below.
If I see your quote above I get the idea that there is a solution for these cross-id selection, even when there are more then 2 groups. Is it not possible in Eviews to command something similar to the commands I put below?

series grpid = @recode(id=2 or id=4 or id=6, 1, 0)
series grpid = @recode(id=5 or id=8 or id=9, 2, 0)
series grpid = @recode(id=10 or id=11 or id=13, 3, 0)
series grpid = @recode(id=14 or id=1 or id=3, 4, 0)

This command is not working, obviously since these commands set the other values to zero, but is there something possible comparable possible with other commands? For clearification, the matrix I want to create is somewhat like below, values in the matrix are F-tests or t-tests of volatility means

group 1 2 3 4
1 x
2 x
3 x
4 x

thanks again

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Compare subsamples of cross-sections

Postby EViews Glenn » Fri Feb 19, 2010 12:00 pm

Youu could do something like

Code: Select all

series grpid = @recode(id=2 or id=4 or id=6, 1, NA) grpid = @recode(id=5 or id=8 or id=9, 2, grpid) grpid = @recode(id=10 or id=11 or id=13, 3, grpid) grpid = @recode(id=14 or id=1 or id=3, 4, grpid)
which only recodes the id if the condition is satisfied, otherwise it keeps the existing value. I would probably initialize to NA, that way you can easily see if your recodes missed any observations.

Alternately, you can do this by restricting the sample on each subsequent series assignment. Something like

Code: Select all

smpl @all series grpid = NA smpl if id=2 or id=4 or id=6 grpid = 1 smpl if id=5 or id=8 or id=9 grpid = 2 smpl if id=10 or id=10 or id=13 grpid = 3 smpl if id=14 or id=1 or id=3 grpid = 4 smpl @all

laurensjan
Posts: 5
Joined: Tue Feb 16, 2010 9:59 am

Re: Compare subsamples of cross-sections

Postby laurensjan » Mon Feb 22, 2010 6:27 am

I constructed the second commands mentioned (I have 5 groups and more cross-id's but I used the codes below), since the first option was no solution, thus that is:
smpl @all
series grpid = NA
smpl if id=2 or id=4 or id=6
grpid = 1
smpl if id=5 or id=8 or id=9
grpid = 2
smpl if id=10 or id=10 or id=13
grpid = 3
smpl if id=14 or id=1 or id=3
grpid = 4
smpl @all
It divides the crossid's in 5 groups, only when I perform the equality test, the only comparison that is made is between one subset vs. the total sample. There are thus no subset vs. subset comparisons. See also screenshot of the results in 'screen1.jpg' in the attachment.For your information: there are no cross-id's left when I classified the 5 groups.
screen1.jpg
screen1.jpg (123.48 KiB) Viewed 13061 times
What do I do wrong, since I want to compare the subsets with eachother, and not so much with the total. The attachment 'screen2.jpg' shows the screenshot of the Eviews guide, where the comparisons are shown between subsets. What do I have to modify to achieve similar results as in the guide.
screen2.jpg
screen2.jpg (154.98 KiB) Viewed 13060 times
Thanks for helping.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Compare subsamples of cross-sections

Postby EViews Glenn » Mon Feb 22, 2010 11:49 am

The null in the ANOVA is that the group means are equal to each other. Note that if they are equal to each other, they are also equal to the overall mean.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests