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.
Average Cross-sectional Regression in Panel Data Structure
Moderators: EViews Gareth, EViews Moderator
Re: Average Cross-sectional 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: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: Average Cross-sectional Regression in Panel Data Structure
Do you have a lot of series in your equation?
Re: Average Cross-sectional 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: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: Average Cross-sectional 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 Cross-sectional Regression in Panel Data Structure
I have only "two" variables.
-
- EViews Developer
- Posts: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: Average Cross-sectional 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. 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.
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.
Re: Average Cross-sectional Regression in Panel Data Structure
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.
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 481 times
-
- EViews Developer
- Posts: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: Average Cross-sectional Regression in Panel Data Structure
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
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 Cross-sectional Regression in Panel Data Structure
Thank you Glenn.
-
- Posts: 1
- Joined: Tue Jan 07, 2020 11:14 pm
Re: Average Cross-sectional Regression in Panel Data Structure
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?
Who is online
Users browsing this forum: No registered users and 43 guests