Hi,
I am struggling in creating 5-year averages for every cross section in my panel data.
Any help will be appreciated.
Cross Sections: Countries (189)
Time: years (1950-2010)
Five Year Average in Panel Data
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
Re: Five Year Average in Panel Data
I somehow managed to convert the BALANCED panel data into averages. Now I am only struggling with how to do the UNBALANCED.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Five Year Average in Panel Data
Code: Select all
series fiveyears = @recode(@mod(year,5)=0, year, fiveyears(-1))
series means = @meansby(y, fiveyears, @crossid)
Re: Five Year Average in Panel Data
I am a beginner, would it be possible if you could explain how to go about the code? I wrote it on the command bar and two var FIVEYEARS and MEANS were made. How to put the observation values in these?
I am sorry, you may not reply to this if I am asking too much.
Thanks a lot for ur reply anyways.
I am sorry, you may not reply to this if I am asking too much.
Thanks a lot for ur reply anyways.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Five Year Average in Panel Data
The series fiveyear that gets created is just a variable equal to "1950" for the first five years, equal to "1955" for the next five years, and so on.
The series means contains the averages.
The series means contains the averages.
Re: Five Year Average in Panel Data
Hi there,
I have the same problem I tried the formula but I need to do it for every single explanatory variable but the numbers won't change.
Is there another formula I need to use to do for every variable (apart from changing the name in the formula which I have done but it is not working) ?
Thanks,
Angie
I have the same problem I tried the formula but I need to do it for every single explanatory variable but the numbers won't change.
Is there another formula I need to use to do for every variable (apart from changing the name in the formula which I have done but it is not working) ?
Thanks,
Angie
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Five Year Average in Panel Data
No.
You can write a loop that will loop through the variables and create the average.
You can write a loop that will loop through the variables and create the average.
Re: Five Year Average in Panel Data
Hi Gareth,
Thank you for your response. Can you please elaborate because I can not understand?
Thank you,
Angie
Thank you for your response. Can you please elaborate because I can not understand?
Thank you,
Angie
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Five Year Average in Panel Data
You know how to create the five year average for one series, you want to know how to do it for multiple series. I merely stated that you can write a for loop that loops through all your series one at a time and performs the averaging. The programming forum has lots of examples of using for loops.
Who is online
Users browsing this forum: No registered users and 2 guests
