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(6.715,7.703,9.856,8.326,9.269,7.035,10.342,11.682,10.304,11.385,9.777,8.882,7.897,6.930,9.545,9.110,7.459,7.320,10.017,12.307,11.072,10.749,9.589,9.080,7.384,8.062,8.511,8.684,8.306,7.643,10.577,13.747,11.783,11.611,9.946,8.693,7.303,7.609,9.423,8.584,7.586,6.843,11.811,13.414,12.103,11.501,8.213,7.982,7.687,7.180,7.862,8.043,8.340,6.692,10.065,12.684,11.587,9.843,8.110,7.940,6.475,6.121,9.669,7.778,7.826,7.403,10.741,14.023,11.519,10.236,8.075,8.157) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.715 7.897 7.384 7.303 7.687 6.475 NA [2,] 7.703 6.930 8.062 7.609 7.180 6.121 NA [3,] 9.856 9.545 8.511 9.423 7.862 9.669 NA [4,] 8.326 9.110 8.684 8.584 8.043 7.778 NA [5,] 9.269 7.459 8.306 7.586 8.340 7.826 NA [6,] 7.035 7.320 7.643 6.843 6.692 7.403 NA [7,] 10.342 10.017 10.577 11.811 10.065 10.741 NA [8,] 11.682 12.307 13.747 13.414 12.684 14.023 NA [9,] 10.304 11.072 11.783 12.103 11.587 11.519 NA [10,] 11.385 10.749 11.611 11.501 9.843 10.236 NA [11,] 9.777 9.589 9.946 8.213 8.110 8.075 NA [12,] 8.882 9.080 8.693 7.982 7.940 8.157 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.988 -0.967 0.678 0.306 -0.507 -0.354 NA [2,] 2.153 2.615 0.449 1.814 0.682 3.548 NA [3,] -1.530 -0.435 0.173 -0.839 0.181 -1.891 NA [4,] 0.943 -1.651 -0.378 -0.998 0.297 0.048 NA [5,] -2.234 -0.139 -0.663 -0.743 -1.648 -0.423 NA [6,] 3.307 2.697 2.934 4.968 3.373 3.338 NA [7,] 1.340 2.290 3.170 1.603 2.619 3.282 NA [8,] -1.378 -1.235 -1.964 -1.311 -1.097 -2.504 NA [9,] 1.081 -0.323 -0.172 -0.602 -1.744 -1.283 NA [10,] -1.608 -1.160 -1.665 -3.288 -1.733 -2.161 NA [11,] -0.895 -0.509 -1.253 -0.231 -0.170 0.082 NA [12,] -0.985 -1.696 -1.390 -0.295 -1.465 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/19mcd1386680517.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/2ki2v1386680517.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/3988w1386680517.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/4p0v01386680517.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,] 6.4750 6.1210 7.862 7.778 7.459 6.6920 10.0170 11.682 10.304 9.843 8.075 [2,] 6.7150 6.9300 8.511 8.043 7.586 6.8430 10.0650 12.307 11.072 10.236 8.110 [3,] 7.3435 7.3945 9.484 8.455 8.066 7.1775 10.4595 13.049 11.553 11.067 8.901 [4,] 7.6870 7.7030 9.669 8.684 8.340 7.4030 10.7410 13.747 11.783 11.501 9.777 [5,] 7.8970 8.0620 9.856 9.110 9.269 7.6430 10.7410 14.023 12.103 11.611 9.946 [,12] [1,] 7.940 [2,] 7.982 [3,] 8.425 [4,] 8.882 [5,] 9.080 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.716529 6.89589 8.737053 8.041534 7.579646 6.816282 10.02346 12.12015 [2,] 7.970471 7.89311 10.230947 8.868466 8.552354 7.538718 10.89554 13.97785 [,9] [,10] [,11] [,12] [1,] 11.09438 10.25103 7.825731 7.844471 [2,] 12.01162 11.88297 9.976269 9.005529 $out [1] 11.811 $group [1] 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(6.475, 6.715, 7.3435, 7.687, 7.897, 6.121, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5wl6x1386680518.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] [1,] -0.967 0.4490 -1.891 -1.651 -2.234 2.6970 1.3400 -2.5040 -1.7440 -2.161 [2,] -0.507 0.6820 -1.530 -0.998 -1.648 2.9340 1.6030 -1.9640 -1.2830 -2.161 [3,] -0.024 1.9835 -0.637 -0.165 -0.703 3.3225 2.4545 -1.3445 -0.4625 -1.699 [4,] 0.678 2.6150 0.173 0.297 -0.423 3.3730 3.1700 -1.2350 -0.1720 -1.608 [5,] 0.988 3.5480 0.181 0.943 -0.139 3.3730 3.2820 -1.0970 1.0810 -1.160 [,11] [,12] [1,] -1.253 -1.696 [2,] -0.895 -1.465 [3,] -0.370 -1.390 [4,] -0.170 -0.985 [5,] 0.082 -0.295 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.7883633 0.7366526 -1.73549 -1.0003168 -1.49316457 3.039331 1.443734 [2,] 0.7403633 3.2303474 0.46149 0.6703168 0.08716457 3.605669 3.465266 [,8] [,9] [,10] [,11] [,12] [1,] -1.8147285 -1.1791309 -2.055703 -0.83764842 -1.729167 [2,] -0.8742715 0.2541309 -1.342297 0.09764842 -1.050833 $out [1] 4.968 -3.288 $group [1] 6 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.967000000000001, -0.507000000000001, -0.0239999999999996, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/697uu1386680518.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] [1,] 6.7150 6.9300 7.3840 6.8430 6.6920 6.1210 NA [2,] 8.0145 7.6780 8.1840 7.5975 7.7745 7.5905 NA [3,] 9.5230 9.3275 8.6885 8.3985 8.0765 8.1160 NA [4,] 10.3230 10.3830 11.0940 11.6560 9.9540 10.4885 NA [5,] 11.6820 12.3070 13.7470 13.4140 12.6840 14.0230 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 8.470078 8.093731 7.361229 6.547391 7.082415 6.794203 NA [2,] 10.575922 10.561269 10.015771 10.249609 9.070585 9.437797 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(6.715, 8.0145, 9.523, 10.323, 11.682, 6.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7dcaf1386680518.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,] 7.156000 7.17750 7.136625 [2,] 7.699250 7.73025 7.662375 [3,] 8.703667 8.67800 8.681563 [4,] 10.739833 10.76325 10.667625 [5,] 12.976167 13.04900 13.032500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.316836 7.294628 7.310848 [2,] 10.090497 10.061372 10.052277 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(7.156, 7.69925, 8.70366666666667, 10.7398333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/19mcd1386680517.ps tmp/19mcd1386680517.png",intern=TRUE)) character(0) > try(system("convert tmp/2ki2v1386680517.ps tmp/2ki2v1386680517.png",intern=TRUE)) character(0) > try(system("convert tmp/3988w1386680517.ps tmp/3988w1386680517.png",intern=TRUE)) character(0) > try(system("convert tmp/4p0v01386680517.ps tmp/4p0v01386680517.png",intern=TRUE)) character(0) > try(system("convert tmp/5wl6x1386680518.ps tmp/5wl6x1386680518.png",intern=TRUE)) character(0) > try(system("convert tmp/697uu1386680518.ps tmp/697uu1386680518.png",intern=TRUE)) character(0) > try(system("convert tmp/7dcaf1386680518.ps tmp/7dcaf1386680518.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.405 1.349 7.751