Aan de slagGa gratis aan de slag

Using the princomp function

In this exercise you will use the princomp() function to calculate the principal components (PCs) of a dataset. We will use the pca.state object created in this exercise throughout the rest of this chapter.

Deze oefening maakt deel uit van de cursus

Multivariate Probability Distributions in R

Cursus bekijken

Oefeninstructies

  • Calculate the principal components, and the scores of the PCs, of the state.x77 dataset based on the correlation matrix and store it as pca.state.
  • Provide a plot and print the summary of the principal component object.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate PCs
pca.state <- princomp(___, cor = ___, scores = ___) 

# Plot the PCA object  
plot(___) 

# Print the summary of the PCs
summary(___) 
Code bewerken en uitvoeren