PCA - Getting back to orginal data

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

garyyau
Posts: 3
Joined: Sun Aug 04, 2013 8:51 am

PCA - Getting back to orginal data

Postby garyyau » Sun Aug 04, 2013 9:05 am

Hi regarding PCA I hope to transform the scores back to original data format using the top 3 PCs

I am quite new to the software (version 7) and am not aware that there is a function for this

Instead I was hoping to multiply the scores by the inverse the eigenvector matrix but the answer didnt look quite right (I transpose both the eigenvector matrix and the score matrix produced by the PCA function. I believe this is right?)

I am guessing that this is because operations has been done before PCA produce the eigenvector and scores (centering etc.)

Any tips on this? Thank you very much.

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: PCA - Getting back to orginal data

Postby EViews Glenn » Wed Aug 14, 2013 8:19 am

There's a make principal components scores proc off of a group.

garyyau
Posts: 3
Joined: Sun Aug 04, 2013 8:51 am

Re: PCA - Getting back to orginal data

Postby garyyau » Thu Aug 15, 2013 9:04 am

EViews Glenn wrote:There's a make principal components scores proc off of a group.


Hi Thanks for the reply.

Did you mean I could create the scores?

If so I have created the scores already. I am looking to going back to the original data using only PC 1 2 3

i.e. Let S = scores, E = eigenvector matrix, X = data

I got S = EX and I am hoping to get X = E^(-1)S but only using PC 1 2 3 rather than the whole E.

Thanks again

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: PCA - Getting back to orginal data

Postby EViews Glenn » Thu Aug 15, 2013 11:28 am

Tell EViews to retain only the first three components when you make the scores. See the docs for more details.

garyyau
Posts: 3
Joined: Sun Aug 04, 2013 8:51 am

Re: PCA - Getting back to orginal data

Postby garyyau » Fri Aug 16, 2013 10:00 am

EViews Glenn wrote:Tell EViews to retain only the first three components when you make the scores. See the docs for more details.


Hi thanks for the reply

The issue I am facing is after i created the matrix E with full eigenvectors / components, E^(-1)S did not produce the orignial data so I would imagine that doing E^(-1)S with PC 1 2 3 would not give the right answer neither

I am guessing that the original data had some operation done on it (e.g. centering etc.) so E^(-1)S would only give the modified original data, if you see what I mean. In a sense I am wondering if there is anyway to un-do those operations after E^(-1)S.

Thanks and sorry I did not make myself clear.

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: PCA - Getting back to orginal data

Postby CharlieEVIEWS » Mon Aug 19, 2013 6:59 am

I have also been wondering about this and cannot quite decipher the official EViews documentation (and accompanying theory): If I am not mistaken, the default .makepcomp(cov=corr) means EViews automatically standardizes the loadings, meaning we don't have to do something like:

Code: Select all

variable-@mean(variable)/@stdev(variable)


in a pre-amble to the .makepcomp command. However,if we were specifying the covariance option 'cov=cov', this would be necessary. Is that correct?

Thanks as always for clearing up my confusion!

Charlie

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: PCA - Getting back to orginal data

Postby EViews Glenn » Mon Aug 19, 2013 10:05 am

makepcomp mimics whatever the original transformation was in order to do the computation, since that is what the eigenvalues/vectors are dependent on. If you are doing correlations, then we first standardize prior to computing the scores. For covariances, we'll demean but not scale since the computation of the components is unscaled.

What we say in the docs is...

Code: Select all

...EViews will transform the Y to match the data used in the original computation. For example, the data will be scaled for analysis of correlation matrices, and partialing will remove means and any conditioning variables. Similarly, if the preliminary analysis involves Spearman rank-order correlations, the data are transformed to ranks prior to partialing.


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 19 guests