Call the USArrests data set into R and answer the following questions. Below are
ID: 3582997 • Letter: C
Question
Call the USArrests data set into R and answer the following questions. Below are the following variables Murder represents Murder arrests (per 100,000) Assault represents Assault arrests (per 100,000) UrbanPop represents Percent urban population Rape represents Rape arrests (per 100,000) R>USArrests R> arrests = as.data.frame(USArrests) Produce a principle components analysis. State the equations of the new variables that are formed. Produce a table of the proportion and cumulative proportion of variance explained by each principle component. Produce a scree-plot of the principle componentsExplanation / Answer
(A) R> arrest_pca <- prcomp(arrests, scale. = T)
R> names(arrest_pca)
(B)
#outputs the mean of variables
R>arrest_pca$center
#outputs the standard deviation of variables
R>arrest_pca$scale
(C)
#follow follwing steps for scree plot
R> std_dev <- arrest_pca$sdev
R> pr_var <- std_dev^2
R>prop_varex <- pr_var/sum(pr_var)
R> plot(prop_varex, xlab = "Principal Component",
ylab = "Proportion of Variance Explained",
type = "b")
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.