ls estimation of each crosssection in panel data

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

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

ls estimation of each crosssection in panel data

Postby neptunhiker » Sat Nov 03, 2012 3:59 am

Hi everyone,

my workfile is set up as a dated panel structure. Let's say I have 3 crosssections for each of my two series (seriesA and seriesB) and I would like to estimate a Single Index Model (seriesA=constant + Beta*seriesB) for each crosssection. The only way I have found to do that is to change the sample for every crosssection. Therefore I would have to change the sample three times and following every change of the sample I would estimate the regression. For 3 crosssections that's no problem, but I will have between 100 and 200 in my real data set. So, is there any way that I could estimate a ls regression for each of my crosssections without changing the sample everytime?

Thanks a lot for help or suggestions.

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

Re: ls estimation of each crosssection in panel data

Postby neptunhiker » Sat Nov 03, 2012 5:41 am

I think I found a workaround that is not exactly state of the art, but I get results. Here it is:

Code: Select all

'create a panel with 3 ID series - xyz create a 1990 2020 3 alpha id = "X" smpl if @crossid=2 id = "Y" smpl if @crossid=3 id = "Z" pagestruct @date(dateid) id 'make some data series series seriesA=nrnd series seriesB = nrnd ' Define number of crosssections scalar N=@max(crossid) ' Estimate regression for every crosssection for !i=1 to N smpl if crossid=!i equation aaa!i.ls seriesA c seriesB next ' Reset to full range smpl @all ' freeze equations for !i=1 to N freeze(tab!i) aaa!i next ' make parent table table cross_reg_results ' copy regression results of each crosssection regression in parent table for !i=1 to N for !k=!i+3 to !i+3 tab!i.copyrange b11 d11 cross_reg_results b!k tab!i.copyrange b12 d12 cross_reg_results e!k next next ' Delete frozen tables for !i=1 to N delete tab!i next ' Delete estimated equations for !i=1 to N delete aaa!i next ' Include crosssection ID in parent table for !i=4 to N+3 cross_reg_results(!i,1)=!i-3 next ' Define headers of parent table cross_reg_results(3,1)="Crosssection" cross_reg_results(3,2)="Alpha" cross_reg_results(3,3)="Std. Error" cross_reg_results(3,4)="t-Statistic" cross_reg_results(3,5)="Beta" cross_reg_results(3,6)="Std. Error" cross_reg_results(3,7)="t-Statistic" ' Define title of parent table cross_reg_results(1,1)="Regression results of Single Index Model" ' show parent table show cross_reg_results
It is really quite complicated for such a trivial problem, therefore I still hope that there is an easier solution already implemented in eViews. Maybe some of you have an idea how to solve this. Thanks a lot.

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

Re: ls estimation of each crosssection in panel data

Postby EViews Glenn » Tue Nov 06, 2012 10:58 am

For the 100 to 200 cross-section case, I'd just estimate the fully interacted model

Code: Select all

equation aaa.ls seriesA @expand(@crossid) seriesB*@expand(@crossid)
Alternately, you may reshape your data as a pool and use the pool tools.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests