**Moderators:** EViews Gareth, EViews Moderator

17 posts
• Page **1** of **2** • **1**, 2

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

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

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

- quynh_nguyennz
**Posts:**25**Joined:**Tue Aug 07, 2012 4:00 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.

- EViews Glenn
- EViews Developer
**Posts:**2182**Joined:**Wed Oct 15, 2008 9:17 am

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

Regards

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

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.

- EViews Glenn
- EViews Developer
**Posts:**2182**Joined:**Wed Oct 15, 2008 9:17 am

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

Regards

- quynh_nguyennz
**Posts:**25**Joined:**Tue Aug 07, 2012 4:00 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

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

- quynh_nguyennz
**Posts:**25**Joined:**Tue Aug 07, 2012 4:00 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?

- EViews Glenn
- EViews Developer
**Posts:**2182**Joined:**Wed Oct 15, 2008 9:17 am

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.

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.

- quynh_nguyennz
**Posts:**25**Joined:**Tue Aug 07, 2012 4:00 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.

- EViews Glenn
- EViews Developer
**Posts:**2182**Joined:**Wed Oct 15, 2008 9:17 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?

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

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

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

- quynh_nguyennz
**Posts:**25**Joined:**Tue Aug 07, 2012 4:00 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.

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.

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.

- EViews Glenn
- EViews Developer
**Posts:**2182**Joined:**Wed Oct 15, 2008 9:17 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?

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?

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

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

- EViews Glenn
- EViews Developer
**Posts:**2182**Joined:**Wed Oct 15, 2008 9:17 am

17 posts
• Page **1** of **2** • **1**, 2

Users browsing this forum: Google [Bot] and 2 guests