# Is it possible to get the transformation PrincipalComponents uses to transform data?

As far as I can see PrincipalComponents[data] just gives data in the principal component basis. The problem is that after this, I would like to transform new data into the same basis, which requires that I know the actual principal components.

There is the option of calculating Eigenvectors[Covariance[data]] (given the data is centered on the origin) but for the eigenvectors I get this way the signs are usually different from the ones that the PrincipalComponents[] function uses.

Is there an easy way of getting the actual transformation used or transforming new data into the PC basis of the previous dataset?

-

You can do it with FindGeometricTransform[]:

data = {{13.2, 200, 58, 21.2}, {10, 263, 48, 44.5}, {8.1, 294, 80, 31},
{8.8, 190, 50, 19.5}, {9, 276, 91, 40.6}, {7.9, 204, 78, 38.7},
{3.3, 110, 77, 11.1}, {5.9, 238, 72, 15.8}, {15.4, 335, 80, 31.9}, {17.4, 211, 60, 25.8}};
{error, f} = FindGeometricTransform[PrincipalComponents[data], data];
Norm[PrincipalComponents[data][[1]] - f[data[[1]]]]
(*
0.8
*)


-