A PCA example – US Arrests

As an example, here is the correlation matrix plot for US Arrests, corresponding to the number of arrests per 100,000 residents for assault, murder, and rape in each of the 50 US states in 1973. Also given is the percent of the population living in urban areas. The USArrests dataset should be loaded automatically as part of the datasets package.

You can get description of the USArrests dataset by entering the help command? USArrests dataset at the console.

To see the correlation between all of the variables, enter the following on the console line:

library(datasets) pairs(USArrests)  

The output is shown here:

Get Practical Predictive Analytics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.