State | Income | Illiteracy | LifeExp | Murder | HSGrad | StateAbb |
---|---|---|---|---|---|---|
Alabama | 3624 | 2.1 | 69.05 | 15.1 | 41.3 | AL |
Alaska | 6315 | 1.5 | 69.31 | 11.3 | 66.7 | AK |
Arizona | 4530 | 1.8 | 70.55 | 7.8 | 58.1 | AZ |
Arkansas | 3378 | 1.9 | 70.66 | 10.1 | 39.9 | AR |
California | 5114 | 1.1 | 71.71 | 10.3 | 62.6 | CA |
Colorado | 4884 | 0.7 | 72.06 | 6.8 | 63.9 | CO |
Connecticut | 5348 | 1.1 | 72.48 | 3.1 | 56.0 | CT |
Delaware | 4809 | 0.9 | 70.06 | 6.2 | 54.6 | DE |
Florida | 4815 | 1.3 | 70.66 | 10.7 | 52.6 | FL |
Georgia | 4091 | 2.0 | 68.54 | 13.9 | 40.6 | GA |
Hawaii | 4963 | 1.9 | 73.60 | 6.2 | 61.9 | HI |
Idaho | 4119 | 0.6 | 71.87 | 5.3 | 59.5 | ID |
Illinois | 5107 | 0.9 | 70.14 | 10.3 | 52.6 | IL |
Indiana | 4458 | 0.7 | 70.88 | 7.1 | 52.9 | IN |
Iowa | 4628 | 0.5 | 72.56 | 2.3 | 59.0 | IA |
Kansas | 4669 | 0.6 | 72.58 | 4.5 | 59.9 | KS |
Kentucky | 3712 | 1.6 | 70.10 | 10.6 | 38.5 | KY |
Louisiana | 3545 | 2.8 | 68.76 | 13.2 | 42.2 | LA |
Maine | 3694 | 0.7 | 70.39 | 2.7 | 54.7 | ME |
Maryland | 5299 | 0.9 | 70.22 | 8.5 | 52.3 | MD |
Massachusetts | 4755 | 1.1 | 71.83 | 3.3 | 58.5 | MA |
Michigan | 4751 | 0.9 | 70.63 | 11.1 | 52.8 | MI |
Minnesota | 4675 | 0.6 | 72.96 | 2.3 | 57.6 | MN |
Mississippi | 3098 | 2.4 | 68.09 | 12.5 | 41.0 | MS |
Missouri | 4254 | 0.8 | 70.69 | 9.3 | 48.8 | MO |
Montana | 4347 | 0.6 | 70.56 | 5.0 | 59.2 | MT |
Nebraska | 4508 | 0.6 | 72.60 | 2.9 | 59.3 | NE |
Nevada | 5149 | 0.5 | 69.03 | 11.5 | 65.2 | NV |
New Hampshire | 4281 | 0.7 | 71.23 | 3.3 | 57.6 | NH |
New Jersey | 5237 | 1.1 | 70.93 | 5.2 | 52.5 | NJ |
New Mexico | 3601 | 2.2 | 70.32 | 9.7 | 55.2 | NM |
New York | 4903 | 1.4 | 70.55 | 10.9 | 52.7 | NY |
North Carolina | 3875 | 1.8 | 69.21 | 11.1 | 38.5 | NC |
North Dakota | 5087 | 0.8 | 72.78 | 1.4 | 50.3 | ND |
Ohio | 4561 | 0.8 | 70.82 | 7.4 | 53.2 | OH |
Oklahoma | 3983 | 1.1 | 71.42 | 6.4 | 51.6 | OK |
Oregon | 4660 | 0.6 | 72.13 | 4.2 | 60.0 | OR |
Pennsylvania | 4449 | 1.0 | 70.43 | 6.1 | 50.2 | PA |
Rhode Island | 4558 | 1.3 | 71.90 | 2.4 | 46.4 | RI |
South Carolina | 3635 | 2.3 | 67.96 | 11.6 | 37.8 | SC |
South Dakota | 4167 | 0.5 | 72.08 | 1.7 | 53.3 | SD |
Tennessee | 3821 | 1.7 | 70.11 | 11.0 | 41.8 | TN |
Texas | 4188 | 2.2 | 70.90 | 12.2 | 47.4 | TX |
Utah | 4022 | 0.6 | 72.90 | 4.5 | 67.3 | UT |
Vermont | 3907 | 0.6 | 71.64 | 5.5 | 57.1 | VT |
Virginia | 4701 | 1.4 | 70.08 | 9.5 | 47.8 | VA |
Washington | 4864 | 0.6 | 71.72 | 4.3 | 63.5 | WA |
West Virginia | 3617 | 1.4 | 69.48 | 6.7 | 41.6 | WV |
Wisconsin | 4468 | 0.7 | 72.48 | 3.0 | 54.5 | WI |
Wyoming | 4566 | 0.6 | 70.29 | 6.9 | 62.9 | WY |
State | .fittedPC1 |
---|---|
Alabama | -3.4736429 |
Alaska | 0.5523458 |
Arizona | -0.3218179 |
Arkansas | -2.3518240 |
California | 0.9138319 |
Colorado | 1.7319349 |
Connecticut | 1.8293070 |
Delaware | 0.3708443 |
Florida | -0.4071974 |
Georgia | -3.2000232 |
Hawaii | 1.3275139 |
Idaho | 1.2443096 |
Illinois | -0.0586612 |
Indiana | 0.4059830 |
Iowa | 2.1960892 |
Kansas | 1.9256885 |
Kentucky | -2.2652570 |
Louisiana | -3.8826563 |
Maine | 0.4547571 |
Maryland | 0.2844478 |
Massachusetts | 1.3868972 |
Michigan | -0.1768465 |
Minnesota | 2.2025281 |
Mississippi | -4.0362219 |
Missouri | -0.3652702 |
Montana | 0.9359256 |
Nebraska | 2.0060961 |
Nevada | 0.4719808 |
New Hampshire | 1.1727342 |
New Jersey | 0.7618589 |
New Mexico | -1.6465196 |
New York | -0.4937635 |
North Carolina | -2.7036034 |
North Dakota | 1.9049237 |
Ohio | 0.3444655 |
Oklahoma | 0.0227251 |
Oregon | 1.8066483 |
Pennsylvania | -0.0242343 |
Rhode Island | 0.5548203 |
South Carolina | -3.7722712 |
South Dakota | 1.5131049 |
Tennessee | -2.1379510 |
Texas | -1.8743614 |
Utah | 2.0995090 |
Vermont | 0.8805572 |
Virginia | -0.8810536 |
Washington | 1.9687535 |
West Virginia | -1.7131805 |
Wisconsin | 1.5728437 |
Wyoming | 0.9429316 |
PC1 | PC2 | |
---|---|---|
Income | 0.3473146 | 0.7315324 |
Illiteracy | -0.4803318 | 0.0693093 |
LifeExp | 0.4685523 | -0.3243911 |
Murder | -0.4594049 | 0.4916219 |
HSGrad | 0.4669687 | 0.3363552 |
Income | Illiteracy | LifeExp | Murder | HSGrad | |
---|---|---|---|---|---|
Income | 1.000 | -0.437 | 0.340 | -0.230 | 0.620 |
Illiteracy | -0.437 | 1.000 | -0.588 | 0.703 | -0.657 |
LifeExp | 0.340 | -0.588 | 1.000 | -0.781 | 0.582 |
Murder | -0.230 | 0.703 | -0.781 | 1.000 | -0.488 |
HSGrad | 0.620 | -0.657 | 0.582 | -0.488 | 1.000 |
Std | Unstd | DifUnits | |
---|---|---|---|
Income | 0.3473 | 1.0000 | 0.0004 |
Illiteracy | -0.4803 | -0.0004 | -0.0007 |
LifeExp | 0.4686 | 0.0007 | 0.9999 |
Murder | -0.4594 | -0.0014 | -0.0059 |
HSGrad | 0.4670 | 0.0081 | 0.0096 |
prcomp
prcomp
prcomp
scale.=TRUE
when calling the function prcomp
prcomp
scale.=TRUE
when calling the function prcomp
StateSE%>% select_if(is.numeric)%>% #Only use numeric variables prcomp(scale. = TRUE)->pca #Do pca summary(pca) #summary of information
## Importance of components:## PC1 PC2 PC3 PC4 PC5## Standard deviation 1.7892 0.9686 0.6317 0.55561 0.39093## Proportion of Variance 0.6403 0.1876 0.0798 0.06174 0.03057## Cumulative Proportion 0.6403 0.8279 0.9077 0.96943 1.00000
prcomp
function is a prcomp object. prcomp
function is a prcomp object. prcomp
function is a prcomp object. x
rotation
biplot(pca)
pca$x
rownames(pca$x)<-pull(StateSE,StateAbb)biplot(pca)
biplot
produces the distance biplot.biplot(pca,scale = 0)
screeplot(pca,type="lines")
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |