principal component factor analysis
Moderators: EViews Gareth, EViews Moderator

 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?
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?
But I want to do a rolling forecast and therefore I need the code for saving component scores.
Can anyone help me?

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12501
 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.
Follow us on Twitter @IHSEViews
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+!window2
' estimate VAR
sektoren.pcomp(cor, eigvale=v1, eigvec=m1) pc
' 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+!window2
' estimate VAR
sektoren.pcomp(cor, eigvale=v1, eigvec=m1) pc
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?
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
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
Thanks for the quick response. I had initially thought it was a state space model, but the paper I am following outlines a twostage model:
We estimate the DFM using the twostep 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
reestimate 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.
We estimate the DFM using the twostep 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
reestimate 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
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
Thanks Trubador.
I will switch over to Matlab to finish up the calcuation.
I will switch over to Matlab to finish up the calcuation.
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 varcovar 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 varcovar matix. In step 2 I estimated a statespace 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 reestimated factors in step 2 in order to obtain the hstep ahead forecast for GDP. Does it mean that I have to reestimate statespace 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
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 varcovar 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 varcovar matix. In step 2 I estimated a statespace 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 reestimated factors in step 2 in order to obtain the hstep ahead forecast for GDP. Does it mean that I have to reestimate statespace 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
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
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
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
I am not familiar with that methodology.
Who is online
Users browsing this forum: No registered users and 5 guests