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 crosssection 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 subsamples like 19501970, 19711995.
Highly appreciate your help.
Thank you.
Average Crosssectional Regression in Panel Data Structure
Moderators: EViews Gareth, EViews Moderator
Re: Average Crosssectional Regression in Panel Data Structure
Hi,
I would be grateful if someone can help me out.
Thank you.
I would be grateful if someone can help me out.
Thank you.

 EViews Developer
 Posts: 2527
 Joined: Wed Oct 15, 2008 9:17 am
Re: Average Crosssectional Regression in Panel Data Structure
Do you have a lot of series in your equation?
Re: Average Crosssectional Regression in Panel Data Structure
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.
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 Developer
 Posts: 2527
 Joined: Wed Oct 15, 2008 9:17 am
Re: Average Crosssectional Regression in Panel Data Structure
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.
If you want to post your workfile and a description of the equation, that might be a useful approach.
Re: Average Crosssectional Regression in Panel Data Structure
I have only "two" variables.

 EViews Developer
 Posts: 2527
 Joined: Wed Oct 15, 2008 9:17 am
Re: Average Crosssectional Regression in Panel Data Structure
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. Crosssection 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. Subgroup
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.
1. Crosssection 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. Subgroup
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.
Re: Average Crosssectional Regression in Panel Data Structure
Thank you Glenn. with your codes, i managed to estimate yearwise regressions, crosssection regressions, crosssection 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 subgroup 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.
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 subgroup 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 14 times

 EViews Developer
 Posts: 2527
 Joined: Wed Oct 15, 2008 9:17 am
Re: Average Crosssectional Regression in Panel Data Structure
Sorry my fault. You want to find the period averages (taking averages across all crosssections for each period), and then do the regression for a given crosssection. My sample statement was backward...
For your data, you'll want
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
Re: Average Crosssectional Regression in Panel Data Structure
Thank you Glenn.
Who is online
Users browsing this forum: No registered users and 3 guests