Panel Data Conversion

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

hfwill
Posts: 6
Joined: Wed Mar 11, 2009 7:26 pm

Panel Data Conversion

Postby hfwill » Fri Apr 01, 2011 6:46 pm

I have a 3-D panel dataset--2 cross sections, 1 time dimension. I want to create a 2-D panel dataset by aggregating (either summing or averaging) across one cross section within another. Is there some way of doing this?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Panel Data Conversion

Postby EViews Gareth » Fri Apr 01, 2011 7:48 pm

Create a series containing the amalgamated cross-section id (something like alpha crossid = crossid1 + crossid2). Then create a new page with the same time series and cross-section ID. Then copy from the first page to the second page, doing a general match merge, using your dateid and your cross-id as the source and destination IDs. Then choose the type of contraction, and you're done.

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Wed May 11, 2011 1:03 pm

I'm looking to do something similar but want to condition the aggregation. Any suggestions?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Panel Data Conversion

Postby EViews Gareth » Wed May 11, 2011 1:23 pm

What does "condition the aggregation" mean?

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Wed May 11, 2011 1:41 pm

sorry, i want get a subset of the panel data - average one element for all the cross-sections that meet a certain criteria of a second element. For example, I have 100 people in a survey and i want to find the average income (one element) for men vs women (gender is the second element in the panel).

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Panel Data Conversion

Postby EViews Gareth » Wed May 11, 2011 1:49 pm

Do you want the average across all cross-sections, or do you want a per-cross-section average?

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Wed May 11, 2011 1:57 pm

per cross section, I think. (I'm experienced with time series but this is my first attempt at panels). Right now each panel is 2 dimensions (100 people by 10 survey questions) and I have a separate panel for each time period.The survey is done monthly so I guess I could do 3 dimensions in one big panel? I'm interested in seeing results mothly.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Panel Data Conversion

Postby EViews Gareth » Wed May 11, 2011 2:02 pm

I'm still not quite sure I understand what you want. But it sounds like you're simply trying to do something like:

Code: Select all

smpl if gender="male" series mean = @meansby(income, @crossid)
where you replace gender with the name of the series containing gender information, and income with the name of the series containing income information.

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Wed May 11, 2011 2:10 pm

It probably is that simple...again, my first attempt at panels. Thanks for the help!

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Fri May 13, 2011 7:54 am

Suppose I want to do one calc if gender is male and a different calc if gender is female?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Panel Data Conversion

Postby EViews Gareth » Fri May 13, 2011 8:32 am

Code: Select all

smpl if gender="male" series meanmale = @meansby(income, @crossid) smpl if gender="female" series meanfemale = @meansby(income, @crossid)

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Fri May 13, 2011 8:34 am

but what if i want just one series "MEAN" rather than meanmale and meanfemale?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Panel Data Conversion

Postby EViews Gareth » Fri May 13, 2011 8:38 am

Code: Select all

smpl if gender="male" series mean= @meansby(income, @crossid) smpl if gender="female" series mean = @meansby(income, @crossid)

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Fri May 13, 2011 8:44 am

when i do that, the numbers calculated by the first meansby are over written with NAs by the second meansby. In other words, after the first meansby, mean will have numbers for MALE cross sections and NAs for Female. After the second meansby the FEMALE cross sections have numbers but the MALE numbers have been over written by NAs. I have two separate means now, is there a way to combine them (i tried just adding but then they all become NAs) or some other method or am I just doing something wrong?
Thanks.

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

Re: Panel Data Conversion

Postby BBuser1 » Fri May 13, 2011 8:51 am

i figured it out. thanks.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests