diff --git a/assignment5.Rmd b/assignment5.Rmd index 288bcb3..3414c19 100644 --- a/assignment5.Rmd +++ b/assignment5.Rmd @@ -16,7 +16,7 @@ The data you will be using comes from the Assistments online intelligent tutorin ## Start by uploading the data ```{r} -D1 <- +D1 <- read.csv("Assistments-confidence.csv", header = TRUE) ``` @@ -38,7 +38,9 @@ ggcorr(D1[,-1], method = c("everything", "pearson")) #ggcorr() doesn't have an e ## Create a new data frame with the mean_correct variable removed, we want to keep that variable intact. The other variables will be included in our PCA. ```{r} -D2 <- +library(tidyr) +library(dplyr) +D2 <- select(D1, id, prior_prob_count, prior_percent_correct, problems_attempted, mean_hint, mean_attempt, mean_confidence) ``` @@ -73,15 +75,22 @@ plot(pca, type = "lines") ```{r} #Now, create a data frame of the transformed data from your pca. -D3 <- +pca$x +D3 <- pca$x #Attach the variable "mean_correct" from your original data frame to D3. - +D3 <- data.frame(D3, D1$mean_correct) #Now re-run your correlation plots between the transformed data and mean_correct. If you had dropped some components would you have lost important infomation about mean_correct? - +plot(D3$PC1, D3$D1.mean_correct) +plot(D3$PC2, D3$D1.mean_correct) +plot(D3$PC3, D3$D1.mean_correct) +plot(D3$PC4, D3$D1.mean_correct) +plot(D3$PC5, D3$D1.mean_correct) +plot(D3$PC6, D3$D1.mean_correct) +plot(D3$PC7, D3$D1.mean_correct) ``` ## Now print out the loadings for the components you generated: diff --git a/assignment5.html b/assignment5.html new file mode 100644 index 0000000..37e670d --- /dev/null +++ b/assignment5.html @@ -0,0 +1,1233 @@ + + + + + + + + + + + + + +Principle Component Aanalysis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+

Data

+

