Based on datacamp tutorial
mpg: Fuel consumption (Miles per (US) gallon): more powerful and heavier cars tend to consume more fuel.
cyl: Number of cylinders: more powerful cars often have more cylinders
disp: Displacement (cu.in.): the combined volume of the engines cylinders
hp: Gross horsepower: this is a measure of the power generated by the car
drat: Rear axle ratio: this describes how a turn of the drive shaft corresponds to a turn of the wheels. Higher values will decrease fuel efficiency.
wt: Weight (1000 lbs): pretty self-explanatory!
qsec: 1/4 mile time: the cars speed and acceleration
vs: Engine block: this denotes whether the vehicle’s engine is shaped like a “V”, or is a more common straight shape.
am: Transmission: this denotes whether the car’s transmission is automatic (0) or manual (1).
gear: Number of forward gears: sports cars tend to have more gears.
carb: Number of carburetors: associated with more powerful engines
## mpg cyl disp hp drat wt qsec vs am gear carb
## Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
## Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
After running the PCA these are this is a summary of how much each PC accounts for the whole dataset
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 2.3782 1.4429 0.71008 0.51481 0.42797 0.35184 0.32413
## Proportion of Variance 0.6284 0.2313 0.05602 0.02945 0.02035 0.01375 0.01167
## Cumulative Proportion 0.6284 0.8598 0.91581 0.94525 0.96560 0.97936 0.99103
## PC8 PC9
## Standard deviation 0.2419 0.14896
## Proportion of Variance 0.0065 0.00247
## Cumulative Proportion 0.9975 1.00000
## [1] 2.3782219 1.4429485 0.7100809 0.5148082 0.4279704 0.3518426 0.3241326
## [8] 0.2418962 0.1489644
Indicate the variables were shifted to be zero centered.
## mpg cyl disp hp drat wt qsec
## 20.090625 6.187500 230.721875 146.687500 3.596563 3.217250 17.848750
## gear carb
## 3.687500 2.812500
Indicate the variables were scaled to have unit variance before the analysis takes place.
## mpg cyl disp hp drat wt
## 6.0269481 1.7859216 123.9386938 68.5628685 0.5346787 0.9784574
## qsec gear carb
## 1.7869432 0.7378041 1.6152000
The relationship (correlation or anticorrelation) between the initial variables and the principal components
## mpg cyl disp hp drat wt
## 6.0269481 1.7859216 123.9386938 68.5628685 0.5346787 0.9784574
## qsec gear carb
## 1.7869432 0.7378041 1.6152000
## PC1 PC2 PC3 PC4 PC5
## Mazda RX4 -0.66422351 1.1734476 -0.20431724 -0.12601751 0.75200784
## Mazda RX4 Wag -0.63719807 0.9769448 0.11077779 -0.08567709 0.65668822
## Datsun 710 -2.29973601 -0.3265893 -0.21014955 -0.10862524 -0.07622329
## Hornet 4 Drive -0.21529670 -1.9768101 -0.32946822 -0.30806225 -0.24391787
## Hornet Sportabout 1.58697405 -0.8287285 -1.03299254 0.14738418 -0.22270405
## Valiant 0.04960512 -2.4466838 0.11177774 -0.87154914 -0.12574876
## Duster 360 2.71439677 0.3610529 -0.65206041 0.09633337 0.29674234
## Merc 240D -2.04370658 -0.8006412 0.84898795 -0.27451338 -0.26307848
## Merc 230 -2.29506729 -1.3056004 1.96848450 0.05055875 -0.45988113
## Merc 280 -0.38252133 0.5811211 0.88632274 0.07026946 0.45835852
## Merc 280C -0.36652708 0.4121971 1.14860950 0.06150898 0.48309076
## Merc 450SE 1.88466875 -0.7241198 -0.20604588 -0.21856675 0.27996207
## Merc 450SL 1.67107231 -0.7144354 -0.32644071 -0.28933625 0.28061777
## Merc 450SLC 1.77692371 -0.8411687 -0.08557921 -0.28421711 0.34961695
## Cadillac Fleetwood 3.64958983 -0.9480878 0.88315862 0.21645793 -0.34788247
## Lincoln Continental 3.71033756 -0.8426945 0.93230325 0.34099021 -0.34260485
## Chrysler Imperial 3.33196300 -0.4805609 0.67061959 0.65189724 -0.43940743
## Fiat 128 -3.45236266 -0.4327074 -0.22604214 0.10018032 -0.33470301
## Honda Civic -3.85477722 0.7084152 -0.22670973 1.19340342 0.53954318
## Toyota Corolla -3.85488283 -0.3872111 -0.25488964 0.21962306 -0.30372397
## Toyota Corona -1.90375523 -1.5725638 0.06620424 0.07989679 0.50126570
## Dodge Challenger 1.80402354 -1.1340965 -1.00776416 -0.58796239 0.09903732
## AMC Javelin 1.46483534 -0.9777629 -0.76680342 -0.03308788 0.26871378
## Camaro Z28 2.60135738 0.7649595 -0.48915140 0.95247550 0.53065965
## Pontiac Firebird 1.87424485 -0.9791561 -0.89787633 0.22438738 -0.50770999
## Fiat X1-9 -3.14830645 -0.2552569 -0.36230545 0.06406082 0.03361267
## Porsche 914-2 -2.77939557 1.6373369 -0.35969974 0.31886540 -0.43251030
## Lotus Europa -2.90895427 1.3962368 -0.91635036 -0.90254314 -0.75861156
## Ford Pantera L 1.54812696 3.0206982 -0.51945216 0.86560850 -0.86048411
## Ferrari Dino 0.08049995 2.8346567 0.34481747 -1.14659658 0.29944552
## Maserati Bora 2.96252801 3.9993896 0.70296512 -0.73000448 -0.22756074
## Volvo 142E -1.90443632 0.1084190 0.39906976 0.31285789 0.11738974
## PC6 PC7 PC8 PC9
## Mazda RX4 -0.12506777 -0.42357334 -0.003259165 -0.167051112
## Mazda RX4 Wag -0.06619437 -0.44849307 0.056643244 -0.071592094
## Datsun 710 -0.56693648 0.38612406 -0.202035744 0.114505030
## Hornet 4 Drive 0.08382435 0.03299362 -0.023714111 -0.145255757
## Hornet Sportabout 0.18280435 -0.05793795 0.152342587 -0.154646072
## Valiant -0.23043022 0.22451528 0.098663134 -0.004233901
## Duster 360 0.27763557 0.44227307 -0.306373481 -0.186980810
## Merc 240D -0.19042527 -0.39416400 -0.187088365 -0.010461330
## Merc 230 0.20443847 0.53713423 0.413455512 -0.169005773
## Merc 280 -0.07984989 -0.26113412 0.204105964 0.110461785
## Merc 280C -0.16066456 -0.07979514 0.352641772 0.027108266
## Merc 450SE 0.17135058 -0.08914480 0.092140434 0.396034809
## Merc 450SL 0.33682412 0.03346598 0.182323579 0.196526577
## Merc 450SLC 0.13926264 0.20632469 0.295340402 0.147796262
## Cadillac Fleetwood -0.24002207 -0.31053111 -0.171865268 -0.251117818
## Lincoln Continental -0.22646211 -0.28589695 -0.239313268 -0.028994385
## Chrysler Imperial 0.31045750 -0.38304409 -0.359765688 0.223097923
## Fiat 128 0.57303421 -0.24650594 -0.066340528 0.220271421
## Honda Civic 0.37207104 -0.20055288 0.087333576 -0.241702175
## Toyota Corolla 0.83750899 -0.10186868 0.104053562 0.042833437
## Toyota Corona -0.07212137 0.74680802 -0.408144457 -0.082722856
## Dodge Challenger -0.33920894 -0.14045443 0.156086022 -0.050247532
## AMC Javelin -0.31479492 0.03753417 0.370979414 -0.043466032
## Camaro Z28 0.05970074 0.38212238 -0.289612990 0.082069840
## Pontiac Firebird 0.20785973 -0.32709161 0.027471038 -0.130958896
## Fiat X1-9 -0.09586730 0.10352270 -0.020876499 0.021084764
## Porsche 914-2 -0.69006515 -0.26313120 -0.105695694 0.085027267
## Lotus Europa 0.05473409 -0.03491081 -0.236552376 -0.046341050
## Ford Pantera L -0.50704173 0.37940892 0.548070377 0.053196712
## Ferrari Dino -0.08124583 -0.26924964 -0.123537656 -0.047915313
## Maserati Bora 0.65580986 0.49422807 -0.082329298 -0.053112079
## Volvo 142E -0.48091826 0.31102454 -0.315146031 0.165790892