#MULTIVARIATE DATA SUMMARY STATISTICS & DIAGNOSTICS #READ DATA: M=read.table("c:/DATA/Multivariate/iris.txt") M #INDICES: M[5,2] #MATRIX DIMENSIONS: n=nrow(M) n p=ncol(M) p summary(M) #MEAN VECTOR: M=subset(M,select=c("Sepal.Length","Sepal.Width","Petal.Length","Petal.Width")) Mbar=mean(M) Mbar #COVARIANCE MATRIX: cov(M) #CORRELATION MATRIX: cor(M) #STANDARDIZED DATA MATRIX: Ms=scale(M) Ms #COVARIANCE MATRIX OF STANDARDIZED DATA: cov(Ms) #DIAGNOTIC PLOTS: plot(M) library(car) scatterplotMatrix(M) library(lattice) attach(iris) xyplot(Sepal.Length~Sepal.Width|Species, main="Sepal.Length vs Sepal.Width", ylab="Sepal.Width", xlab="Sepal.Length")