Page 1 of 1

Calculating mean in panel data

Posted: Thu May 05, 2011 5:07 am
by Andreas0407
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

Re: Calculating mean in panel data

Posted: Thu May 05, 2011 7:54 am
by EViews Gareth
Should be the same. Perhaps you can provide the data and the method you used to calculate the mean in EViews.

Re: Calculating mean in panel data

Posted: Thu May 05, 2011 8:41 am
by Andreas0407
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

Re: Calculating mean in panel data

Posted: Thu May 05, 2011 8:50 am
by EViews Gareth
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.

Re: Calculating mean in panel data

Posted: Thu May 05, 2011 10:45 am
by Andreas0407
That was a very stupid mistake of mine! Thanks a lot Gareth!

Re: Calculating mean in panel data

Posted: Fri May 06, 2011 2:47 pm
by Andreas0407
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?

Re: Calculating mean in panel data

Posted: Fri May 06, 2011 2:54 pm
by EViews Gareth
Which multi-variable stat did you want to calculate?

Re: Calculating mean in panel data

Posted: Fri May 06, 2011 3:00 pm
by Andreas0407
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).

Re: Calculating mean in panel data

Posted: Fri May 06, 2011 3:05 pm
by EViews Gareth
Nothing built in that will do it - you'll have to handle each series individually.

Re: Calculating mean in panel data

Posted: Sat Jan 07, 2017 11:42 pm
by Santosh
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.

Re: Calculating mean in panel data

Posted: Sun Jan 08, 2017 12:58 pm
by EViews Gareth
Open up the series, click on View->Summary Statistics->Stats by classification.

Enter the country id series as the classifying series

Re: Calculating mean in panel data

Posted: Tue Jan 10, 2017 1:16 am
by Santosh
Thank you Gareth. That helped.