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(1.94,1.82,1.8,1.79,1.79,1.78,1.81,1.84,1.87,1.87,1.87,1.84,1.82,1.83,1.83,1.82,1.83,1.87,1.88,1.9,1.98,2.03,2.14,2.42,2.73,2.84,2.85,2.94,3.06,3.24,3.18,3.01,2.87,2.73,2.63,2.39,2.26,2.11,2.01,1.99,1.96,1.93,1.98,2.07,2.24,2.31,2.23,2.26,2.28,2.3,2.33,2.26,2.24,2.47,2.55,2.89,3.21,3.21,2.92,2.68,2.4,2.28,2.24,2.2,2.18,2.23,2.24,2.25,2.23,2.25,2.23,2.21,2.17,2.17,2.13,2.12,2.13,2.17,2.33,2.5,2.57,2.59,2.58,2.31) > 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,] 1.94 1.82 2.73 2.26 2.28 2.40 2.17 NA [2,] 1.82 1.83 2.84 2.11 2.30 2.28 2.17 NA [3,] 1.80 1.83 2.85 2.01 2.33 2.24 2.13 NA [4,] 1.79 1.82 2.94 1.99 2.26 2.20 2.12 NA [5,] 1.79 1.83 3.06 1.96 2.24 2.18 2.13 NA [6,] 1.78 1.87 3.24 1.93 2.47 2.23 2.17 NA [7,] 1.81 1.88 3.18 1.98 2.55 2.24 2.33 NA [8,] 1.84 1.90 3.01 2.07 2.89 2.25 2.50 NA [9,] 1.87 1.98 2.87 2.24 3.21 2.23 2.57 NA [10,] 1.87 2.03 2.73 2.31 3.21 2.25 2.59 NA [11,] 1.87 2.14 2.63 2.23 2.92 2.23 2.58 NA [12,] 1.84 2.42 2.39 2.26 2.68 2.21 2.31 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -0.12 0.01 0.11 -0.15 0.02 -0.12 0.00 NA [2,] -0.02 0.00 0.01 -0.10 0.03 -0.04 -0.04 NA [3,] -0.01 -0.01 0.09 -0.02 -0.07 -0.04 -0.01 NA [4,] 0.00 0.01 0.12 -0.03 -0.02 -0.02 0.01 NA [5,] -0.01 0.04 0.18 -0.03 0.23 0.05 0.04 NA [6,] 0.03 0.01 -0.06 0.05 0.08 0.01 0.16 NA [7,] 0.03 0.02 -0.17 0.09 0.34 0.01 0.17 NA [8,] 0.03 0.08 -0.14 0.17 0.32 -0.02 0.07 NA [9,] 0.00 0.05 -0.14 0.07 0.00 0.02 0.02 NA [10,] 0.00 0.11 -0.10 -0.08 -0.29 -0.02 -0.01 NA [11,] -0.03 0.28 -0.24 0.03 -0.24 -0.02 -0.27 NA [12,] -0.02 0.31 -0.13 0.02 -0.28 -0.04 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/1y30e1386192556.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/2uhuo1386192556.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/3232v1386192556.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/41sij1386192556.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] [,12] [1,] 1.820 1.82 1.800 1.790 1.790 1.78 1.81 1.840 1.870 1.87 1.870 2.210 [2,] 2.055 1.97 1.920 1.905 1.895 1.90 1.93 1.985 2.105 2.14 2.185 2.235 [3,] 2.260 2.17 2.130 2.120 2.130 2.17 2.24 2.250 2.240 2.31 2.230 2.310 [4,] 2.340 2.29 2.285 2.230 2.210 2.35 2.44 2.695 2.720 2.66 2.605 2.405 [5,] 2.730 2.30 2.330 2.260 2.240 2.47 3.18 3.010 3.210 3.21 2.920 2.420 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2.089803 1.978901 1.912028 1.925915 1.941887 1.901267 1.935436 1.825999 [2,] 2.430197 2.361099 2.347972 2.314085 2.318113 2.438733 2.544564 2.674001 [,9] [,10] [,11] [,12] [1,] 1.872732 1.999464 1.979183 2.208479 [2,] 2.607268 2.620536 2.480817 2.411521 $out [1] 2.84 2.85 2.94 3.06 3.24 1.84 2.68 $group [1] 2 3 4 5 6 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1.82, 2.055, 2.26, 2.34, 2.73, 1.82, 1.97, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5a6y51386192556.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.150 -0.100 -0.04 -0.03 -0.030 -0.060 0.010 -0.140 0.000 -0.100 -0.270 [2,] -0.120 -0.040 -0.03 -0.02 0.015 0.010 0.015 0.005 0.000 -0.090 -0.240 [3,] 0.000 -0.020 -0.01 0.00 0.040 0.030 0.030 0.070 0.020 -0.020 -0.030 [4,] 0.015 0.005 -0.01 0.01 0.115 0.065 0.130 0.125 0.035 -0.005 0.005 [5,] 0.110 0.030 -0.01 0.01 0.230 0.080 0.170 0.170 0.070 0.110 0.280 [,12] [1,] -0.28 [2,] -0.13 [3,] -0.03 [4,] 0.02 [5,] 0.02 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.08061982 -0.046873274 -0.021943677 -0.01791552 -0.01971839 -0.002845113 [2,] 0.08061982 0.006873274 0.001943677 0.01791552 0.09971839 0.062845113 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.03867614 -0.001662064 -0.0009014354 -0.07076063 -0.17631 -0.12675484 [2,] 0.09867614 0.141662064 0.0409014354 0.03076063 0.11631 0.06675484 $out [1] 0.09 -0.07 0.12 0.16 -0.17 0.34 0.32 -0.14 -0.29 0.31 $group [1] 3 3 4 6 7 7 8 9 10 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.15, -0.12, 0, 0.015, 0.11, -0.1, -0.0399999999999998, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6rpfn1386192556.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,] 1.780 1.820 2.390 1.930 2.240 2.180 2.120 NA [2,] 1.795 1.830 2.730 1.985 2.290 2.220 2.150 NA [3,] 1.830 1.875 2.860 2.090 2.510 2.235 2.240 NA [4,] 1.870 2.005 3.035 2.250 2.905 2.250 2.535 NA [5,] 1.940 2.140 3.240 2.310 3.210 2.280 2.590 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.795792 1.795181 2.720887 1.969132 2.229494 2.221317 2.064399 NA [2,] 1.864208 1.954819 2.999113 2.210868 2.790506 2.248683 2.415601 NA $out [1] 2.42 2.40 $group [1] 2 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(1.78, 1.795, 1.83, 1.87, 1.94, 1.82, 1.83, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7wnns1386192556.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,] 2.160000 2.120 2.05250 [2,] 2.181429 2.150 2.11375 [3,] 2.261429 2.235 2.19125 [4,] 2.361429 2.255 2.36750 [5,] 2.427143 2.310 2.41250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.179329 2.187109 2.075513 [2,] 2.343528 2.282891 2.306987 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(2.16, 2.18142857142857, 2.26142857142857, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1y30e1386192556.ps tmp/1y30e1386192556.png",intern=TRUE)) character(0) > try(system("convert tmp/2uhuo1386192556.ps tmp/2uhuo1386192556.png",intern=TRUE)) character(0) > try(system("convert tmp/3232v1386192556.ps tmp/3232v1386192556.png",intern=TRUE)) character(0) > try(system("convert tmp/41sij1386192556.ps tmp/41sij1386192556.png",intern=TRUE)) character(0) > try(system("convert tmp/5a6y51386192556.ps tmp/5a6y51386192556.png",intern=TRUE)) character(0) > try(system("convert tmp/6rpfn1386192556.ps tmp/6rpfn1386192556.png",intern=TRUE)) character(0) > try(system("convert tmp/7wnns1386192556.ps tmp/7wnns1386192556.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.149 1.398 7.489