Page **1** of **1**

### principal component factor analysis

Posted: **Sun Nov 22, 2009 12:02 am**

by **researcher**

I am trying to derive factors from a group of variables using principal component factor analysis. I have a dependent variable and a bunch of independent variables. Uisng correlations in principal components, what are the steps I need to follow in eviews? and how do I obtain "scores" for my output?

### Re: principal component factor analysis

Posted: **Sun Nov 22, 2009 6:45 am**

by **trubador**

Besides the users guide, the following posts might also help:

Post-1 and

Post-2

### Re: principal component factor analysis

Posted: **Tue Nov 02, 2010 6:05 am**

by **oek_stat**

I know how to get principal components of a group by using the menu.

But I want to do a rolling forecast and therefore I need the code for saving component scores.

Can anyone help me?

### Re: principal component factor analysis

Posted: **Tue Nov 02, 2010 7:56 am**

by **EViews Gareth**

You can use the PCOMP group view/proc. It is found in the Object Reference in the Group section.

### Re: principal component factor analysis

Posted: **Wed Nov 03, 2010 3:34 am**

by **oek_stat**

It works! Thanks a lot! But how can I save the results in a rolling forecast. Below you can see the program code. I haven't any idea how to save pc1. I do only get the values of the last estimation of pc1.

' set window size

!window =120

' get size of workfile

!length = @obsrange

' Sample for estimation

' declare series for final results

series pc1

' point estimates

' set step size (3 month)

!step = 1

' move sample !step obs at a time

for !i = 1 to !length-!window+1-!step step !step

' set sample to estimation period

smpl @first @first+!i+!window-2

' estimate VAR

sektoren.pcomp(cor, eigvale=v1, eigvec=m1) pc

### Re: principal component factor analysis

Posted: **Sat Mar 19, 2016 12:52 pm**

by **Sammoland**

Dear eViews developers

I am trying to estimate a dynamic factor model using a principal components. Once I have made the principal components, I'm needing to estimate VAR coefficients using OLS (It is assumed that the common factors follow a VAR(p) process). What does this mean? Apparently this is all done through principal components- How do I incorporate a VAR process into the principal component model?

### Re: principal component factor analysis

Posted: **Sat Mar 19, 2016 2:12 pm**

by **trubador**

That's not the way to estimate dynamic factor analysis. In EViews, you need to use state space object for that purpose. You can search the forum for similar examples:

search.php?st=0&sk=t&sd=d&sr=posts&keywords=dynamic+factor

### Re: principal component factor analysis

Posted: **Sun Mar 20, 2016 12:15 am**

by **Sammoland**

Thanks for the quick response. I had initially thought it was a state space model, but the paper I am following outlines a two-stage model:

We estimate the DFM using the two-step procedure:

1. Based on the latest available complete balanced data panel, estimate the common

factors using principle components. Given the common factors, estimate the factor

loadings Λˆ and the covariance matrix Ψˆ associated with ϵt using OLS. In addition,

estimate the VAR coefficients Aˆ1, . . . , Aˆp and Σˆ using OLS, where the number of lags p is selected using SIC.

2. Given the estimated parameters (Λˆ, Ψˆ , Aˆ1, . . . , Aˆp, and Σˆ) in step 1, we apply the

Kalman Smoother to the entire data panel (including missing observations) and

re-estimate the factors. If xi,t has missing observations, the implicit signal extraction

process of the filter will place no weight on the missing variable xi in the computation of the factors at time t.

Am i missing something? Should this be done in a state space model rather? I have used Proc/Make Components to get the factor loadings and covariance matrix (I think), but am stuck with the second procedure on how to estimate the other parameters, before I do a Kalman filter.

### Re: principal component factor analysis

Posted: **Sun Mar 20, 2016 12:36 pm**

by **trubador**

It looks like a collapsed dynamic factor model. In any case, I don't think there is an easy way to implement it in EViews, since state space model does not work in a panel structure.

### Re: principal component factor analysis

Posted: **Tue Mar 22, 2016 12:30 am**

by **Sammoland**

Thanks Trubador.

I will switch over to Matlab to finish up the calcuation.

### Re: principal component factor analysis

Posted: **Wed Mar 30, 2016 12:47 am**

by **JanRad**

Dear all,

I am also using the two stage procedure mentioned by Sammoland, but in the simplier, time series structure. Could anybody just help me and tell whether I am doing it right or wrong? First, I extracted 3 factor scores (common factors) that expalain approximatelly 70 % of variation in data set by using pcomp and estimate factor loadings and covariance matrix by using simple OLS regressions (I regressed GDP on 3 common factors to obtain betas (loadings) and error var-covar matrix and repeated the procedure for all other included variables). In addition, I also estimated a VAR (using 3 common factors) to obtain VAR coefficients and var-covar matix. In step 2 I estimated a state-space model (using the estimated parameters from step 1) on the entire sample (Kalman smoother) in order to obtain smoothed estimates of factors (after model estiamtion I used command makestates(t=smooth) in order to obtain smoothed estimates of factors). Now I am stuck at final point since I have to apply Kalman filter forward recursion using the re-estimated factors in step 2 in order to obtain the h-step ahead forecast for GDP. Does it mean that I have to re-estimate state-space model by using smoothed factor estimates and than perform forecasting exercise or is there some other solution? I would really appreciate any suggestion. Thank you very much for your help.

Kind regards,

Jan

### Re: principal component factor analysis

Posted: **Wed Mar 30, 2016 1:26 am**

by **trubador**

You can build the state space model in the second step without estimating a separate VAR.

Code: Select all

`...`

@signal pcomp1 = factor1 + [...]

@signal pcomp2 = factor2 + [...]

@signal pcomp3 = factor3 + [...]

@state factor1 = c(1)*factor1(-1) + c(2)*factor2(-1) + c(3)*factor3(-1) + [...]

@state factor2 = c(4)*factor1(-1) + c(5)*factor2(-1) + c(6)*factor3(-1) + [...]

@state factor3 = c(7)*factor1(-1) + c(8)*factor2(-1) + c(9)*factor3(-1) + [...]

...

### Re: principal component factor analysis

Posted: **Wed Mar 30, 2016 1:50 am**

by **JanRad**

Dear Trubador,

as I understand the two step procedure, you have to first estimate all the necessary inputs (parameters) and only than estimate a state space model using the parameters from step 1. This is also the main reason why I estimate VAR seperately.

Kind regards,

Jan

### Re: principal component factor analysis

Posted: **Wed Mar 30, 2016 3:51 am**

by **trubador**

I am not familiar with that methodology.