# Principal Component analysis - SVD U matrix projection

I have a bit mathematical question I am interested in. Principal component analysis (PCA) has mathematically multiple solutions. One way is to use SVD.

I have prepared an example bellow. I am curious when I plot U matrix observations relative positions are exactly the same relatively to each other. However when we use prcom function that thas PCA analysis and we use X matrix.

We can see that observation positions on PC1 and PC2 low-dimmensional space are (relatively) the same as with U matrix in SVD. Only different thing is scalling.

I now that to obtain the same values as in the X matrix from prcom function we need to get matrix product of (Centered) observation and VT matrix from SVD.

My question is if this step product of C and VT is really necessary taking into account that observations relative position is the same.


library(tidyverse)
library(datasets)
library(matrixStats)

# Loading The Data
X <- as.data.frame(datasets::USArrests)

# Centering the data - Z-standardization
C <- t(t(X) - colMeans(X))
C <- t(t(C) / colSds(C))

# SVD
SVD_REs <- svd(C)

V <-
SVD_REs %>%
broom::tidy(matrix = 'v') %>%
pivot_wider(names_from = PC,
values_from = value,
names_prefix = 'PC') %>%
mutate(column = colnames(X)[column])

U <-
SVD_REs %>%
broom::tidy(matrix = 'u') %>%
pivot_wider(names_from = PC,
values_from = value,
names_prefix = 'PC') %>%
mutate(row = rownames(X)[row])

U %>%
ggplot(aes(PC1, PC2, label  = row)) +
geom_point() +
geom_text()

# NOW USE PCA build-in function
PCA_FUN <- prcomp(X, center = T, scale. = T)

# Their relative possition is Same as in U matrix. However, scaling is different
PCA_FUN\$x %>%
as.data.frame() %>%
ggplot(aes(PC1, PC2, label = rownames(.))) +
geom_point() +
geom_text()

$$$$
`
• Could you please tell us what "C" refers to and what a "step product" might be? – whuber Nov 6 '20 at 15:49
• C is centered Data matrix. and step product should have been written matrix multiplication. – Petr Nov 6 '20 at 15:51