# read training data con = url("http://www.tau.ac.il/~saharon/BigData2015/covtrain.csv") train = read.csv(con) # reorganize nicely p=dim(train)[2] n = dim(train)[1] X = as.matrix(train[,1:p],nrow=n) # Use the functions eigen() and/or prcomp() - read their help carefully and make sure you interpret the results correctly. # Ask yourself: Are PC loadings in rows or columns? Are eigen values or singular values (their square root) reported? Does our model require centering? # How do we make sure the function handles the centering aspect as we want it? ?eigen ?prcomp # For plotting you can use hist() or better plot(density(...)) # You can add lines to the plot using lines() # Make sure you scale the plots properly: # Is y axis density or counts? Both are legitimate but the different types of information on the same graph have to be on the same scale