#Use http://shiny.stat.ucla.edu:3838/c183c283/ to access your data. #Read your csv file: a <- read.csv("myfile.csv", sep=",", header=TRUE) #Convert adjusted close prices into returns: r <- (a[-1,3:ncol(a)]-a[-nrow(a),3:ncol(a)])/a[-nrow(a),3:ncol(a)] #Compute mean vector: means <- colMeans(r[-1]) #Without ^GSPC #Compute variance covariance matrix: covmat <- cov(r[-1]) #Without ^GSPC #Compute correlation matrix: cormat <- cor(r[-1]) #Without ^GSPC #Compute the vector of variances: variances <- diag(covmat) #Compute the vector of standard deviations: stdev <- diag(covmat)^.5