OLS regression with PC

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

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

OLS regression with PC

Postby quynh_nguyennz » Fri Aug 10, 2012 5:12 am

Hi,
I have to run OLS regression with principal component each year.I save my PC as a matrix so when I tried to estimate return c pc , it doesnot work.
Please show me how to run it.
I am really sorry to bother you because this is my first time to use eviews. I don't know whether my file is pool or panel :?
this is my model
Rj,t = ∑i=1 5 βj,t PCi,t + εj,t
Regards

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Fri Aug 10, 2012 6:11 am

I think my data is times series data. it has 10 column The first one is the date, the second to the tenth is the return index of each countries

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

Re: OLS regression with PC

Postby EViews Glenn » Fri Aug 10, 2012 9:26 am

You don't want to save the eigenvalues/vectors, you want the scores. See the makepcomp proc, or click on Proc/Make Principal Components... from your group.

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Fri Aug 10, 2012 2:33 pm

You mean I don't need the eigenvalues/eigenvectors, I just need the score?But I think I need the eigenvectors to run the OLS regression. I have 10 PC and each PC contains the others 4 figures
Regards

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

Re: OLS regression with PC

Postby EViews Glenn » Fri Aug 10, 2012 3:45 pm

The eigenvalues and eigenvectors are summaries of the correlation/covariance matrix. If you want to run a regression you need something in the space of the original data. Look in the manual for a description of the scores.

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Sat Aug 11, 2012 4:27 pm

Hi, my mistake, I think I run the regression between the return index of each countries and the return of bond portfolio. therefore, i need the weight of the portfolio bond. they suggest to calculate the covariance matrix using the return index,once the eigenvectors are computed and sorted from the largest to the smallest eigenvalues, principal component are estimated from the return in the subsequent calendar year. they said the weightings are eigenvector. when I run principal component, I chose view/principal component/display table/calculation type variance ordinary. and when table come out, I use the eigenvalues there as my weight? IS it right? or I have to do something else?
Regards

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Mon Aug 13, 2012 2:43 am

Hi,
I used this command to make the principal component:
freeze(tab1) aus2005.pcomp(cov, eigval=v1, eigvec=m1) pc1 pc2 pc3 pc4
when I got the series PC1 to PC4, I run OLS regression using this model:
Rj,t = ∑i=1 5 βj,t PCi,t + εj,t
Is it alright?
regards

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

Re: OLS regression with PC

Postby EViews Glenn » Tue Aug 14, 2012 9:28 am

I'm confused. That appears to be the wrong syntax. Did the series PC1, PC2, PC3, PC4 already exist? Are you sure you didn't do makepcomp?

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Tue Aug 14, 2012 4:42 pm

Hi,
i use this command to make principal components:
freeze(tab1) aus2005.pcomp(cov, eigval=v1, eigvec=m1) pc1 pc2 pc3 pc4
because I need only the first four PC so I stored the first four PCs so that i can run the OLS regression
Is it right? and this is my model for ols:
Rj,t = ∑i=1 10 βj,t PCi,t + εj,t.

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

Re: OLS regression with PC

Postby EViews Glenn » Wed Aug 15, 2012 9:37 am

It appears that the form of the pcomp command you used does work, but it is an undocumented feature that is not guaranteed to work in the future. The correct command for making components is makepcomp.

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Thu Aug 16, 2012 4:15 am

I see the command in the reference:
group g1 x1 x2 x3 x4
freeze(tab1) g1.pcomp(cor, eigval=v1, eigvec=m1) pc1 pc2
The first line creates a group named G1 containing the four series X1, X2, X3, X4. The second
line stores the first two principal components of the sample correlation matrix in series
named PC1 and PC2. The output view is stored in a table named TAB1, the eigenvalues in a
vector named V1, and the eigenvectors in a matrix named M1.
I run and the series PC1 PC2 appears, Since I think I need the daily PC1, PC2 to run the OLS regression so that why I choose it
What is different between the makepcomp and my command?

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Thu Aug 16, 2012 4:28 am

Hi,
I have just tried your command. I think it is the same because I got the same result when I use this command:
makepcome (cov) comp1 comp2 comp3 comp4
Thank you very much for your kind advice and your patient to explain to me.
Thank you Thank you
I love you
Best regards

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

Re: OLS regression with PC

Postby EViews Glenn » Thu Aug 16, 2012 9:47 am

The PCOMP command is for displaying the loadings, scores and biplots. MAKEPCOMP is for saving the scores to the workfile. The syntax that you used in PCOMP has a potential conflict with the display of loadings when producing biplots. It works right now because the command maps to the same code as MAKEPCOMP, but that might not be the case in the future.

As the documentation states MAKEPCOMP is the method of producing the scores.
To compute principal components scores and save them in series in the workfile, see Group::makepcomp.

I do see that there is an example which shows your usage but that's a holdover that probably should have been changed when we added additional features to principal components. Either than or we should officially support your usage. I'll put in on the list of things for us to consider.

quynh_nguyennz
Posts: 25
Joined: Tue Aug 07, 2012 4:00 am

Re: OLS regression with PC

Postby quynh_nguyennz » Sun Aug 19, 2012 12:52 am

Hi,
I read the other topic about the principal component. They calculate the principal component base on those steps:
1 covariance matrix
2Calculate the eigenvectors and eigenvalues of the covariance
matrix
and last step is PC
Is it different from our syntax makepcomp?

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

Re: OLS regression with PC

Postby EViews Glenn » Fri Aug 24, 2012 1:57 pm

Probably the same, but it's difficult to tell from the description you provide.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 26 guests