I need to compute Hotelling T2 and SPE (Q), after the PCA analysis. I did it using the pca function from library mdatools, but I see the PC computed are different from the one computed by prcomp or princomp functions. Why?
library(mdatools)
NF4.3.pca4 <- pca(NF4.3, ncomp = 15, center = T, scale = T)
res <- NF4.3.pca4$calres
NF4.3.pca <- prcomp(NF4.3, center = T, scale. = T) #different eigenvalues
Is there another way to calculate T2 and SPE from principal components?
Data:
ASSORB_CAT1;ASSORB_CAT3;ASSORB_VOLANO;AZOTO_IN
0.03662109;23.55957;-12.30469;39.3
0;25.36621;-11.09619;39.2
-0.02441406;21.92383;-11.26709;39.2
-0.02441406;23.10791;-11.07178;39.1
-0.04882813;22.81494;-10.57129;39.59975
0;24.24316;-11.23047;39.89737
0;22.63184;-11.43799;39.8
-0.04882813;24.34082;-13.61084;39.5
0;21.83838;-11.1084;39.4
0;24.3042;-12.08496;39.3
0;24.67041;-12.40234;39.3