I am trying to replicate PCA results from an external report, being a paid report I cant see exactly how the numbers are being calculated but I do have a good high level understanding. After a lot of hit and trial the below approach has brought me closest to matching the results:
#small subset from the data (interest rates) A1<-c(1.618,1.711,1.665,1.707,2.178,2.047,1.925,1.936,1.997,1.862) A2<-c(2.342,2.408,2.345,2.397,2.818,2.731,2.637,2.648,2.723,2.59) A3<-c(3.197,3.258,3.191,3.223,3.634,3.587,3.488,3.51,3.611,3.473) A4<-c(3.646,3.707,3.653,3.695,4.104,4.032,3.926,3.956,4.044,3.914) A5<-c(4.428,4.495,4.446,4.49,4.897,4.811,4.734,4.79,4.88,4.738) A6<-c(4.6,4.688,4.649,4.699,4.965,4.898,4.815,4.82,4.898,4.806) A7<-c(5.086,5.154,5.13,5.197,5.413,5.397,5.333,5.345,5.415,5.351) data<-cbind(A1,A2,A3,A4,A5,A6,A7) # do PCA on corr because this gives the best match of PC scores plot! corr<-cor(data) eg<-eigen(corr) evectors<-eg$vectors scores<- -1*(data %*% evectors) #flip sign to match report # below check does return approx zeros summary(data - (scores %*% t(evectors)))
The shape of plot of PC1, PC2 and PC3 scores from above matches uncannily with the ones in the report but the scale is completely different. By the way, the report calls them "PC Values", I am assuming it is same as PC Scores. The PC1 scores from above are around 10 (even though none of the inputs > 5.5), while the report has scores that are much closer to the input numbers. Given that first PC on interest rates represents the level of rates, the PC Scores will be much easier to interpret if I could scale down my PC scores to a level more in line with the input numbers? For example in the above subset, having PC score around 3.8 would be easier to understand and more intuitive.
Could someone please give me some pointers about what this transformation might be? I greatly appreciate any help/suggestions/comments.