R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(20.89,21.04,21.07,21.12,21.25,21.24,21.24,21.22,21.29,21.25,21.15,21.16,21.16,21.52,21.59,21.6,21.68,21.67,21.67,21.65,21.74,21.72,21.84,21.94,21.94,21.95,21.96,22.1,22.13,22.18,22.18,22.27,22.3,22.04,22.05,22.06,22.06,22.06,21.97,22.03,22.08,22.13,22.13,22.4,22.4,22.12,22.22,22.14,22.14,22.19,22.29,22.24,22.26,22.29,22.29,22.29,22.29,22.35,22.39,22.43,22.43,22.11,22.12,22.05,22.05,22.08,22.08,22.09,22.09,22.24,22.25,22.24,22.24,22.25,22.28,22.23,22.29,22.31,22.31,22.31,22.39,22.42,22.42,22.42) > par1 = '12' > par1 <- '12' > #'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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 20.89 21.16 21.94 22.06 22.14 22.43 22.24 NA [2,] 21.04 21.52 21.95 22.06 22.19 22.11 22.25 NA [3,] 21.07 21.59 21.96 21.97 22.29 22.12 22.28 NA [4,] 21.12 21.60 22.10 22.03 22.24 22.05 22.23 NA [5,] 21.25 21.68 22.13 22.08 22.26 22.05 22.29 NA [6,] 21.24 21.67 22.18 22.13 22.29 22.08 22.31 NA [7,] 21.24 21.67 22.18 22.13 22.29 22.08 22.31 NA [8,] 21.22 21.65 22.27 22.40 22.29 22.09 22.31 NA [9,] 21.29 21.74 22.30 22.40 22.29 22.09 22.39 NA [10,] 21.25 21.72 22.04 22.12 22.35 22.24 22.42 NA [11,] 21.15 21.84 22.05 22.22 22.39 22.25 22.42 NA [12,] 21.16 21.94 22.06 22.14 22.43 22.24 22.42 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.15 0.36 0.01 0.00 0.05 -0.32 0.01 NA [2,] 0.03 0.07 0.01 -0.09 0.10 0.01 0.03 NA [3,] 0.05 0.01 0.14 0.06 -0.05 -0.07 -0.05 NA [4,] 0.13 0.08 0.03 0.05 0.02 0.00 0.06 NA [5,] -0.01 -0.01 0.05 0.05 0.03 0.03 0.02 NA [6,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NA [7,] -0.02 -0.02 0.09 0.27 0.00 0.01 0.00 NA [8,] 0.07 0.09 0.03 0.00 0.00 0.00 0.08 NA [9,] -0.04 -0.02 -0.26 -0.28 0.06 0.15 0.03 NA [10,] -0.10 0.12 0.01 0.10 0.04 0.01 0.00 NA [11,] 0.01 0.10 0.01 -0.08 0.04 -0.01 0.00 NA [12,] 0.00 0.00 0.00 0.00 0.00 0.00 NA 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/1zfu51382093556.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/2zgos1382093556.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/35aqn1382093556.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/4uk6b1382093556.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] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 20.89 21.520 21.590 21.600 21.680 21.670 21.670 21.65 21.290 21.720 21.840 [2,] 21.55 21.735 21.775 21.815 21.865 21.875 21.875 21.87 21.915 21.880 21.945 [3,] 22.06 22.060 21.970 22.050 22.080 22.130 22.130 22.27 22.290 22.120 22.220 [4,] 22.19 22.150 22.200 22.165 22.195 22.235 22.235 22.30 22.345 22.295 22.320 [5,] 22.43 22.250 22.290 22.240 22.290 22.310 22.310 22.40 22.400 22.420 22.420 [,12] [1,] 21.94 [2,] 22.00 [3,] 22.14 [4,] 22.33 [5,] 22.43 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 21.6778 21.81217 21.7162 21.84099 21.88293 21.91501 21.91501 22.01321 [2,] 22.4422 22.30783 22.2238 22.25901 22.27707 22.34499 22.34499 22.52679 [,9] [,10] [,11] [,12] [1,] 22.03321 21.87217 21.99606 21.94293 [2,] 22.54679 22.36783 22.44394 22.33707 $out [1] 21.04 21.07 21.12 21.25 21.24 21.24 21.22 21.25 21.15 21.16 $group [1] 2 3 4 5 6 7 8 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(20.89, 21.55, 22.06, 22.19, 22.43, 21.52, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/52t9a1382093556.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] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.000 0.01 -0.070 0.000 -0.010 0 -0.02 0.000 -0.280 0.000 -0.010 0 [2,] 0.005 0.01 -0.050 0.025 0.005 0 -0.01 0.000 -0.150 0.005 -0.005 0 [3,] 0.010 0.03 0.010 0.050 0.030 0 0.00 0.030 -0.020 0.010 0.010 0 [4,] 0.100 0.05 0.055 0.070 0.040 0 0.05 0.075 0.045 0.070 0.025 0 [5,] 0.150 0.10 0.140 0.130 0.050 0 0.09 0.090 0.150 0.120 0.040 0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.04673247 0.006112645 -0.05270431 0.02312673 0.009098565 0 [2,] 0.06673247 0.053887355 0.07270431 0.07687327 0.050901435 0 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.03583103 -0.01478879 -0.13645085 -0.02881695 -0.007915516 0 [2,] 0.03583103 0.07478879 0.09645085 0.04881695 0.027915516 0 $out [1] 0.36 -0.32 -0.09 0.27 -0.10 0.10 -0.08 $group [1] 1 1 2 7 10 11 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0.00499999999999901, 0.0100000000000016, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6lau41382093556.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] [1,] 20.890 21.520 21.94 21.970 22.19 22.05 22.230 NA [2,] 21.095 21.595 22.00 22.060 22.25 22.08 22.265 NA [3,] 21.190 21.670 22.08 22.125 22.29 22.10 22.310 NA [4,] 21.245 21.730 22.18 22.180 22.32 22.24 22.405 NA [5,] 21.290 21.840 22.30 22.220 22.39 22.43 22.420 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 21.12158 21.60843 21.9979 22.07027 22.25807 22.02702 22.24615 NA [2,] 21.25842 21.73157 22.1621 22.17973 22.32193 22.17298 22.37385 NA $out [1] 21.16 21.94 22.40 22.40 22.14 22.43 $group [1] 2 2 4 4 5 5 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(20.89, 21.095, 21.19, 21.245, 21.29, 21.52, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/70kpz1382093556.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,] 21.83714 21.970 21.87000 [2,] 21.90357 22.060 21.98875 [3,] 21.98571 22.125 22.05500 [4,] 22.03929 22.180 22.10875 [5,] 22.07143 22.290 22.16500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 21.92381 22.07027 22.00027 [2,] 22.04761 22.17973 22.10973 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(21.8371428571429, 21.9035714285714, 21.9857142857143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zfu51382093556.ps tmp/1zfu51382093556.png",intern=TRUE)) character(0) > try(system("convert tmp/2zgos1382093556.ps tmp/2zgos1382093556.png",intern=TRUE)) character(0) > try(system("convert tmp/35aqn1382093556.ps tmp/35aqn1382093556.png",intern=TRUE)) character(0) > try(system("convert tmp/4uk6b1382093556.ps tmp/4uk6b1382093556.png",intern=TRUE)) character(0) > try(system("convert tmp/52t9a1382093556.ps tmp/52t9a1382093556.png",intern=TRUE)) character(0) > try(system("convert tmp/6lau41382093556.ps tmp/6lau41382093556.png",intern=TRUE)) character(0) > try(system("convert tmp/70kpz1382093556.ps tmp/70kpz1382093556.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.578 0.792 4.355