I've split my data set into a training and test set. I've performed a principal component analysis on the training set and have used the first 3 principal components to generate a logistic regression model for my response.
I now want to use this model to make predictions for my test data set and check if this is true.
I've been trying to use the predict function but obviously the model uses the principal components of the training set as the predictors whereas my test set just has all the original predictors so obviously they're not compatible.
How do I go about 'projecting' my test data onto the principal components I've already generated so I can use my model to make predictions?
Ideally I'd like to do this without using any external packages (it's for university). I am working in R.