Hi all,
I am working with panel data (t=12, N=13) in order to obtain an index. There are 13 indicators that I want to include in this index. I divided these 13 indicators into 3 main subcategories based on economic theory. Now I want to perform PCA in order to test if I divided the indicators correctly and in order to decide upon the weight each subcategory and each indicator should get.
When I perform PCA, I obtain 13 components of which 3 determine 47% and 4 determine 58%, giving me the idea that I should use 4 categories. However, I do not know how to translate the PCA output into weights. For example, if variable x has the highest eigenvector (loading) in component 1, how do I know what its weight within component 1 will be. Just summing up the eigenvector loadings of all the variables that should be in component 1 does not equal 100%. I read something about rotating factors loadings but I am totally not familiar with this.
Can someone help me?
Many thanks,
Nienke
Obtaining weights with Principal component analysis
Moderators: EViews Gareth, EViews Moderator

 Posts: 1
 Joined: Mon May 23, 2016 4:43 am

 EViews Developer
 Posts: 2601
 Joined: Wed Oct 15, 2008 9:17 am
Re: Obtaining weights with Principal component analysis
I'm not entirely sure what it is you want to do, but my best guess from the question is that you want to make the component scores. You can use the group procedure Proc/Make Principal Components... to make the component scores. There are options to make variants of the scores which have different variance properties.
Re: Obtaining weights with Principal component analysis
Hi there,
I have a very similar question on PCA to the original here so hopefully this is the right place to post this.
I have run covariance PCA on a set of normalised data and extracted the eigenvectors, eigenvalues and the first principle component. What I am struggling with is if I apply the following transformation: (1) take the first eigenvector and transpose this into a diagonal matrix (2) multiply this by the underlying data (3) sum the rows of this matrix to get back to the first principle component, the summed series is always consistently out by a factor versus the EViews computed PC1??
If I do the same process with correlation PCA then I end up with the summed rows being different to the EViews PC1 by a different amount each period.
Is there something that I am missing in the calculation of the principle components which would mean that the sum of the (evec*underlying data) does not equilibrate to the EViews estimated principle component?
For context I am trying to understand the contribution of each series to the PC1 in each time period so that I can see how the relevance of series in my dataset changes overtime.
Unfortunately I cannot share my work file due to data privileges but hopefully the explanation above is clear enough.
Thanks in advance,
Abi
I have a very similar question on PCA to the original here so hopefully this is the right place to post this.
I have run covariance PCA on a set of normalised data and extracted the eigenvectors, eigenvalues and the first principle component. What I am struggling with is if I apply the following transformation: (1) take the first eigenvector and transpose this into a diagonal matrix (2) multiply this by the underlying data (3) sum the rows of this matrix to get back to the first principle component, the summed series is always consistently out by a factor versus the EViews computed PC1??
If I do the same process with correlation PCA then I end up with the summed rows being different to the EViews PC1 by a different amount each period.
Is there something that I am missing in the calculation of the principle components which would mean that the sum of the (evec*underlying data) does not equilibrate to the EViews estimated principle component?
For context I am trying to understand the contribution of each series to the PC1 in each time period so that I can see how the relevance of series in my dataset changes overtime.
Unfortunately I cannot share my work file due to data privileges but hopefully the explanation above is clear enough.
Thanks in advance,
Abi

 EViews Developer
 Posts: 2601
 Joined: Wed Oct 15, 2008 9:17 am
Re: Obtaining weights with Principal component analysis
I must admit that I don't entirely understand what you are trying to do with your calculation. The following shows the equivalence between postmultiplying the data by the eigenvectors and the score series created using normalize loadings scaling. Note that as expected the average sum of the squared scores equals the corresponding eigenvalue.
Code: Select all
workfile u 1000
group group01
for !i = 1 to 3
series a!i = nrnd
a!i = (a!i  @mean(a!i))/@stdevp(a!i)
group01.add a!i
next
stom(group01, yy)
freeze(pcomp) group01.pcomp(cov=cov, eigval=abc1, eigvec=abc2)
matrix v1 = yy*abc2
group01.makepcomp(cov=cov) v1a v1b v1c
group v1alt v1a v1b v1c
vector ev = @csumsq(v1)/@rows(v1)
Re: Obtaining weights with Principal component analysis
Thank you for your response Glenn  I have managed to obtain what i wanted to calculate from your code.
I did have another more general question  i understand that EViews can report both the loadings and the eigenvectors, why would these be the same when using the covariance method of PCA?
Thanks,
Abi
I did have another more general question  i understand that EViews can report both the loadings and the eigenvectors, why would these be the same when using the covariance method of PCA?
Thanks,
Abi
Re: Obtaining weights with Principal component analysis
Hi there,
I would like to obtain the minimum average partial statistic for PCA so that I can ascertain the 'optimal' number of principle components to retain. I am aware that this is a built in function for choosing the optimal number of factors in the factor analysis tool but I was wondering how I would apply this to principle component analysis?
Will I need to write the code myself?
Thanks,
Abigail
I would like to obtain the minimum average partial statistic for PCA so that I can ascertain the 'optimal' number of principle components to retain. I am aware that this is a built in function for choosing the optimal number of factors in the factor analysis tool but I was wondering how I would apply this to principle component analysis?
Will I need to write the code myself?
Thanks,
Abigail

 Posts: 46
 Joined: Sat Apr 22, 2017 8:23 pm
Re: Obtaining weights with Principal component analysis
awatt43 wrote:I did have another more general question  i understand that EViews can report both the loadings and the eigenvectors, why would these be the same when using the covariance method of PCA?
The reason that loadings and eigenvectors can sometimes be identical is because a loading vector is just a scaled version of the eigenvector. Typically, this scaling is some kth root of the associated eigenvalue. However, when that scaling is unity, a loading vector is an eigenvector
awatt43 wrote:I would like to obtain the minimum average partial statistic for PCA...Will I need to write the code myself?
This is, at the moment, a yes. Beyond the scree plot analysis, EViews currently does not implement any datadriven protocol for dimension reduction.
If you would like to read more about the use of PCA using EViews, please see our two part blog post. There, we also implement a brief code to adapt the Bai and Ng factor selection protocol to PCA.
PCA Part I (Theory): http://blog.eviews.com/2018/10/principalcomponentanalysisparti.html
PCA Part II (Practice): http://blog.eviews.com/2018/11/principalcomponentanalysispartii.html
Who is online
Users browsing this forum: No registered users and 4 guests