## principal component factor analysis

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

researcher
Posts: 1
Joined: Sat Nov 21, 2009 11:45 pm

### principal component factor analysis

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?

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: principal component factor analysis

Besides the users guide, the following posts might also help: Post-1 and Post-2

oek_stat
Posts: 11
Joined: Thu Sep 30, 2010 1:11 am

### Re: principal component factor analysis

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?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12416
Joined: Tue Sep 16, 2008 5:38 pm

### Re: principal component factor analysis

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

oek_stat
Posts: 11
Joined: Thu Sep 30, 2010 1:11 am

### Re: principal component factor analysis

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

Sammoland
Posts: 18
Joined: Tue Mar 01, 2016 6:41 am

### Re: principal component factor analysis

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?

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: principal component factor analysis

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

Sammoland
Posts: 18
Joined: Tue Mar 01, 2016 6:41 am

### Re: principal component factor analysis

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
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.

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: principal component factor analysis

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.

Sammoland
Posts: 18
Joined: Tue Mar 01, 2016 6:41 am

### Re: principal component factor analysis

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

Posts: 2
Joined: Wed Mar 30, 2016 12:14 am

### Re: principal component factor analysis

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

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: principal component factor analysis

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) + [...]...`

Posts: 2
Joined: Wed Mar 30, 2016 12:14 am

### Re: principal component factor analysis

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

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: principal component factor analysis

I am not familiar with that methodology.