I'm doing principal component analysis to reduce number of variables for my regression model with low number of data sets & high number of independent variables (around 40 independent variables).
I'm using the function princomp
to generate the principal component as I have correlations between independent variables.But I don't know how to use princomp output based on the number of PCA.I'm interested in using a subset of the Principal Components for prediction
Can you please help me?
Thanks in advance