Average Cross-sectional Regression in Panel Data Structure

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

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

Average Cross-sectional Regression in Panel Data Structure

Postby Santosh » Fri Jul 07, 2017 12:48 pm

Hi,
I have a panel data with N=40, T=50.
I want to estimate the following models:
1. For each country
2. For each year
3. Take average across T for each N. So, i will have 40 observations. Then i want to run a cross-section regression
4. Take average (for entire period) across N for each T. So, I will have 50 observations - one for each year. I want to estimate a time series model.
5. Same as #4, but the averaging is for sub-samples like 1950-1970, 1971-1995.

Highly appreciate your help.
Thank you.

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

Re: Average Cross-sectional Regression in Panel Data Structure

Postby Santosh » Mon Jul 10, 2017 8:44 pm

Hi,
I would be grateful if someone can help me out.

Thank you.

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: Average Cross-sectional Regression in Panel Data Structure

Postby EViews Glenn » Tue Jul 11, 2017 9:56 am

Do you have a lot of series in your equation?

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

Re: Average Cross-sectional Regression in Panel Data Structure

Postby Santosh » Tue Jul 11, 2017 10:17 am

Dear Glenn,
No, i have a panel data set. I want to estimate those my models to see how the coefficient changes with respect to specifications.

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: Average Cross-sectional Regression in Panel Data Structure

Postby EViews Glenn » Tue Jul 11, 2017 10:28 am

I meant, are there a lot of variables in the regression specification. There are different ways of doing this and the best will depend on your specification.

If you want to post your workfile and a description of the equation, that might be a useful approach.

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

Re: Average Cross-sectional Regression in Panel Data Structure

Postby Santosh » Tue Jul 11, 2017 11:41 am

I have only "two" variables.

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: Average Cross-sectional Regression in Panel Data Structure

Postby EViews Glenn » Wed Jul 12, 2017 4:39 pm

With only two variables it's easiest to do it in the same workfile page. Note that in these two cases, you are replacing every observation with the relevant means and then subsampling when running the regression so that the output labeling may not be what you want. If this is the case, an alternative way to do it is to create new workfile pages and then save the means to those pages. That's only a couple more steps...

1. Cross-section regressions

smpl @all
series ycxmean = @meansby(y, @crossid)
series x1cxmean = @meansby(x1, @crossid)
series x2cxmean = @meansby(x2, @crossid)
smpl if @cellid = 1
equation cxeq.ls ycxmean c x1cxmean x2cxmean


2. Period regressions

smpl @all
series ypermean = @meansby(y, @year)
series x1permean = @meansby(x1, @year)
series x2permean = @meansby(x2, @year)
smpl if @year = @min(@year)
equation pereq.ls ypermean c x1permean x2permean

3. Sub-group

Use Proc/Series classify... on the YEAR series to create an classification variable for your groups. Then do the same as (1) and (2) using your classification variable.

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

Re: Average Cross-sectional Regression in Panel Data Structure

Postby Santosh » Sat Jul 15, 2017 3:34 am

Thank you Glenn. with your codes, i managed to estimate year-wise regressions, cross-section regressions, cross-section average regression. All these results match with Stata output.
However, for estimating time series average regression (that is taking average across each ID for each year; kindly see #4 question), when i use the code:
smpl if @year = @min(@year)

EViews is telling me that "Near Singular Matrix"

Similarly, for sub-group estimations, i could not generate variables as you suggested.
Use Proc/Series classify... on the YEAR series to create an classification variable for your groups.

I have attached the EViews data sheet. Kindly have a look at it.
My apologies for bothering you too much.
Highly appreciate your help.

Thank you.
Attachments
help_santosh.wf1
Kindle see the text file
(93.32 KiB) Downloaded 469 times

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: Average Cross-sectional Regression in Panel Data Structure

Postby EViews Glenn » Mon Jul 24, 2017 1:05 pm

Sorry my fault. You want to find the period averages (taking averages across all cross-sections for each period), and then do the regression for a given cross-section. My sample statement was backward...

For your data, you'll want

Code: Select all

smpl @all
series ypermean = @meansby(cf, @year)
series x1permean = @meansby(ds, @year)
smpl if @crossid=1
equation pereq.ls ypermean c x1permean

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

Re: Average Cross-sectional Regression in Panel Data Structure

Postby Santosh » Tue Jul 25, 2017 12:44 pm

Thank you Glenn.

usmanshaukatkhan
Posts: 1
Joined: Tue Jan 07, 2020 11:14 pm

Re: Average Cross-sectional Regression in Panel Data Structure

Postby usmanshaukatkhan » Wed Jan 15, 2020 3:51 am

EViews Glenn wrote:With only two variables it's easiest to do it in the same workfile page. Note that in these two cases, you are replacing every observation with the relevant means and then subsampling when running the regression so that the output labeling may not be what you want. If this is the case, an alternative way to do it is to create new workfile pages and then save the means to those pages. That's only a couple more steps...

1. Cross-section regressions

smpl @all
series ycxmean = @meansby(y, @crossid)
series x1cxmean = @meansby(x1, @crossid)
series x2cxmean = @meansby(x2, @crossid)
smpl if @cellid = 1
equation cxeq.ls ycxmean c x1cxmean x2cxmean


2. Period regressions

smpl @all
series ypermean = @meansby(y, @year)
series x1permean = @meansby(x1, @year)
series x2permean = @meansby(x2, @year)
smpl if @year = @min(@year)
equation pereq.ls ypermean c x1permean x2permean

3. Sub-group

Use Proc/Series classify... on the YEAR series to create an classification variable for your groups. Then do the same as (1) and (2) using your classification variable.


Dear sir, i want run regression on various firms. What program should i run using "if command" that include individual firms?


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 42 guests