# PCA with manually given PC1

I am using R function prcomp to do PCA on my data set. I wonder if i want to force the pc1 direction as given and perform the PCA analysis on the rest, how can i do it.

Thanks.

Let me reformulate your question: you want to do a PCA on the subspace that is orthogonal to a given direction PC1 $$\vec{p}_1$$.
You can project every data point $$\vec{x}$$ on that subspace by $$\vec{x}_{proj} = \vec{x} - \langle \vec{x},\vec{p}_1\rangle\cdot \vec{p}_1$$ where $$\langle.,.\rangle$$ denotes the scalar product. Then simply do a PCA on the projected data. Note that the R function prcomp will return $$\vec{p}_1$$ as the last direction, so you should ignore the last returned column.
• +1. This is a nice generalization of the usual option of centering the data before performing PCA, which is the case $p_1 = (1,1,\ldots, 1).$ Your solution can be further generalized to multiple given "principal components" simply by regressing the data (as a multivariate response) against the set of given components and performing PCA on the residuals.
• this is missing a $\vec{p_1}$ which multiplies the inner product. Jan 24, 2023 at 15:59