AM 6
Question 9.1
Using the same crime data set uscrime.txt as in Question 8.2, apply Principal Component
Analysis and then create a regression model using the first few principal components. Specify
your new model in terms of the original variables (not the principal components), and compare
its quality to that of your solution to Question 8.2. You can use the R function prcomp for PCA.
(Note that to first scale the data, you can include scale. = TRUE to scale as part of the PCA
function. Don’t forget that, to make a prediction for the new city, you’ll need to unscale the
coefficients (i.e., do the scaling calculation in reverse)!)
Based off the plot, the first ff pcs are good since it is above the STD. Setting this number, we can
build the model (shown in the code below)
We can then run the same variables from the previous HW and compare the 2 models. The
model transformation is shown in the code below.
about:blan 1/
k 4