Panel Data Conversion
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
Panel Data Conversion
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
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.
Re: Panel Data Conversion
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
What does "condition the aggregation" mean?
Re: Panel Data Conversion
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
Do you want the average across all cross-sections, or do you want a per-cross-section average?
Re: Panel Data Conversion
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
I'm still not quite sure I understand what you want. But it sounds like you're simply trying to do something like:
where you replace gender with the name of the series containing gender information, and income with the name of the series containing income information.
Code: Select all
smpl if gender="male"
series mean = @meansby(income, @crossid)
Re: Panel Data Conversion
It probably is that simple...again, my first attempt at panels. Thanks for the help!
Re: Panel Data Conversion
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
Code: Select all
smpl if gender="male"
series meanmale = @meansby(income, @crossid)
smpl if gender="female"
series meanfemale = @meansby(income, @crossid)
Re: Panel Data Conversion
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
Code: Select all
smpl if gender="male"
series mean= @meansby(income, @crossid)
smpl if gender="female"
series mean = @meansby(income, @crossid)Re: Panel Data Conversion
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.
Thanks.
Re: Panel Data Conversion
i figured it out. thanks.
Who is online
Users browsing this forum: No registered users and 2 guests