The data you will be using comes from the Assistments online intelligent tutoring system (https://www.assistments.org/). It describes students working through online math problems. Each student has the following data associated with them:

+ +
+
+

Start by uploading the data

+
D1 <- read.csv("Assistments-confidence.csv", header = TRUE)
+
+
+

Create a correlation matrix of the relationships between the variables, including correlation coefficients for each pair of variables/features.

+
#You can install the corrplot package to plot some pretty correlation matrices (sometimes called correlograms)
+
+library(ggplot2)
+library(GGally)
+
## Registered S3 method overwritten by 'GGally':
+##   method from   
+##   +.gg   ggplot2
+
ggpairs(D1, 2:8, progress = FALSE) #ggpairs() draws a correlation plot between all the columns you identify by number (second option, you don't need the first column as it is the student ID) and progress = FALSE stops a progress bar appearing as it renders your plot
+

+
ggcorr(D1[,-1], method = c("everything", "pearson")) #ggcorr() doesn't have an explicit option to choose variables so we need to use matrix notation to drop the id variable. We then need to choose a "method" which determines how to treat missing values (here we choose to keep everything, and then which kind of correlation calculation to use, here we are using Pearson correlation, the other options are "kendall" or "spearman")
+

+
#Study your correlogram images and save them, you will need them later. Take note of what is strongly related to the outcome variable of interest, mean_correct. 
+
+
+

Create a new data frame with the mean_correct variable removed, we want to keep that variable intact. The other variables will be included in our PCA.

+
library(tidyr)
+library(dplyr)
+
## 
+## Attaching package: 'dplyr'
+
## The following objects are masked from 'package:stats':
+## 
+##     filter, lag
+
## The following objects are masked from 'package:base':
+## 
+##     intersect, setdiff, setequal, union
+
D2 <- select(D1, id, prior_prob_count, prior_percent_correct, problems_attempted, mean_hint, mean_attempt, mean_confidence)
+
+
+

Now run the PCA on the new data frame

+
pca <- prcomp(D2, scale. = TRUE)
+
+
+

Although princomp does not generate the eigenvalues directly for us, we can print a list of the standard deviation of the variance accounted for by each component.

+
pca$sdev
+
## [1] 1.4502917 1.1428589 1.0462819 0.9976299 0.8557032 0.7385185 0.4721430
+
#To convert this into variance accounted for we can square it, these numbers are proportional to the eigenvalue
+
+pca$sdev^2
+
## [1] 2.1033459 1.3061264 1.0947058 0.9952654 0.7322279 0.5454096 0.2229190
+
#A summary of our pca will give us the proportion of variance accounted for by each component
+
+summary(pca)
+
## Importance of components:
+##                           PC1    PC2    PC3    PC4    PC5     PC6     PC7
+## Standard deviation     1.4503 1.1429 1.0463 0.9976 0.8557 0.73852 0.47214
+## Proportion of Variance 0.3005 0.1866 0.1564 0.1422 0.1046 0.07792 0.03185
+## Cumulative Proportion  0.3005 0.4871 0.6434 0.7856 0.8902 0.96815 1.00000
+
#We can look at this to get an idea of which components we should keep and which we should drop
+
+plot(pca, type = "lines")
+

+
+
+

Decide which components you would drop and remove them from your data set.

+
+
+

Part II

+
#Now, create a data frame of the transformed data from your pca.
+
+pca$x
+
##                PC1          PC2          PC3          PC4          PC5
+##   [1,] -2.30616442  2.786911335 -0.325549561  0.263528489  0.094533433
+##   [2,] -4.76665364  1.561609134  1.240408446  0.909579260 -0.679373877
+##   [3,] -4.44304196  2.143963328 -0.233662648  0.565054726  0.030617926
+##   [4,] -3.80821746  2.693067105  0.629066160  0.737545364 -0.422673798
+##   [5,] -5.02464093  1.565384826 -0.831062279  1.561688025  0.496988405
+##   [6,] -4.87538155  2.601004349 -0.352467361 -0.073722369 -0.611790550
+##   [7,] -4.29756022  0.429482229 -1.202155056  1.201320777  0.015196610
+##   [8,] -5.39863518 -0.318996906 -1.174216454  0.189852644  0.701730669
+##   [9,] -4.04896156  0.250064068 -0.069760427  0.129464665 -0.496445115
+##  [10,] -5.32153772  1.509611805 -0.684932333 -0.103668470 -0.497659015
+##  [11,] -4.51557739  1.770200990 -0.018925201  1.535887130 -0.134491593
+##  [12,] -4.87490608  1.331211177  0.418257483  0.297216005 -0.818618663
+##  [13,] -4.01356246  3.246903075  0.161031048 -0.572866590 -0.353108788
+##  [14,] -4.73580118  1.875426621 -0.066004309  0.231685698 -0.201043126
+##  [15,] -4.95908671  1.209249436 -0.038225894  1.429733633 -0.490998668
+##  [16,] -4.85940784 -0.676205038 -1.188761764  0.757789132 -0.760870999
+##  [17,] -7.96019777 -4.455216776 -1.959747004 -4.176267695  7.213690603
+##  [18,] -1.37041120  2.141222190 -0.912468185 -0.034760827 -0.022911589
+##  [19,] -1.50032241  2.521913839  1.128721264  2.326259048  0.746217654
+##  [20,] -1.39077392  2.865549430  0.610681218  0.303342227  0.264127891
+##  [21,] -1.71554938  3.370685247  0.215769814 -0.692910302 -0.088587250
+##  [22,] -1.18296258  1.481922956  0.027190465 -0.444059623 -0.028081525
+##  [23,] -0.11270659  1.689979735 -0.088785131  1.401947735 -0.017216600
+##  [24,] -2.03293772  1.976188221  0.829155488  1.648632530  0.467687303
+##  [25,] -0.91471840  2.394857395 -0.126850202 -0.556557020 -0.093833665
+##  [26,] -2.32488627  1.834839129 -0.184685820 -0.466278368  0.114657282
+##  [27,] -1.61023661  1.588158982 -0.419416050  0.109473429 -0.203660538
+##  [28,] -1.31432519  2.727429221  0.630621626  0.578616036  0.312103499
+##  [29,] -1.62390078  2.560263562  0.261396901  0.359118416 -0.013226205
+##  [30,]  0.30650843  1.324944527  0.700532059 -0.092086172  0.485968537
+##  [31,] -0.08115666  0.643664588  0.354676791  0.049475359 -0.148361425
+##  [32,] -0.91310037 -0.171504795 -0.448902076  1.108990048  0.425646617
+##  [33,] -0.09643709  0.591268314  0.429169724  0.389637111  0.442079152
+##  [34,]  0.12161978  1.242843307 -0.076926307 -1.266533598 -0.336926123
+##  [35,]  0.18726345  0.818116443  0.881647872  0.950548706  0.381105316
+##  [36,]  0.14832977  1.204815833  0.455199903 -0.624086574  0.295257449
+##  [37,]  0.35278855  1.346718527  1.098062139  0.140979456  0.690434292
+##  [38,] -0.51291391  0.251069417  1.006009491 -0.166416621  0.607604170
+##  [39,] -1.04885045 -0.046454524 -1.871035252 -1.208187026 -0.590564688
+##  [40,]  0.42373845  1.117246620  0.347111422  1.216042743  0.289519722
+##  [41,]  0.07672395  0.806593790  0.148676772  0.531394667  0.953439545
+##  [42,]  0.24126901  1.203686849  1.209256839 -0.071668747  0.382199787
+##  [43,] -1.49551578 -0.609417805  1.590546084 -1.352099003 -1.442827502
+##  [44,] -2.63618761 -1.573844079 -0.604248108 -1.297810632 -2.040093521
+##  [45,] -2.40745348 -2.110454148 -0.354820925  0.919961003 -1.275810310
+##  [46,] -0.85802113 -0.274838930  1.434212812 -0.586556720 -0.571143997
+##  [47,]  0.30650218  1.420217040  0.625603117 -0.475812114  0.400776003
+##  [48,]  0.11307626  1.159954821  0.247652875 -0.600945935  0.206567362
+##  [49,] -1.15816842 -0.320405037  0.137028519 -0.462803869 -0.318959696
+##  [50,] -0.27720780  0.809185649 -0.605659876 -1.226269800 -0.384466417
+##  [51,]  0.20115452  1.447970312 -1.000273329 -1.487114543 -0.278137696
+##  [52,] -2.26300915 -1.326819782 -0.700156252 -0.308274954 -0.248790065
+##  [53,] -0.57238529 -0.278822765  2.478376390  0.327681836 -1.040534158
+##  [54,] -0.69715447 -0.074477835  0.396342644 -0.596972204 -0.218334534
+##  [55,] -0.54999919 -0.235762912  0.916297109  1.458807463  1.092335885
+##  [56,] -0.68693528  0.420336189  0.285803758 -1.858975739 -0.444864902
+##  [57,]  0.18549867  0.557712220  0.555013264  1.432543141  1.263890317
+##  [58,] -0.28564277  0.217874456  0.900060210  0.201555866 -0.019083787
+##  [59,] -0.14388747  0.624426410  0.810147762  0.222622033  0.063406618
+##  [60,]  0.04495435  1.194500943  0.255116954 -1.009670994  0.144530383
+##  [61,] -1.46366786 -1.319364501  0.207799631  0.282109863 -1.294426916
+##  [62,]  0.09488828  0.510433000  1.314597300  1.544291721  0.487257813
+##  [63,] -0.69687041  0.146558028 -1.415914227 -0.542052733 -0.502338965
+##  [64,] -0.43742695  0.004384985  0.288715836 -0.666294059  0.191533381
+##  [65,]  0.31228855  1.196711215  0.524255656  0.103394585  0.439658408
+##  [66,]  0.34503507  1.073498385 -1.227874156  0.689814679 -0.537687893
+##  [67,] -1.27055351 -0.680015684 -0.425603075  0.965860773  0.615175590
+##  [68,] -2.64573224 -2.319278537  1.105136518  0.144797043  1.208060919
+##  [69,]  0.31053741  1.323116877  0.163503404 -0.122986733  0.411679821
+##  [70,] -0.52749528  0.382727739  0.267970177 -1.117670171 -0.096856424
+##  [71,] -0.58913654  0.256593276  0.667900594 -0.472777049 -0.053862122
+##  [72,] -1.74768049 -1.666061950  2.439444903 -0.574816199 -2.444341558
+##  [73,] -1.21339299 -1.585456139  2.763994184  1.778531494 -0.888397977
+##  [74,] -0.24288019  0.601461898  0.346358955 -0.566469248  0.738700169
+##  [75,] -0.19205941  0.312012653 -0.896830823  0.636430068  0.184250378
+##  [76,]  0.47285287  1.897476723 -0.459167902 -1.456533144 -0.499739309
+##  [77,] -1.91269608 -1.448609379  2.270368627  0.358280662 -0.972007025
+##  [78,] -0.85193226 -0.606216763  1.632345628  0.798807660 -0.537934350
+##  [79,]  0.00477652  0.618197922  1.847387354  0.571167764  0.518513409
+##  [80,] -1.15679295 -0.520861222  0.862111769 -1.204091519 -1.256213294
+##  [81,] -0.01684056  1.016469221 -0.037559428 -1.199348110 -0.641692238
+##  [82,]  0.06177169  0.517412236  0.914478563  1.528872781  0.579648590
+##  [83,]  0.24578074  1.452624203  0.047972757 -1.026408683  0.073071600
+##  [84,] -0.14218169  0.236612218  0.125158350  1.315450841  1.508906225
+##  [85,] -0.84607451 -0.080230576  0.282995956 -0.414644769  1.274440949
+##  [86,] -1.04245956  0.174377916 -2.179913645 -0.373589493 -0.849458521
+##  [87,]  0.29185936  1.034703761  0.658684160  0.839806091  0.594404805
+##  [88,] -0.71402303 -0.605429620  2.045853477  1.125134285 -0.815963744
+##  [89,] -2.14709492 -1.269259278 -0.635685377 -0.267040134 -0.607064207
+##  [90,] -0.94238401  0.085641979 -0.878574989 -0.983571611 -0.122538488
+##  [91,]  0.29435430  1.565760660 -0.075463200 -1.389895459  0.054757298
+##  [92,] -0.23115560  0.214697574  1.655240451  0.450275425 -0.332280606
+##  [93,] -1.67973911 -1.363179847  1.819764142 -0.515791349 -1.877017713
+##  [94,] -0.58511193  1.669052974  0.010495738  0.988435137  0.203128371
+##  [95,] -0.74067945  1.899988708  0.299360943 -0.063893005 -0.155474311
+##  [96,] -1.71874219 -2.638323081 -2.817742166  0.536023865  0.563580971
+##  [97,] -0.44643899  0.185077787 -0.954051257 -0.939628619 -0.105225539
+##  [98,] -0.06253369  0.693176854  0.680407920 -0.398296191  0.270345893
+##  [99,]  0.18320366  1.307495641 -0.190936068 -0.551105905  0.016744827
+## [100,] -1.97421369 -1.488551759  1.450202031  0.039902997 -1.133075732
+## [101,]  0.13169486  0.676462493 -0.654286098  1.089816107  0.045551076
+## [102,] -0.19167476  1.151425952 -0.259605419 -2.017094478 -0.343217460
+## [103,]  0.08582546  1.167601433  0.305274849 -0.374578296  0.241794179
+## [104,] -0.83581922  0.419973633 -0.658185034 -0.432324059 -0.383373705
+## [105,]  0.15630963  0.960300057 -0.613566891  0.159456892 -0.064078303
+## [106,] -0.17461001  0.426302104 -0.638635959  0.046255373  0.994197719
+## [107,]  0.11561636  1.004864027  1.222734353  0.391060497  0.773685680
+## [108,]  0.21911432  0.920784524  0.137039283  0.934815418  0.365003245
+## [109,] -0.23478029  0.898358864  0.348955411 -1.302180857 -0.692277723
+## [110,] -0.36884531 -0.312392992  0.740413144  1.987498739  1.115423096
+## [111,] -1.32270942 -0.023971878 -0.181171022 -1.923706128 -1.065376068
+## [112,]  0.04842094  0.992394053  0.264709125 -0.167992700  0.051666662
+## [113,] -0.20679409  0.529988176  0.097576213  0.325716589  0.214463370
+## [114,] -0.15773432  0.291990157  1.222867575  0.021990736  0.197104120
+## [115,] -1.04752558 -1.048643469  0.757502307 -0.079183589 -0.500784182
+## [116,] -1.33490718 -0.444930805 -0.810926710 -0.818222680 -0.289734858
+## [117,]  0.40409093  1.112960403  0.672009641  0.360939472  0.530704256
+## [118,] -1.08067419 -0.112897780  0.156942278  0.699703777  0.219334109
+## [119,]  1.02971161  0.908682118 -0.392372603  0.088413255 -0.194461078
+## [120,]  0.68297893  0.385916923  0.087014997 -0.234465331  0.153143770
+## [121,] -0.71202611 -1.637000794 -0.811255831 -0.394455977  3.225359181
+## [122,]  1.02871131  0.842945463 -0.476534010  0.204759078 -0.213357434
+## [123,]  0.99148035  0.992663789 -1.476575048 -1.280298793 -0.842023275
+## [124,] -0.89682159  2.444222779  0.614164498  0.338644024  0.296741212
+## [125,] -0.13567079  0.018622324  0.818802003  0.147608170 -0.781444812
+## [126,] -0.05291420 -0.026216684 -1.170113925 -0.697225786 -0.268115160
+## [127,] -0.59628275 -1.017381256 -1.667647435  1.460266515 -0.660425159
+## [128,]  0.55879218 -0.038834796 -0.994857255  0.586076446  0.521060126
+## [129,]  0.96670603 -0.018586142 -1.620596817  1.919649985 -0.472015306
+## [130,]  1.19417530  1.049567756 -0.176900340 -0.558350581 -0.184778267
+## [131,] -0.11218924 -0.356081516 -2.147169448 -0.298884034 -1.048252139
+## [132,]  0.72631703  0.482344287 -1.005528128 -0.477421093 -0.251769253
+## [133,] -0.81099135 -1.545415448  0.452885137  1.532586474  0.777610608
+## [134,]  0.89277472  0.614780115 -2.002137540 -0.273401158 -0.949035113
+## [135,]  1.24467954  0.530165480 -2.178842306  0.656470243 -1.252679330
+## [136,]  0.09097760 -0.407142810 -1.130273718 -0.124912564 -0.162885084
+## [137,]  0.70302862 -0.232773474 -0.899767584  1.130222156  0.417027199
+## [138,]  1.17015366  0.302852324 -0.203379988  1.858228374  0.137436639
+## [139,]  0.95238434  0.078665477 -0.287053009  1.177314903  0.388196540
+## [140,]  0.68172573  0.122955608 -0.263166757  0.297833648  0.066544586
+## [141,]  0.78285092  0.267999936 -0.876490198  0.170901782 -0.100037244
+## [142,]  0.80426734  0.427594479 -0.969398792 -0.220263626 -0.113184724
+## [143,]  0.67652078  0.472753550 -0.332282361 -0.663061818  0.002822864
+## [144,]  0.57240395  0.151074279 -0.433903991  0.575746755  0.118053850
+## [145,]  0.49226353 -0.095626612 -0.715198739  0.033493309 -0.362109442
+## [146,]  0.38191881 -0.003471198 -0.990372378 -1.371722584 -0.516798597
+## [147,]  0.30103326 -0.176786009  0.651178262 -0.485005617  0.461390970
+## [148,]  0.69098135  0.046778813 -0.927388972  1.113886396 -0.003940975
+## [149,]  0.82301519  0.272866543  0.110707476  1.148205949  0.451845810
+## [150,]  0.87072677  0.168792272  0.034567322  1.242195357  0.439799114
+## [151,] -1.08372773 -1.626815985 -0.177111690 -1.867100930  0.018365514
+## [152,]  0.88562892  0.307583377 -0.456658586  0.199731980  0.092167694
+## [153,] -0.73618538 -1.312276729 -0.515186915 -0.824587213  1.293431445
+## [154,]  0.70822132  0.525442184 -0.185865688  0.392111124  0.204168470
+## [155,]  0.53277713  1.016080129  0.243725372 -0.106872404  0.286015442
+## [156,]  0.33931390  1.121523939  0.696995002 -1.018180691  0.490583212
+## [157,]  0.75322700  0.447873222 -0.544099188  0.092847534  0.019381251
+## [158,]  0.49747313  0.006074310 -0.104619944 -0.445570711 -0.093768938
+## [159,] -0.04378766 -0.166573426 -1.931501760 -1.400750919  0.257578625
+## [160,]  0.42669880  0.299738037 -0.371826957 -0.474856440  0.298672231
+## [161,]  0.40136029 -0.164869277  0.894098816  1.358386342  0.769197816
+## [162,]  0.05585149  0.631246214  0.301971536 -1.158069320  0.086528185
+## [163,]  0.80336968  0.975134032 -0.133457017 -1.270760809  0.006554107
+## [164,]  0.54500380  0.999847276 -0.095380347 -1.617571279 -0.055661401
+## [165,] -0.85072449 -1.833119204 -0.480517584  0.490612139  1.221780513
+## [166,]  0.72672612  0.785423168 -0.110137280 -0.396181152  0.126810502
+## [167,]  0.18703708 -0.663870468 -0.157159270  0.320441440  0.125987621
+## [168,]  0.79314765  0.643301652 -0.172867106 -0.217096682  0.133418551
+## [169,]  0.73072798  0.609145850 -1.883084721  0.442443662 -0.830789838
+## [170,] -0.98098268 -1.112349122 -1.125539085 -0.949308789  1.028048682
+## [171,]  0.47084899 -0.419178480 -0.775433479  0.407283383 -0.147382623
+## [172,]  1.19946819  0.596278966 -1.699241757  1.177745526 -0.994428365
+## [173,]  0.94182025  0.169659554 -1.582479318  1.492817397 -0.527196366
+## [174,]  1.05401329  0.666285648 -1.278032896 -0.095393619 -0.605938155
+## [175,]  0.81779645  0.195580236 -1.593405802  0.368048586 -0.616382600
+## [176,] -0.33111230 -0.988422741 -1.861804066  0.494866332 -0.205079267
+## [177,] -0.15209974 -0.668088413 -1.187538210  0.807596843 -0.181391702
+## [178,]  1.17064603  0.682434485 -0.184015563  0.716039308 -0.020575329
+## [179,]  0.68798815 -0.314959001 -0.864818747  1.596682517  0.166501103
+## [180,]  1.29199399  1.507111604  0.331071838  0.298030875 -0.260735937
+## [181,]  0.75089872  1.092696239  0.240893341 -1.030213654  0.184445815
+## [182,] -0.54018125 -1.119328229  1.353479625 -0.046367106  1.216298501
+## [183,] -0.99168830 -1.233031303 -0.633900733  0.544514600  0.234415327
+## [184,]  0.92178373  0.740707989 -0.051389972 -0.795353330  0.121253950
+## [185,]  1.11641261  0.701139342 -0.457559252  0.527881972 -0.169642741
+## [186,] -0.07607561 -0.437586475 -0.231761752 -0.219247663  0.409521194
+## [187,] -0.27919764 -0.673644722 -0.765342715  0.246919275 -0.011386566
+## [188,] -0.37954543 -1.015444059 -0.965775302  0.616944430  0.502787995
+## [189,]  0.93701576  0.498446296 -0.195687783 -0.241319616  0.141115801
+## [190,]  0.37260083 -0.003770689 -0.162240594 -0.522315774  0.365191761
+## [191,]  0.81669546  0.581859806 -0.816711289 -1.115540561 -0.810376766
+## [192,] -0.20373210 -0.936309193 -1.329998213  1.668027461 -0.129129477
+## [193,]  0.87209184 -0.119091822 -0.272612892  1.835251844  0.389664182
+## [194,]  1.34022791  0.465293170 -0.949338503  1.993991790 -0.548737234
+## [195,] -0.06209962  0.040034961 -0.861720022 -1.346855099 -0.334992416
+## [196,]  0.97115124  0.289984002 -1.449415512  1.175820275 -0.513109375
+## [197,]  0.90868683  0.526106354 -0.519375641 -0.593619777 -0.366880040
+## [198,] -0.13482580 -0.878738984  0.171148682 -0.419058739  1.025717217
+## [199,]  1.05172917  1.010777925  0.799931654 -1.082796308  0.450493770
+## [200,]  0.67571732  0.337815482 -0.554448833 -0.416939312 -0.066475105
+## [201,]  0.60129377  0.355500350 -0.242390312  1.266779493  0.277479544
+## [202,]  0.01596152 -0.075842864 -0.300681202 -0.604991208  0.736204966
+## [203,] -0.55042352 -0.839118569  0.677378894  2.188532181  0.541893589
+## [204,]  1.32437236  0.455294932  0.088330047  1.299028327  0.188673545
+## [205,]  0.60995374  1.252935371  0.351295839 -0.816149277  0.215321457
+## [206,]  1.04685448  1.214458756 -0.023924311  1.754843969 -0.265201780
+## [207,]  1.41110119  1.397937600  0.568351632  0.669393146 -0.115814013
+## [208,]  0.04168246 -0.326465203 -0.179058333  0.154866145  1.114992584
+## [209,] -0.26705444 -1.677512253  1.802288452  0.188065042 -1.411576177
+## [210,]  0.16484524 -1.629841453  0.737973343  0.873341264 -0.784490491
+## [211,] -0.04039624 -0.752572199  0.701220057 -0.184887732  0.085917280
+## [212,]  0.03635497 -1.122318722  1.167330436  0.240688966 -0.746350803
+## [213,]  0.91469557 -0.447102739 -0.642637547  0.630523244  0.097857383
+## [214,]  0.02849682 -1.065244317  0.390390079  0.274466256 -0.439882219
+## [215,]  0.28264070 -0.794724830 -0.793156611 -0.108794238 -0.570179292
+## [216,] -0.44126143 -1.721372691  2.687821657 -1.667009808 -2.086696970
+## [217,]  0.72199535 -0.372814910  0.559984867  0.385456469 -0.230112558
+## [218,] -0.07826762 -1.361159762  1.603945462 -0.789745937 -0.949995231
+## [219,]  0.46839205 -0.285328952  0.156240088 -0.578235937  0.457599446
+## [220,] -0.47205555 -1.851975022  0.230027816  1.746385538 -0.415234042
+## [221,] -0.83966186 -2.383796890 -0.384364288 -0.382349819 -2.071690782
+## [222,]  0.61483480 -0.730697611  0.306177695  1.070538697 -0.076738872
+## [223,]  0.15839063 -1.122537455  0.766233385  0.473396296 -0.657485908
+## [224,]  1.17403515  0.190766729  0.314324646  0.704014206  0.494489596
+## [225,]  0.86456534  0.190666716 -0.076137566 -0.745458529  0.020353910
+## [226,]  1.07331684  0.414204853  0.278376846 -0.581852387  0.053662251
+## [227,]  0.43554028 -1.044055721  1.596331855  1.528661740  0.183366210
+## [228,]  0.72243123 -0.292523613  1.021475858  0.299332512  0.749059327
+## [229,]  0.78266335 -0.155598054  1.473443423 -0.302665718 -0.274859902
+## [230,]  0.85089066 -0.233039869  0.522422349  1.076028989  0.760132230
+## [231,]  0.46310409 -0.851876752  0.777824681  0.925176361  0.017656699
+## [232,] -0.43243598 -1.571619667  0.705927101 -0.406090992 -0.873862377
+## [233,] -0.15191688 -1.619108139  1.872388757  0.474014688 -1.157323180
+## [234,]  0.67927742 -0.419884585  0.334816526 -0.001287534 -0.364149027
+## [235,]  0.87981363  0.263059658 -0.465466723 -1.522053462 -0.549464977
+## [236,]  0.26812129 -0.211885712 -0.447673531 -1.631781683 -1.077098816
+## [237,] -0.56930259 -2.187884130  1.245793026  0.802647066 -1.109174097
+## [238,]  0.24634800 -0.396617802 -0.173156751 -0.858659723 -0.234948348
+## [239,]  0.44681564 -0.356575387  0.608197019 -0.838471390 -0.871855280
+## [240,]  0.17777985 -0.634220315 -0.712381126 -0.745563971 -0.479923127
+## [241,] -0.06138065 -1.118610441 -0.282773999  0.386919307 -0.246997258
+## [242,]  0.77849072  0.166577381 -0.144976044 -1.577890933 -0.775743318
+## [243,]  0.42135364 -0.633774410 -0.752201585 -0.605959263  0.272848078
+## [244,] -1.40784124 -3.134824292  2.038616591  0.230984120 -3.045719613
+## [245,]  1.08232110  0.244672023 -0.146977142  0.316215648  0.233301422
+## [246,] -1.66785245 -2.604122852 -0.873476413 -1.478092158 -1.632474217
+## [247,]  1.25586799  0.036358841 -1.999327010  0.618916053 -0.806452912
+## [248,]  0.94488450  0.144234319  0.721323517  0.012383635  0.163616880
+## [249,]  0.74789749 -0.196607821  1.269171418  1.242471982  0.720542182
+## [250,]  0.97162496 -0.572915916 -2.370200621  0.763566326 -0.647442692
+## [251,]  0.98460515 -0.383876216  0.106412626  0.624976676 -0.251932829
+## [252,]  1.03415614  0.324834724 -0.968991581 -0.691045472 -0.259767851
+## [253,]  0.40734427 -1.001829195  0.224457838  1.294819251  0.901505621
+## [254,]  1.35107781  0.337585931  0.394326346  1.217533366  0.371066296
+## [255,]  1.12935389  0.173814389 -0.572206172  0.216671817  0.123271775
+## [256,]  0.67510865  0.167646944  0.630298520 -0.747232016  0.475575175
+## [257,]  1.16164351  0.708512578  0.216249255 -0.973851691  0.212043346
+## [258,]  0.45286518 -0.326226387 -0.375252646 -0.678379671  0.100944862
+## [259,]  0.69891466 -0.802510140 -0.792524290  1.073437952  1.059508191
+## [260,]  0.03973386 -0.216819597 -0.655273008 -2.557829211 -0.115810674
+## [261,] -0.96003580 -2.851417868 -1.382634695  1.652804130  1.263858473
+## [262,]  1.37417440  0.118739159 -1.420355000  0.724071258 -0.548745115
+## [263,] -0.64683757 -1.621701837 -0.317635344 -0.836124761  0.793165709
+## [264,]  0.37106796 -0.612725087 -0.855835309 -0.160671208 -0.543912963
+## [265,]  0.38995741 -0.852424596  1.955605840  0.536244961  0.617326987
+## [266,]  0.22596018 -0.687842338 -1.504229667 -0.426733813 -0.475079269
+## [267,] -0.17061295 -2.052615289 -2.221273741 -0.300575880  2.175842967
+## [268,]  1.76463708  1.006452155 -0.692050218 -0.520478724 -0.775131517
+## [269,]  0.97218510 -0.006264228  0.549292902 -0.354142874  1.045232560
+## [270,]  1.10419193 -0.624566204 -0.336819365  1.755577029  0.348719917
+## [271,]  0.19926474 -1.354893828  1.595237103 -0.333612298 -1.532008683
+## [272,] -1.55566335 -2.434544366  2.589512537 -0.556545560 -2.017309192
+## [273,]  0.74771945 -0.567394856  0.186338485  0.186846042  0.454802063
+## [274,] -0.07577029 -2.359596583  2.089701099  1.060230018 -1.630331773
+## [275,]  0.60845115 -0.922045363 -0.829974188  0.146919830  0.315640798
+## [276,]  0.94339724 -0.953751806  0.272163598  0.634136105 -0.412209779
+## [277,] -0.28854173 -2.614739263  1.240110304  1.780864192 -0.786842259
+## [278,]  1.36729650  0.074234615  0.798950014 -1.037472481 -0.334958385
+## [279,]  1.77791013  0.433356342  0.765291127  0.219000774  0.406579705
+## [280,]  0.71154420 -1.194474676  0.958801173  0.258763010  0.153214813
+## [281,] -0.37056798 -2.062269369 -1.798316780  0.450044369 -1.054189191
+## [282,]  1.65632548  0.423392672 -1.039641354 -0.542450734 -0.554441124
+## [283,]  1.06772896 -0.433570419 -0.219632493 -0.267718065  0.587517227
+## [284,]  0.76445257 -1.330221917 -2.052645571  2.116091585 -0.628977936
+## [285,]  0.41565409 -1.064472100 -0.143377804  0.729582283  0.578169910
+## [286,]  1.99348712  0.518599189 -0.140858006  1.084222256 -0.316412109
+## [287,] -0.10864224 -1.647266421 -1.081342924  0.033126732 -0.334683884
+## [288,]  1.30517860 -0.232074763 -0.618387782  0.014156677 -0.252598577
+## [289,]  1.31067116  0.214544515 -0.190342740 -1.200203611  0.630926000
+## [290,]  1.50753111  0.742598167  0.309688767 -1.791178790  0.138885552
+## [291,]  1.73120858  0.853939612  1.059383741 -2.007744387  0.452354023
+## [292,]  1.37757942 -0.027185827  1.913127730 -0.660424095  0.761564910
+## [293,]  1.60618821  0.365895161  0.559942129 -0.624675608  0.419268252
+## [294,]  0.66929409 -1.094217001  2.375981808 -1.081254097 -0.599345671
+## [295,]  1.64780007 -0.004637691  0.003227058  1.231674810  0.200410522
+## [296,]  1.43952627 -0.049353193 -0.329720021  0.255191946  0.141721592
+## [297,]  1.37857421  0.191062291 -0.080746931 -1.177983699 -0.272291500
+## [298,]  1.28122467  0.332292552 -0.152331034 -2.566086550 -0.652465463
+## [299,]  1.56572793  0.052162698  0.309249995  0.250387497  0.425463630
+## [300,]  0.96807778 -0.868387150  0.194801307  0.378305963  0.344114415
+## [301,]  1.48301744  0.352116700 -0.644110412 -1.510673007 -0.229266853
+## [302,]  0.94305628 -1.278627386  0.832183390  1.483909522  0.350852014
+## [303,]  1.41572272 -0.516592964 -1.242797519  0.776481220 -0.168100833
+## [304,]  1.56632251  0.391505100  0.180052797 -0.970668870  0.201025719
+## [305,]  1.25121487 -0.595319081  0.977445954  0.402377588 -0.185237026
+## [306,]  1.07574392 -0.450921406 -1.110611857 -1.040056187  0.081468373
+## [307,]  1.31646860  0.063599258 -0.500453908 -0.732763524  0.155881068
+## [308,]  1.72263842  0.184071459 -0.876823367  0.291613196 -0.377887114
+## [309,]  1.66149730 -0.141761062 -2.011044738  0.281181738 -0.867139528
+## [310,]  1.28880873 -0.973953880 -1.488997224  1.286803917  0.415114319
+## [311,]  1.51612129  0.039669717  0.614319983 -1.206228378 -0.033722250
+## [312,]  1.63811699  0.153007893  1.614033462  0.224021324  1.126007409
+## [313,]  0.75842974 -1.483341093 -0.056043903  1.217380672  1.910186737
+## [314,]  1.65722329  0.290709181  0.367093738 -1.241751629  0.089519895
+## [315,]  1.86810767  0.370694243  1.689588859 -0.102269552  0.983792507
+## [316,]  2.06416264  0.329971301  2.017417416  1.193038326  1.080610723
+## [317,] -0.55105095 -2.034446706  1.162909761 -1.634973756  3.240656680
+## [318,]  1.13710374  0.091118933 -0.118526411 -1.806802456 -0.021402361
+## [319,]  0.46364067 -1.262358909  1.857821965 -0.542593896  2.047983623
+## [320,]  1.65914959  0.080465213 -0.196561829 -0.357168142  0.210199544
+## [321,]  0.97323566 -0.685811728  2.238462903 -1.083754802  0.462991775
+## [322,]  0.08976986 -1.891838455 -0.679459026 -1.168538478  2.688146717
+## [323,]  1.64197540 -0.078445340 -2.371242024 -0.262977168 -1.095916492
+## [324,]  1.59499537  0.271148517  1.298259366 -1.340961322  1.337690096
+## [325,]  2.37168385  1.039277631  1.545107285  0.278928316  0.302764615
+## [326,]  0.70953680 -0.928744259  0.567802030 -1.678993035  1.235745457
+## [327,]  0.14621025 -1.109784707  1.800115439 -2.214075748 -0.196283783
+## [328,]  2.03215898  0.159401143  1.165204725  1.741561175  0.709902071
+## [329,] -0.07308437 -1.420192559  2.007582828 -2.095151522 -0.570396946
+## [330,]  1.21595752 -0.603763235  0.768910458  0.085768351  0.264512759
+## [331,]  0.37916924 -1.501385784 -1.355847369 -0.886364178 -0.767411035
+## [332,] -0.26558189 -2.828539067 -2.087594394  2.025427974  0.802609599
+## [333,]  1.10113621 -0.502596980 -0.620102686 -0.663481731 -0.317092245
+## [334,]  1.90563407 -0.266803035 -2.288784007  1.622320807 -1.179892674
+## [335,]  1.98899224  0.597534368  0.052703053 -0.727465886 -0.110074007
+## [336,]  2.19080158  0.592851246  1.746386454  0.553922684  0.802917546
+## [337,]  0.72298151 -1.003548629 -1.850914872 -1.608892859 -0.042425696
+## [338,]  0.70802015 -1.889127738 -2.197131470 -0.172653414 -1.951866990
+## [339,]  0.72690790 -1.106912001  0.927170626 -1.391633828  0.427102268
+## [340,]  1.30510996 -0.403596801 -0.222766188 -0.799736155  0.392912718
+## [341,]  0.58145638 -0.890465259 -0.761735520 -0.693463441  0.087167179
+## [342,]  2.07559989  0.264388377  1.714412566 -0.154749900  0.976148524
+##                 PC6           PC7
+##   [1,] -0.737719314 -2.1838311491
+##   [2,]  0.713071246 -0.7840126684
+##   [3,] -0.350569006 -0.5255282623
+##   [4,] -0.890198045 -0.7080522897
+##   [5,]  0.264739292 -0.1763740521
+##   [6,]  0.441064899 -0.1258469062
+##   [7,]  0.048758730 -1.2618757464
+##   [8,]  1.154646930 -1.0353783627
+##   [9,]  0.613315202 -1.8891449148
+##  [10,]  1.104870881 -0.3250135845
+##  [11,]  0.213459887 -0.5306514724
+##  [12,]  0.222162185 -0.6638384401
+##  [13,] -0.181427432 -0.4981461433
+##  [14,]  0.607122078 -0.5407872370
+##  [15,]  0.350832190 -0.4638965147
+##  [16,]  0.608782512 -1.3725605990
+##  [17,] -3.835454678 -0.5558497617
+##  [18,] -0.664006634 -1.5600628150
+##  [19,] -0.515475734  1.9689397777
+##  [20,] -0.467526204  1.7898407184
+##  [21,] -0.611198625  2.1977708946
+##  [22,]  0.300568898  0.8195449878
+##  [23,] -0.192475671  0.4088367437
+##  [24,]  0.122680990  2.0136802784
+##  [25,] -0.510623941  1.1776241381
+##  [26,]  0.964419103  1.8483295293
+##  [27,] -0.054558141  1.4215802247
+##  [28,] -0.475000471  1.8405840309
+##  [29,] -0.880215494  2.1213081718
+##  [30,]  0.107806846 -0.2161326430
+##  [31,] -0.598845855 -0.0695189516
+##  [32,]  1.123670303  0.1856374285
+##  [33,] -0.331191278 -0.0735840896
+##  [34,] -0.312817705 -0.1497497502
+##  [35,] -0.164724540 -0.1783991222
+##  [36,] -0.128291549 -0.1642415887
+##  [37,]  0.245037684 -0.2603865319
+##  [38,] -0.055290601 -0.0675462438
+##  [39,]  0.064803447  0.2958906378
+##  [40,]  0.033947566 -0.1735661679
+##  [41,] -0.291489501 -0.0670255386
+##  [42,]  0.077402637 -0.2537618794
+##  [43,]  0.494872624  0.0001329240
+##  [44,]  1.293659766  0.5399912515
+##  [45,]  2.054873260  0.2952125453
+##  [46,] -0.499689510 -0.0732104657
+##  [47,]  0.118913758 -0.2178719908
+##  [48,] -0.218633589 -0.1170343900
+##  [49,]  0.533824287  0.1255096993
+##  [50,]  0.052229997 -0.0289449629
+##  [51,] -0.313643520 -0.0622335318
+##  [52,]  1.678917974  0.4667703906
+##  [53,] -0.880695894 -0.2031331704
+##  [54,] -0.400970934 -0.0266253061
+##  [55,] -0.216248198  0.0170588685
+##  [56,] -0.190007329 -0.0080111325
+##  [57,] -0.200787336 -0.1759364876
+##  [58,] -0.818237347 -0.0801672966
+##  [59,]  0.039915102 -0.1229879312
+##  [60,]  0.003867460 -0.1322893419
+##  [61,] -0.531392600  0.1683637012
+##  [62,] -0.270702532 -0.1674036127
+##  [63,]  1.105517546  0.0157356238
+##  [64,] -0.348801234 -0.1987955499
+##  [65,]  0.023052966 -0.2068102498
+##  [66,] -0.418125741  0.0062228114
+##  [67,]  2.029338010  0.0938998382
+##  [68,]  0.431199074  0.4308435676
+##  [69,]  0.010248650 -0.1449784731
+##  [70,] -0.471800402  0.0055310532
+##  [71,]  0.086783353 -0.0291158972
+##  [72,] -1.351664349  0.0363200137
+##  [73,] -1.350477151 -0.0299880438
+##  [74,] -0.618826401 -0.0171085412
+##  [75,] -0.968973488  0.1393012116
+##  [76,]  0.124494953 -0.1675802652
+##  [77,]  1.023679244  0.0758576920
+##  [78,] -0.499660974 -0.0296418817
+##  [79,] -0.211387314 -0.2330317421
+##  [80,] -0.707177349  0.0584648236
+##  [81,] -0.545586820 -0.0802858148
+##  [82,] -0.142081778 -0.1141203572
+##  [83,] -0.058713844 -0.1375622405
+##  [84,] -0.608132226  0.0365453493
+##  [85,] -0.115314606  0.1137467710
+##  [86,]  0.698920582  0.4708479702
+##  [87,] -0.009677319 -0.1516476304
+##  [88,] -1.035199631 -0.0422912565
+##  [89,]  1.635923740  0.4274243653
+##  [90,]  0.767609449  0.1449810586
+##  [91,] -0.003783184 -0.1678075145
+##  [92,] -0.702934288 -0.1505750846
+##  [93,] -0.201466023  0.0892077988
+##  [94,] -0.542361854  1.1375354783
+##  [95,] -0.571859604  1.1955657337
+##  [96,] -0.109692650  0.1590038131
+##  [97,] -0.136386226  0.0985136905
+##  [98,] -0.484935396  0.0439702773
+##  [99,] -0.228522618  0.1462968792
+## [100,] -0.919827935  0.6159059122
+## [101,] -0.584018658  0.2328375394
+## [102,] -0.640951315  0.2357417624
+## [103,] -0.244491575  0.1543810328
+## [104,]  0.619631949  0.4863029983
+## [105,] -0.466435866  0.1899146104
+## [106,] -0.785594654  0.2554507635
+## [107,] -0.061633288  0.0697458585
+## [108,] -0.249263589  0.1459826896
+## [109,] -0.145280142  0.1435651087
+## [110,] -0.976047909  0.2748412943
+## [111,]  0.265776404  0.4837109996
+## [112,] -0.378718789  0.1786869251
+## [113,]  0.862252371  0.0808021744
+## [114,] -0.545242458  0.0081057189
+## [115,] -1.269799266  0.2358049832
+## [116,]  1.436859091  0.3716179793
+## [117,]  0.059851694 -0.0333708427
+## [118,]  1.361701997  0.5170812354
+## [119,]  0.139145828 -0.5558851314
+## [120,] -0.206290698 -0.5545887708
+## [121,] -1.770943058 -0.0606935174
+## [122,]  0.095725700 -0.5541378102
+## [123,] -0.133989883 -0.5521857565
+## [124,] -0.366036824  1.8263106705
+## [125,] -0.966380981  0.1336122998
+## [126,] -0.269577727  0.0723732369
+## [127,]  1.530664732  0.1265368623
+## [128,] -0.610092768 -0.1927354872
+## [129,] -0.535614086 -0.2783063937
+## [130,]  0.321468452 -0.5750004317
+## [131,]  1.058058163 -0.0891830647
+## [132,] -0.393796332 -0.2694364705
+## [133,]  2.217337097 -0.1999427825
+## [134,] -0.475802569 -0.2129098192
+## [135,] -0.320568189 -0.4118120123
+## [136,]  0.122006447 -0.1829559808
+## [137,] -0.583538375 -0.3199148711
+## [138,]  0.056121578 -0.4927558440
+## [139,] -0.179882182 -0.4762446797
+## [140,] -0.405669428 -0.3352401948
+## [141,] -0.396119748 -0.3160019166
+## [142,] -0.334893510 -0.3166165023
+## [143,] -0.293182234 -0.3174355062
+## [144,] -0.489327305 -0.1634543647
+## [145,] -0.769852671 -0.2241483836
+## [146,] -0.891817451 -0.2549053666
+## [147,] -0.022616600 -0.4078664588
+## [148,] -0.540157288 -0.1715414205
+## [149,] -0.119192080 -0.3170551231
+## [150,] -0.143190196 -0.3695191392
+## [151,] -0.342710679 -0.0417158506
+## [152,] -0.213962285 -0.4159283516
+## [153,]  0.173539902 -0.0610330911
+## [154,] -0.188050255 -0.1641693717
+## [155,] -0.031773591  0.0749109296
+## [156,] -0.034276513  0.1114740951
+## [157,] -0.277258146 -0.2235594899
+## [158,] -0.596992013 -0.2931216948
+## [159,] -0.503422571  0.0716620053
+## [160,] -0.512600338 -0.0874347231
+## [161,] -0.435657865 -0.1354223005
+## [162,] -0.566751614  0.2165451486
+## [163,]  0.029265175 -0.2955624899
+## [164,] -0.151386713 -0.1019619930
+## [165,] -0.717042509  0.1326045271
+## [166,] -0.075074414 -0.1788231906
+## [167,] -1.073031632 -0.1404784326
+## [168,] -0.098693317 -0.2310521858
+## [169,] -0.560974949  0.1112885226
+## [170,]  1.094939575  0.1784342049
+## [171,] -0.905909478 -0.2028045596
+## [172,] -0.216903665 -0.2327556950
+## [173,] -0.492761785 -0.1434108441
+## [174,] -0.183436558 -0.3064735147
+## [175,] -0.597423279 -0.1785238481
+## [176,]  0.796441515  0.0255694206
+## [177,]  1.174680935 -0.0386739001
+## [178,]  0.174058481 -0.4188416617
+## [179,] -0.124778603 -0.2628406117
+## [180,]  0.652430141 -0.3086178549
+## [181,]  0.124052766 -0.1664255100
+## [182,] -0.347302640 -0.0353950345
+## [183,]  2.637917022  0.0797811619
+## [184,]  0.043506215 -0.3892566024
+## [185,]  0.074571557 -0.3435817250
+## [186,]  1.549684257 -0.2644544837
+## [187,]  0.895808544 -0.0004947377
+## [188,]  0.993766208 -0.0193059649
+## [189,] -0.061917307 -0.4050578872
+## [190,] -0.180585511 -0.2086721889
+## [191,] -0.356097703 -0.3034780078
+## [192,]  1.017133381  0.0540047477
+## [193,] -0.322661764 -0.2895479568
+## [194,]  0.019029546 -0.3704711737
+## [195,]  1.541900998 -0.1632675884
+## [196,] -0.403372692 -0.1651925054
+## [197,] -0.202073020 -0.3403034537
+## [198,] -0.260961487 -0.1610269633
+## [199,]  0.424051328 -0.4895246783
+## [200,] -0.411808891 -0.1576322407
+## [201,] -0.340122029  0.1214052145
+## [202,] -0.366672488  0.1312508379
+## [203,]  0.586177270  0.4345316911
+## [204,]  0.253806265 -0.4836633099
+## [205,]  0.077173865  0.3608133074
+## [206,]  0.274282882  0.3638228872
+## [207,]  0.715818243 -0.1196740475
+## [208,]  0.136497001  0.2649018780
+## [209,] -0.633382583 -0.1480415938
+## [210,] -0.918736170 -0.2336823010
+## [211,]  1.236014474 -0.1289016341
+## [212,]  0.154603179 -0.1842185484
+## [213,] -0.586499064 -0.2428747856
+## [214,]  0.135961769 -0.0733813687
+## [215,] -0.096788942 -0.0695066713
+## [216,] -0.994583993 -0.3240278814
+## [217,] -0.439907106 -0.2161186187
+## [218,] -1.100391975 -0.2008312756
+## [219,]  0.137267521 -0.1578896097
+## [220,] -0.083603999  0.2257847508
+## [221,] -0.548720882  0.0736056532
+## [222,] -0.165098342 -0.2098471844
+## [223,] -0.448038985 -0.1134934822
+## [224,]  0.076892153 -0.3149717016
+## [225,] -0.289876130 -0.1904116105
+## [226,]  0.016985323 -0.3073066897
+## [227,]  0.280886685 -0.3226909297
+## [228,] -0.304105714 -0.2370658191
+## [229,] -0.280690131 -0.3598773413
+## [230,]  0.012229436 -0.2041894740
+## [231,] -0.479906129 -0.1464027495
+## [232,] -0.156601529 -0.0054824751
+## [233,] -0.598825553 -0.1616748326
+## [234,] -0.081799303 -0.2782826357
+## [235,] -0.401171249 -0.2245978717
+## [236,] -0.199952342 -0.0059956493
+## [237,] -0.435524249 -0.0136997781
+## [238,]  0.291339197 -0.0543640685
+## [239,] -0.835656580 -0.0951835756
+## [240,] -0.088652629  0.0144062708
+## [241,]  0.055818609  0.0878825470
+## [242,] -0.495552086 -0.2052275433
+## [243,] -1.027742186 -0.0088568644
+## [244,] -1.639076127  0.2411788307
+## [245,] -0.083659011 -0.1900940037
+## [246,]  0.537959199  0.3971341830
+## [247,] -0.492279915 -0.1356862812
+## [248,] -0.103000377 -0.1973052585
+## [249,]  0.602073322 -0.1690973985
+## [250,] -0.989336087 -0.0487117490
+## [251,] -0.447425670 -0.2846694733
+## [252,] -0.303064857 -0.1123237873
+## [253,]  0.224023843 -0.1141459941
+## [254,]  0.258253400 -0.2823007642
+## [255,] -0.170871177 -0.1788156539
+## [256,]  1.029032373 -0.2399471298
+## [257,]  0.203368565 -0.2519899264
+## [258,]  0.306598896 -0.0612813294
+## [259,] -0.797532169  0.0656797499
+## [260,]  2.021722052 -0.0287474514
+## [261,]  0.591592316  0.4475206990
+## [262,] -0.267455764 -0.0576030556
+## [263,]  1.603347250  0.1589279505
+## [264,]  1.217304549  0.0045806754
+## [265,]  1.291161604 -0.2672685500
+## [266,]  1.253819736  0.0990916880
+## [267,] -2.044347129  0.3830405444
+## [268,]  0.456611259 -0.3110927793
+## [269,]  0.726645892 -0.2281112359
+## [270,] -0.465083514 -0.0639918262
+## [271,] -1.041947829 -0.0155873613
+## [272,] -0.784086193  0.7739819722
+## [273,]  0.708194215  0.0110265410
+## [274,] -0.815652224  0.1214131635
+## [275,]  0.527629823  0.2091923163
+## [276,] -0.378913504  0.0320715678
+## [277,] -0.053554139  0.2777689867
+## [278,]  0.028883999 -0.1782739854
+## [279,]  0.585878454 -0.2340265299
+## [280,] -0.609358624  0.0319714863
+## [281,]  0.746625117  0.5490669059
+## [282,]  0.060684108 -0.0221273543
+## [283,] -0.101690767  0.0534590220
+## [284,]  0.159973212  0.3345413234
+## [285,]  1.562704473  0.1688914363
+## [286,]  0.538093949 -0.1606777563
+## [287,]  1.195416318  0.3475635791
+## [288,] -0.355760217  0.1138746985
+## [289,]  0.014509023  0.0605422311
+## [290,]  0.378719169 -0.0088293103
+## [291,]  0.745271627 -0.2678282504
+## [292,]  0.464695673 -0.2258333062
+## [293,]  0.380617955 -0.0928039902
+## [294,] -0.444974712 -0.1278122162
+## [295,]  0.149251163  0.0980313871
+## [296,] -0.095283428  0.2011271182
+## [297,] -0.071620985  0.1260169838
+## [298,] -0.162123625  0.0855716221
+## [299,]  0.180218739  0.0514514512
+## [300,] -0.662614587  0.2584756157
+## [301,] -0.017844570  0.1102791478
+## [302,] -0.635881336  0.1882069588
+## [303,] -0.493786324  0.2154282798
+## [304,]  0.257343522  0.0309606877
+## [305,] -0.293171664  0.0341720133
+## [306,] -0.673318044  0.2743819219
+## [307,] -0.177902874  0.2821013049
+## [308,]  0.038723633  0.1585862854
+## [309,] -0.405998495  0.3163361482
+## [310,] -0.747549147  0.3900933600
+## [311,]  0.089661898  0.0054730212
+## [312,]  1.373274914 -0.1042622560
+## [313,] -0.092219227  0.3570555693
+## [314,]  0.273027580 -0.0006075942
+## [315,]  0.808557189 -0.1563242512
+## [316,]  1.012457404 -0.2034600899
+## [317,]  1.518445190  0.3990756575
+## [318,]  1.335583842  0.1227103267
+## [319,]  0.907314227  0.1255635012
+## [320,]  0.121793666  0.1018143042
+## [321,]  0.325273911 -0.0502406831
+## [322,] -0.760487871  0.5204349606
+## [323,] -0.489773794  0.3267120261
+## [324,]  0.543890262 -0.0849526978
+## [325,]  1.335205654 -0.2650345750
+## [326,] -0.244077032  0.2002451410
+## [327,]  1.558284584  0.0993794759
+## [328,]  0.731277219 -0.0361669707
+## [329,]  1.835344775  0.1650259366
+## [330,]  0.481370019  0.1720691638
+## [331,]  0.065968469  0.5239053641
+## [332,]  0.550684266  0.8481288782
+## [333,]  0.667518964  0.2909773956
+## [334,] -0.371211672  0.3819973020
+## [335,]  0.552841797  0.0429147982
+## [336,]  1.110235992 -0.1592740314
+## [337,] -0.523754213  0.5151798025
+## [338,] -2.036076649  0.6702930251
+## [339,]  0.039358607  0.2805329124
+## [340,]  0.711687996  0.4036715285
+## [341,]  1.471588414  0.7687201572
+## [342,]  0.845777515  0.1657974636
+
D3 <- pca$x
+
+#Attach the variable "mean_correct" from your original data frame to D3.
+
+D3 <- data.frame(D3, D1$mean_correct)
+
+#Now re-run your correlation plots between the transformed data and mean_correct. If you had dropped some components would you have lost important infomation about mean_correct?
+
+plot(D3$PC1, D3$D1.mean_correct)
+

+
plot(D3$PC2, D3$D1.mean_correct)
+

+
plot(D3$PC3, D3$D1.mean_correct)
+

+
plot(D3$PC4, D3$D1.mean_correct)
+

+
plot(D3$PC5, D3$D1.mean_correct)
+

+
plot(D3$PC6, D3$D1.mean_correct)
+

+
plot(D3$PC7, D3$D1.mean_correct)
+

## Now print out the loadings for the components you generated:

+
pca$rotation
+
##                               PC1        PC2          PC3         PC4
+## id                     0.58205514 -0.3385544  0.062469916 -0.10516164
+## prior_prob_count      -0.50027988  0.5120349  0.097545822  0.10595670
+## prior_percent_correct  0.10259004  0.2656193  0.781280744 -0.28670059
+## problems_attempted    -0.24807198 -0.4255122  0.527707102 -0.08843549
+## mean_hint             -0.47081307 -0.3669473 -0.115313460 -0.02244680
+## mean_attempt          -0.34179563 -0.4434016 -0.009533538 -0.27383776
+## mean_confidence       -0.01944837  0.2008274 -0.290378811 -0.90122426
+##                               PC5         PC6          PC7
+## id                    -0.00563084  0.10995181  0.720770551
+## prior_prob_count      -0.02074912 -0.12780116  0.670846181
+## prior_percent_correct  0.29982995  0.34978664 -0.118642884
+## problems_attempted    -0.58767798 -0.35448987 -0.008692926
+## mean_hint             -0.10797157  0.78055600  0.094647492
+## mean_attempt           0.70023474 -0.33740750  0.085558668
+## mean_confidence       -0.24957526 -0.02126521  0.005007913
+
#Examine the eigenvectors, notice that they are a little difficult to interpret. It is much easier to make sense of them if we make them proportional within each component
+
+loadings <- abs(pca$rotation) #abs() will make all eigenvectors positive
+
+#Now examine your components and try to come up with substantive descriptions of what some might represent?
+
+#You can generate a biplot to help you, though these can be a bit confusing. They plot the transformed data by the first two components. Therefore, the axes represent the direction of maximum variance accounted for. Then mapped onto this point cloud are the original directions of the variables, depicted as red arrows. It is supposed to provide a visualization of which variables "go together". Variables that possibly represent the same underlying construct point in the same direction.  
+
+biplot(pca)
+

# Part III
+Also in this repository is a data set collected from TC students (tc-program-combos.csv) that shows how many students thought that a TC program was related to andother TC program. Students were shown three program names at a time and were asked which two of the three were most similar. Use PCA to look for components that represent related programs. Explain why you think there are relationships between these programs.

+
+ + + + +
+ + + + + + + + + + + + + + +