April 2017
Beginner to intermediate
420 pages
9h 58m
English
To extract the components with the psych package, you will use the principal() function. The syntax will include the data and whether or not we want to rotate the components at this time:
> pca <- principal(train.scale, rotate="none")
You can examine the components by calling the pca object that we created. However, my primary intent is to determine what should be the number of components to retain. For that, a scree plot will suffice. A scree plot can aid you in assessing the components that explain the most variance in the data. It shows the Component number on the x-axis and their associated Eigenvalues on the y-axis:
> plot(pca$values, type="b", ylab="Eigenvalues", xlab="Component")
The following is the output ...
Read now
Unlock full access