R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(4.8,4,3.5,4.1,4.1,3.8,3.5,4.1,4.5,4.1,3.8,4.6,5.2,4.4,4.3,4.7,5.1,4.6,4.7,4.9,5.1,4.6,4.6,4.8,5.1,4.8,4.4,4.8,4.7,4,3.5,4,3.7,3.1,2.9,3.3,3.5,3,2.7,3.2,3.8,3.3,3.1,3.5,3.9,3.4,3.2,3.6,3.9,3.2,3,3.4,3.6,3,3,3.6,3.6,3.3,3.3,3.6,3.8,3.3,3.1,3.4,3.5,3.1,3,3.3,3.7,3.1,2.9,3.1,3.2) > par1 = '4' > par1 <- '4' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_meanplot.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 73 > (np <- floor(n / par1)) [1] 18 > arr <- array(NA,dim=c(par1,np+1)) > darr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > dx <- diff(x) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + darr[j,ari[j]] <- dx[i] + if (j == par1) j = 0 + } > ari [1] 19 18 18 18 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 4.8 4.1 4.5 5.2 5.1 5.1 5.1 4.7 3.7 3.5 3.8 3.9 3.9 3.6 [2,] 4.0 3.8 4.1 4.4 4.6 4.6 4.8 4.0 3.1 3.0 3.3 3.4 3.2 3.0 [3,] 3.5 3.5 3.8 4.3 4.7 4.6 4.4 3.5 2.9 2.7 3.1 3.2 3.0 3.0 [4,] 4.1 4.1 4.6 4.7 4.9 4.8 4.8 4.0 3.3 3.2 3.5 3.6 3.4 3.6 [,15] [,16] [,17] [,18] [,19] [1,] 3.6 3.8 3.5 3.7 3.2 [2,] 3.3 3.3 3.1 3.1 NA [3,] 3.3 3.1 3.0 2.9 NA [4,] 3.6 3.4 3.3 3.1 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] -0.8 -0.3 -0.4 -0.8 -0.5 -0.5 -0.3 -0.7 -0.6 -0.5 -0.5 -0.5 -0.7 -0.6 [2,] -0.5 -0.3 -0.3 -0.1 0.1 0.0 -0.4 -0.5 -0.2 -0.3 -0.2 -0.2 -0.2 0.0 [3,] 0.6 0.6 0.8 0.4 0.2 0.2 0.4 0.5 0.4 0.5 0.4 0.4 0.4 0.6 [4,] 0.0 0.4 0.6 0.4 0.2 0.3 -0.1 -0.3 0.2 0.6 0.4 0.3 0.2 0.0 [,15] [,16] [,17] [,18] [,19] [1,] -0.3 -0.5 -0.4 -0.6 NA [2,] 0.0 -0.2 -0.1 -0.2 NA [3,] 0.3 0.3 0.3 0.2 NA [4,] 0.2 0.1 0.4 0.1 NA > arr.mean <- array(NA,dim=par1) > arr.median <- array(NA,dim=par1) > arr.midrange <- array(NA,dim=par1) > for (j in 1:par1) + { + arr.mean[j] <- mean(arr[j,],na.rm=TRUE) + arr.median[j] <- median(arr[j,],na.rm=TRUE) + arr.midrange[j] <- (quantile(arr[j,],0.75,na.rm=TRUE) + quantile(arr[j,],0.25,na.rm=TRUE)) / 2 + } > overall.mean <- mean(x) > overall.median <- median(x) > overall.midrange <- (quantile(x,0.75) + quantile(x,0.25)) / 2 > postscript(file="/var/wessaorg/rcomp/tmp/189ap1412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.mean,type='b',ylab='mean',main='Mean Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.mean,0) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/2jwej1412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.median,type='b',ylab='median',main='Median Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.median,0) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3au9o1412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.midrange,type='b',ylab='midrange',main='Midrange Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.midrange,0) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/4y7t31412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(arr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [1,] 3.20 3.00 2.70 3.1 [2,] 3.65 3.10 3.00 3.4 [3,] 3.90 3.35 3.25 3.6 [4,] 4.75 4.10 3.80 4.6 [5,] 5.20 4.80 4.70 4.9 $n [1] 19 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] 3.501275 2.97759 2.952072 3.153109 [2,] 4.298725 3.72241 3.547928 4.046891 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(3.2, 3.65, 3.9, 4.75, 5.2, 3, 3.1, 3.35, 4.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/536831412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(darr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Differenced Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [1,] -0.8 -0.5 0.2 -0.3 [2,] -0.6 -0.3 0.3 0.1 [3,] -0.5 -0.2 0.4 0.2 [4,] -0.4 -0.1 0.5 0.4 [5,] -0.3 0.1 0.8 0.6 $n [1] 18 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] -0.5744819 -0.2744819 0.3255181 0.08827713 [2,] -0.4255181 -0.1255181 0.4744819 0.31172287 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(-0.8, -0.6, -0.5, -0.4, -0.3, -0.5, -0.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/630qr1412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(arr) > names(z) <- c(1:np) > (boxplot(z,notch=TRUE,col='grey',xlab='Block Index',ylab='Value',main='Notched Box Plots - Sequential Blocks')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 3.50 3.50 3.80 4.30 4.60 4.60 4.40 3.50 2.9 2.70 3.10 3.20 3.00 3.0 [2,] 3.75 3.65 3.95 4.35 4.65 4.60 4.60 3.75 3.0 2.85 3.20 3.30 3.10 3.0 [3,] 4.05 3.95 4.30 4.55 4.80 4.70 4.80 4.00 3.2 3.10 3.40 3.50 3.30 3.3 [4,] 4.45 4.10 4.55 4.95 5.00 4.95 4.95 4.35 3.5 3.35 3.65 3.75 3.65 3.6 [5,] 4.80 4.10 4.60 5.20 5.10 5.10 5.10 4.70 3.7 3.50 3.80 3.90 3.90 3.6 [,15] [,16] [,17] [,18] [,19] [1,] 3.30 3.10 3.00 2.9 3.2 [2,] 3.30 3.20 3.05 3.0 3.2 [3,] 3.45 3.35 3.20 3.1 3.2 [4,] 3.60 3.60 3.40 3.4 3.2 [5,] 3.60 3.80 3.50 3.7 3.2 $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 3.497 3.5945 3.826 4.076 4.5235 4.4235 4.5235 3.526 2.805 2.705 3.0445 [2,] 4.603 4.3055 4.774 5.024 5.0765 4.9765 5.0765 4.474 3.595 3.495 3.7555 [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 3.1445 2.8655 2.826 3.213 3.034 2.9235 2.784 3.2 [2,] 3.8555 3.7345 3.774 3.687 3.666 3.4765 3.416 3.2 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" NA Warning message: In bxp(list(stats = c(3.5, 3.75, 4.05, 4.45, 4.8, 3.5, 3.65, 3.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7f2gb1412966505.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(cbind(arr.mean,arr.median,arr.midrange)) > names(z) <- list('mean','median','midrange') > (boxplot(z,notch=TRUE,col='grey',ylab='Overall Central Tendency',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 3.472222 3.250 3.36250 [2,] 3.572222 3.300 3.48125 [3,] 3.780556 3.475 3.76875 [4,] 4.018129 3.750 4.06875 [5,] 4.147368 3.900 4.20000 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 3.428289 3.1195 3.304625 [2,] 4.132822 3.8305 4.232875 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(3.47222222222222, 3.57222222222222, 3.78055555555556, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/189ap1412966505.ps tmp/189ap1412966505.png",intern=TRUE)) character(0) > try(system("convert tmp/2jwej1412966505.ps tmp/2jwej1412966505.png",intern=TRUE)) character(0) > try(system("convert tmp/3au9o1412966505.ps tmp/3au9o1412966505.png",intern=TRUE)) character(0) > try(system("convert tmp/4y7t31412966505.ps tmp/4y7t31412966505.png",intern=TRUE)) character(0) > try(system("convert tmp/536831412966505.ps tmp/536831412966505.png",intern=TRUE)) character(0) > try(system("convert tmp/630qr1412966505.ps tmp/630qr1412966505.png",intern=TRUE)) character(0) > try(system("convert tmp/7f2gb1412966505.ps tmp/7f2gb1412966505.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.398 0.438 2.871