X <- read.csv("U:/public_html/588/Class1/CASE0101.csv", header = TRUE) # replace by your own path here V <- X[,1] # all the scores in one "pile" n1 <- 23 n2 <- 24 V1 <- V[1:n1] V2 <- V[(n1+1):(n1+n2)] # illustrates some descriptive stats mean(V1) sd(V1) quantile(V1,c(0.1, 0.25, 0.5, 0.75)) IQR(V1) # illustrates some graphics ?boxplot par(mfrow=c(2,2)) # 2x2 viewing window boxplot(V ~ X[,2]) # get side-by-side boxplots with X[,2] as grouping variable c(min(V), max(V)) hist(V1, breaks = seq(5,30,by=2.5), ylim=c(0,8)) hist(V2, breaks = seq(5,30,by=2.5), border="red", add=TRUE) plot(density(V1), xlim=c(5,30), ylim=c(0,0.1)) lines(density(V2),col="red") data(faithful) # Old Faithful, a famous example of a bimodal distribution # see e.g. Lavine, p. 121 X <- as.matrix(faithful) dim(X) X[1:5,] # display only first 5 cases stem(X[,2]) # ways to display univariate distribution hist(X[,2]) plot( density(X[,2]) )