Page 1 of 2

OLS regression with PC

Posted: Fri Aug 10, 2012 5:12 am
by quynh_nguyennz
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

Re: OLS regression with PC

Posted: Fri Aug 10, 2012 6:11 am
by quynh_nguyennz
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

Re: OLS regression with PC

Posted: Fri Aug 10, 2012 9:26 am
by EViews Glenn
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.

Re: OLS regression with PC

Posted: Fri Aug 10, 2012 2:33 pm
by quynh_nguyennz
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

Re: OLS regression with PC

Posted: Fri Aug 10, 2012 3:45 pm
by EViews Glenn
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.

Re: OLS regression with PC

Posted: Sat Aug 11, 2012 4:27 pm
by quynh_nguyennz
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

Re: OLS regression with PC

Posted: Mon Aug 13, 2012 2:43 am
by quynh_nguyennz
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

Re: OLS regression with PC

Posted: Tue Aug 14, 2012 9:28 am
by EViews Glenn
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?

Re: OLS regression with PC

Posted: Tue Aug 14, 2012 4:42 pm
by quynh_nguyennz
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.

Re: OLS regression with PC

Posted: Wed Aug 15, 2012 9:37 am
by EViews Glenn
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.

Re: OLS regression with PC

Posted: Thu Aug 16, 2012 4:15 am
by quynh_nguyennz
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?

Re: OLS regression with PC

Posted: Thu Aug 16, 2012 4:28 am
by quynh_nguyennz
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

Re: OLS regression with PC

Posted: Thu Aug 16, 2012 9:47 am
by EViews Glenn
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.

Re: OLS regression with PC

Posted: Sun Aug 19, 2012 12:52 am
by quynh_nguyennz
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?

Re: OLS regression with PC

Posted: Fri Aug 24, 2012 1:57 pm
by EViews Glenn
Probably the same, but it's difficult to tell from the description you provide.