Calculating mean in panel data
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Posts: 6
- Joined: Tue Mar 22, 2011 6:21 am
Calculating mean in panel data
Hi,
I have a somewhat strange problem when calculating descriptive statistics for a panel data set in EViews.
The data set covers 4 years and 60 000 firms. I calculate the mean value for one variable for each year using the "stats by classication" function. However, the values calculated for the mean do not correspond at all with the mean values of the same variable in Microsoft Excel.
I tried to import one single variable in EViews and to compare the mean values calculated in EViews and Excel. This lead to the same conclusion. Excel ignores empty values when calculating the mean, and when I import these data in EViews these missing values are considered NA. Does anyone have an explanation for this? Is the mean value in EViews calculated differently than in Microsoft Excel?
Thanks in advance,
Andreas
I have a somewhat strange problem when calculating descriptive statistics for a panel data set in EViews.
The data set covers 4 years and 60 000 firms. I calculate the mean value for one variable for each year using the "stats by classication" function. However, the values calculated for the mean do not correspond at all with the mean values of the same variable in Microsoft Excel.
I tried to import one single variable in EViews and to compare the mean values calculated in EViews and Excel. This lead to the same conclusion. Excel ignores empty values when calculating the mean, and when I import these data in EViews these missing values are considered NA. Does anyone have an explanation for this? Is the mean value in EViews calculated differently than in Microsoft Excel?
Thanks in advance,
Andreas
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculating mean in panel data
Should be the same. Perhaps you can provide the data and the method you used to calculate the mean in EViews.
Follow us on Twitter @IHSEViews
-
- Posts: 6
- Joined: Tue Mar 22, 2011 6:21 am
Re: Calculating mean in panel data
Thanks Gareth for your quick response.
I added the excel and the eviews workfile.
It's just a part from the database because it's too big. Our dataset also involves panel data, but this is of no importance to calculate the mean.
In EViews, I import these data from excel (open foreign data as workfile). To calculate the mean, I select for example "roe2000", open it and then view -> descriptive statistics & tests -> stats table. The mean value for roe2000 is 15,1%.
However, when you calculate in Excel the exact same data, the mean value for roe2000 is 6,9%.
In 2001, the mean in EViews is 15,1%; in Excel it is 4,4%.
Andreas
I added the excel and the eviews workfile.
It's just a part from the database because it's too big. Our dataset also involves panel data, but this is of no importance to calculate the mean.
In EViews, I import these data from excel (open foreign data as workfile). To calculate the mean, I select for example "roe2000", open it and then view -> descriptive statistics & tests -> stats table. The mean value for roe2000 is 15,1%.
However, when you calculate in Excel the exact same data, the mean value for roe2000 is 6,9%.
In 2001, the mean in EViews is 15,1%; in Excel it is 4,4%.
Andreas
- Attachments
-
- roe 2000 - 2001.wf1
- (1.43 MiB) Downloaded 437 times
-
- roe 2000 - 2001.xlsx
- (1.34 MiB) Downloaded 434 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculating mean in panel data
You've told Excel to calculate the average of a2 and a59656, not the average of all the numbers between a2 and a59696.
Note that to do it properly in Excel, you would need to type
not
However, you should also note that since some of the numbers in that range contain errors (#div/0!), Excel will refuse to calculate the average. You'll have to go through and fix those errors.
Note that to do it properly in Excel, you would need to type
Code: Select all
=average(a2:a59656)
not
Code: Select all
=average(a2,a59656)
However, you should also note that since some of the numbers in that range contain errors (#div/0!), Excel will refuse to calculate the average. You'll have to go through and fix those errors.
Follow us on Twitter @IHSEViews
-
- Posts: 6
- Joined: Tue Mar 22, 2011 6:21 am
Re: Calculating mean in panel data
That was a very stupid mistake of mine! Thanks a lot Gareth!
-
- Posts: 6
- Joined: Tue Mar 22, 2011 6:21 am
Re: Calculating mean in panel data
One other question, I'll post it here if you don't mind.
When selecting one variable, you can calculate the stats by classification (for example if you have data for different firms for different years, you can calculate the mean for all firms for each year with this function). However, when selecting multiple variables, this seems not possible. Is there a way to do this?
When selecting one variable, you can calculate the stats by classification (for example if you have data for different firms for different years, you can calculate the mean for all firms for each year with this function). However, when selecting multiple variables, this seems not possible. Is there a way to do this?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculating mean in panel data
Which multi-variable stat did you want to calculate?
Follow us on Twitter @IHSEViews
-
- Posts: 6
- Joined: Tue Mar 22, 2011 6:21 am
Re: Calculating mean in panel data
I just like to display a table where the most important descriptive statistics are mentioned. Let me make myself clear with an example.
I have for example a regression with the following form: Y = a1 X1 + a2 X2 + error term. I have removed the outliers from Y, X1 and X2. Now, I'd like to create a table with mean values for each year for each variable (with the outliers removed too, so that the N of the regression is the same as the N of the descriptive statistics).
I have for example a regression with the following form: Y = a1 X1 + a2 X2 + error term. I have removed the outliers from Y, X1 and X2. Now, I'd like to create a table with mean values for each year for each variable (with the outliers removed too, so that the N of the regression is the same as the N of the descriptive statistics).
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculating mean in panel data
Nothing built in that will do it - you'll have to handle each series individually.
Follow us on Twitter @IHSEViews
Re: Calculating mean in panel data
Hi,
I have panel data which consists of 14 countries for a variable say GDP. I want to calculate summary statistics for each countries. Is it possible to calculate summary statistics for individual countries in a panel set-up?
Thank you for your help.
I have panel data which consists of 14 countries for a variable say GDP. I want to calculate summary statistics for each countries. Is it possible to calculate summary statistics for individual countries in a panel set-up?
Thank you for your help.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculating mean in panel data
Open up the series, click on View->Summary Statistics->Stats by classification.
Enter the country id series as the classifying series
Enter the country id series as the classifying series
Follow us on Twitter @IHSEViews
Re: Calculating mean in panel data
Thank you Gareth. That helped.
Who is online
Users browsing this forum: No registered users and 25 guests