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(10.92,10.98,11.15,11.19,11.33,11.38,11.4,11.45,11.56,11.61,11.82,11.77,11.85,11.82,11.92,11.86,11.87,11.94,11.86,11.92,11.83,11.91,11.93,11.99,11.96,12.12,11.85,12.01,12.1,12.21,12.31,12.31,12.39,12.35,12.41,12.51,12.27,12.51,12.44,12.47,12.51,12.58,12.5,12.52,12.59,12.51,12.67,12.64,12.54,12.6,12.67,12.62,12.72,12.85,12.85,12.82,12.79,12.94,12.71,12.56,12.64,12.7,12.74,12.85,12.84,12.83,12.88,13.07,12.99,13.2,13.23,13.18,13.18,13.1,13.23,13.33,13.38,13.26,13.17,13.27,13.47,13.63,13.64,13.69) > 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,] 10.92 11.85 11.96 12.27 12.54 12.64 13.18 NA [2,] 10.98 11.82 12.12 12.51 12.60 12.70 13.10 NA [3,] 11.15 11.92 11.85 12.44 12.67 12.74 13.23 NA [4,] 11.19 11.86 12.01 12.47 12.62 12.85 13.33 NA [5,] 11.33 11.87 12.10 12.51 12.72 12.84 13.38 NA [6,] 11.38 11.94 12.21 12.58 12.85 12.83 13.26 NA [7,] 11.40 11.86 12.31 12.50 12.85 12.88 13.17 NA [8,] 11.45 11.92 12.31 12.52 12.82 13.07 13.27 NA [9,] 11.56 11.83 12.39 12.59 12.79 12.99 13.47 NA [10,] 11.61 11.91 12.35 12.51 12.94 13.20 13.63 NA [11,] 11.82 11.93 12.41 12.67 12.71 13.23 13.64 NA [12,] 11.77 11.99 12.51 12.64 12.56 13.18 13.69 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.06 -0.03 0.16 0.24 0.06 0.06 -0.08 NA [2,] 0.17 0.10 -0.27 -0.07 0.07 0.04 0.13 NA [3,] 0.04 -0.06 0.16 0.03 -0.05 0.11 0.10 NA [4,] 0.14 0.01 0.09 0.04 0.10 -0.01 0.05 NA [5,] 0.05 0.07 0.11 0.07 0.13 -0.01 -0.12 NA [6,] 0.02 -0.08 0.10 -0.08 0.00 0.05 -0.09 NA [7,] 0.05 0.06 0.00 0.02 -0.03 0.19 0.10 NA [8,] 0.11 -0.09 0.08 0.07 -0.03 -0.08 0.20 NA [9,] 0.05 0.08 -0.04 -0.08 0.15 0.21 0.16 NA [10,] 0.21 0.02 0.06 0.16 -0.23 0.03 0.01 NA [11,] -0.05 0.06 0.10 -0.03 -0.15 -0.05 0.05 NA [12,] 0.08 -0.03 -0.24 -0.10 0.08 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/fisher/rcomp/tmp/10r7d1382262636.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/fisher/rcomp/tmp/29oky1382262636.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/fisher/rcomp/tmp/3da2v1382262636.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/fisher/rcomp/tmp/4hamj1382262636.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,] 10.920 10.98 11.150 11.190 11.330 11.380 11.400 11.450 11.56 11.61 11.82 [2,] 11.905 11.97 11.885 11.935 11.985 12.075 12.085 12.115 12.11 12.13 12.17 [3,] 12.270 12.51 12.440 12.470 12.510 12.580 12.500 12.520 12.59 12.51 12.67 [4,] 12.590 12.65 12.705 12.735 12.780 12.840 12.865 12.945 12.89 13.07 12.97 [5,] 13.180 13.10 13.230 13.330 13.380 13.260 13.170 13.270 13.47 13.63 13.64 [,12] [1,] 11.77 [2,] 12.25 [3,] 12.56 [4,] 12.91 [5,] 13.69 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 11.86093 12.10391 11.95031 11.99225 12.03524 12.12315 12.0342 12.02434 [2,] 12.67907 12.91609 12.92969 12.94775 12.98476 13.03685 12.9658 13.01566 [,9] [,10] [,11] [,12] [1,] 12.1242 11.94865 12.19225 12.16586 [2,] 13.0558 13.07135 13.14775 12.95414 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(10.92, 11.905, 12.27, 12.59, 13.18, 10.98, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5d5261382262636.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] [1,] -0.080 -0.070 -0.060 -0.010 -0.01 -0.090 -0.03 -0.090 -0.080 0.010 -0.150 [2,] 0.015 -0.015 -0.010 0.025 0.02 -0.080 0.01 -0.055 0.005 0.015 -0.050 [3,] 0.060 0.070 0.040 0.050 0.07 0.000 0.05 0.070 0.080 0.030 -0.030 [4,] 0.110 0.115 0.105 0.095 0.09 0.035 0.08 0.095 0.155 0.110 0.055 [5,] 0.240 0.170 0.160 0.140 0.13 0.100 0.10 0.200 0.210 0.210 0.100 [,12] [1,] -0.240 [2,] -0.100 [3,] -0.015 [4,] 0.080 [5,] 0.080 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.003267533 -0.007633903 -0.02867614 0.008197129 0.02819713 -0.06867614 [2,] 0.116732467 0.147633903 0.10867614 0.091802871 0.11180287 0.06867614 [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.008197129 -0.01957758 -0.00957758 -0.02673247 -0.09270431 -0.1311058 [2,] 0.091802871 0.15957758 0.16957758 0.08673247 0.03270431 0.1011058 $out [1] -0.27 -0.12 0.19 -0.23 $group [1] 2 5 7 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0800000000000001, 0.0149999999999997, 0.0600000000000005, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/679at1382262636.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,] 10.920 11.820 11.850 12.440 12.540 12.640 13.100 NA [2,] 11.170 11.855 12.055 12.485 12.610 12.785 13.205 NA [3,] 11.390 11.890 12.260 12.510 12.715 12.865 13.300 NA [4,] 11.585 11.925 12.370 12.585 12.835 13.125 13.550 NA [5,] 11.820 11.990 12.510 12.670 12.940 13.230 13.690 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 11.20072 11.85807 12.11633 12.46439 12.61238 12.70992 13.14264 NA [2,] 11.57928 11.92193 12.40367 12.55561 12.81762 13.02008 13.45736 NA $out [1] 12.27 $group [1] 4 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(10.92, 11.17, 11.39, 11.585, 11.82, 11.82, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/704y81382262636.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,] 12.19429 12.440 12.24750 [2,] 12.30929 12.485 12.32250 [3,] 12.43000 12.510 12.46625 [4,] 12.55500 12.570 12.55000 [5,] 12.63000 12.670 12.60000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 12.31793 12.47123 12.36249 [2,] 12.54207 12.54877 12.57001 $out [1] 12.27 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(12.1942857142857, 12.3092857142857, 12.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/10r7d1382262636.ps tmp/10r7d1382262636.png",intern=TRUE)) character(0) > try(system("convert tmp/29oky1382262636.ps tmp/29oky1382262636.png",intern=TRUE)) character(0) > try(system("convert tmp/3da2v1382262636.ps tmp/3da2v1382262636.png",intern=TRUE)) character(0) > try(system("convert tmp/4hamj1382262636.ps tmp/4hamj1382262636.png",intern=TRUE)) character(0) > try(system("convert tmp/5d5261382262636.ps tmp/5d5261382262636.png",intern=TRUE)) character(0) > try(system("convert tmp/679at1382262636.ps tmp/679at1382262636.png",intern=TRUE)) character(0) > try(system("convert tmp/704y81382262636.ps tmp/704y81382262636.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.024 0.561 3.574