Calculating mean in panel data

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

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

Andreas0407
Posts: 6
Joined: Tue Mar 22, 2011 6:21 am

Calculating mean in panel data

Postby Andreas0407 » Thu May 05, 2011 5:07 am

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

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

Re: Calculating mean in panel data

Postby EViews Gareth » Thu May 05, 2011 7:54 am

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

Andreas0407
Posts: 6
Joined: Tue Mar 22, 2011 6:21 am

Re: Calculating mean in panel data

Postby Andreas0407 » Thu May 05, 2011 8:41 am

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
Attachments
roe 2000 - 2001.wf1
(1.43 MiB) Downloaded 437 times
roe 2000 - 2001.xlsx
(1.34 MiB) Downloaded 434 times

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

Re: Calculating mean in panel data

Postby EViews Gareth » Thu May 05, 2011 8:50 am

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

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

Andreas0407
Posts: 6
Joined: Tue Mar 22, 2011 6:21 am

Re: Calculating mean in panel data

Postby Andreas0407 » Thu May 05, 2011 10:45 am

That was a very stupid mistake of mine! Thanks a lot Gareth!

Andreas0407
Posts: 6
Joined: Tue Mar 22, 2011 6:21 am

Re: Calculating mean in panel data

Postby Andreas0407 » Fri May 06, 2011 2:47 pm

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?

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

Re: Calculating mean in panel data

Postby EViews Gareth » Fri May 06, 2011 2:54 pm

Which multi-variable stat did you want to calculate?
Follow us on Twitter @IHSEViews

Andreas0407
Posts: 6
Joined: Tue Mar 22, 2011 6:21 am

Re: Calculating mean in panel data

Postby Andreas0407 » Fri May 06, 2011 3:00 pm

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).

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

Re: Calculating mean in panel data

Postby EViews Gareth » Fri May 06, 2011 3:05 pm

Nothing built in that will do it - you'll have to handle each series individually.
Follow us on Twitter @IHSEViews

Santosh
Posts: 26
Joined: Mon Sep 26, 2016 11:00 am

Re: Calculating mean in panel data

Postby Santosh » Sat Jan 07, 2017 11:42 pm

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.

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

Re: Calculating mean in panel data

Postby EViews Gareth » Sun Jan 08, 2017 12:58 pm

Open up the series, click on View->Summary Statistics->Stats by classification.

Enter the country id series as the classifying series
Follow us on Twitter @IHSEViews

Santosh
Posts: 26
Joined: Mon Sep 26, 2016 11:00 am

Re: Calculating mean in panel data

Postby Santosh » Tue Jan 10, 2017 1:16 am

Thank you Gareth. That helped.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 25 guests