R version 3.0.1 (2013-05-16) -- "Good Sport" 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(12960,12480,13200,10560,13680,13440,14400,14880,16560,14400,13680,17040,14400,10800,12720,9600,13440,11040,14640,13200,13920,15600,15360,18240,13200,11040,12240,8880,12720,9840,13920,13200,11760,16800,15120,17280,12960,12000,10800,8880,11760,10560,14400,13920,12000,16080,14880,19200,15360,9360,9360,9360,11040,11040,14880,13680,12240,15360,14160,20400,16080,9360,9840,8160,11280,12960,16320,16080,12960,15120,13440,19200,14640,11760,10560,7920,11760,14160,16560,15600,11520,16560,12960,19920,16560,12000,11040,7440,11760,11280,17040,17040,12960,16800,12480,19440,16560,12240,9360,6480,12720,12240,16080,18480,13680,15360,11520,19920) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 12960 14400 13200 12960 15360 16080 14640 16560 16560 NA [2,] 12480 10800 11040 12000 9360 9360 11760 12000 12240 NA [3,] 13200 12720 12240 10800 9360 9840 10560 11040 9360 NA [4,] 10560 9600 8880 8880 9360 8160 7920 7440 6480 NA [5,] 13680 13440 12720 11760 11040 11280 11760 11760 12720 NA [6,] 13440 11040 9840 10560 11040 12960 14160 11280 12240 NA [7,] 14400 14640 13920 14400 14880 16320 16560 17040 16080 NA [8,] 14880 13200 13200 13920 13680 16080 15600 17040 18480 NA [9,] 16560 13920 11760 12000 12240 12960 11520 12960 13680 NA [10,] 14400 15600 16800 16080 15360 15120 16560 16800 15360 NA [11,] 13680 15360 15120 14880 14160 13440 12960 12480 11520 NA [12,] 17040 18240 17280 19200 20400 19200 19920 19440 19920 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -480 -3600 -2160 -960 -6000 -6720 -2880 -4560 -4320 NA [2,] 720 1920 1200 -1200 0 480 -1200 -960 -2880 NA [3,] -2640 -3120 -3360 -1920 0 -1680 -2640 -3600 -2880 NA [4,] 3120 3840 3840 2880 1680 3120 3840 4320 6240 NA [5,] -240 -2400 -2880 -1200 0 1680 2400 -480 -480 NA [6,] 960 3600 4080 3840 3840 3360 2400 5760 3840 NA [7,] 480 -1440 -720 -480 -1200 -240 -960 0 2400 NA [8,] 1680 720 -1440 -1920 -1440 -3120 -4080 -4080 -4800 NA [9,] -2160 1680 5040 4080 3120 2160 5040 3840 1680 NA [10,] -720 -240 -1680 -1200 -1200 -1680 -3600 -4320 -3840 NA [11,] 3360 2880 2160 4320 6240 5760 6960 6960 8400 NA [12,] -2640 -5040 -4320 -3840 -4320 -4560 -3360 -2880 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/17ucs1376904503.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/2mdvv1376904503.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/3xr541376904503.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/4zuzh1376904503.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,] 12960 9360 9360 6480 11040 9840 13920 13200 11520 14400 11520 17040 [2,] 13200 10800 9840 7920 11760 11040 14400 13680 12000 15360 12960 18240 [3,] 14640 11760 10800 8880 11760 11280 14880 14880 12960 15600 13680 19200 [4,] 16080 12000 12240 9360 12720 12960 16320 16080 13680 16560 14880 19920 [5,] 16560 12480 13200 10560 13680 14160 17040 18480 13920 16800 15360 20400 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 13123.2 11128 9536 8121.6 11254.4 10268.8 13868.8 13616 12075.2 14968 [2,] 16156.8 12392 12064 9638.4 12265.6 12291.2 15891.2 16144 13844.8 16232 [,11] [,12] [1,] 12668.8 18315.2 [2,] 14691.2 20084.8 $out [1] 16560 $group [1] 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(12960, 13200, 14640, 16080, 16560, 9360, 10800, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5qk6y1376904503.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,] -6720 -2880 -3600 2880 -2880 3360 -1440 -4800 1680 -4320 2160 -5040 [2,] -4560 -1200 -3120 3120 -1200 3360 -960 -4080 1680 -3600 3360 -4440 [3,] -3600 0 -2640 3840 -480 3840 -480 -1920 3120 -1680 5760 -4080 [4,] -2160 720 -1920 3840 0 3840 0 -1440 4080 -1200 6960 -3120 [5,] -480 1920 -1680 4320 1680 4080 480 1680 5040 -240 8400 -2640 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -4864 -1011.2 -3272 3460.8 -1112 3587.2 -985.6 -3310.4 1856 -2944 3864 [2,] -2336 1011.2 -2008 4219.2 152 4092.8 25.6 -529.6 4384 -416 7656 [,12] [1,] -4817.371 [2,] -3342.629 $out [1] 0 1680 6240 2400 960 2400 5760 2400 -2160 $group [1] 3 4 4 5 6 6 6 7 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-6720, -4560, -3600, -2160, -480, -2880, -1200, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6i9g01376904503.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] [1,] 12480 9600 8880 8880 9360 8160 7920 7440 6480 NA [2,] 13080 11880 11400 11280 10200 10560 11640 11520 11880 NA [3,] 13680 13680 12960 12480 12960 13200 13560 12720 13200 NA [4,] 14640 15000 14520 14640 15120 16080 16080 16920 16320 NA [5,] 16560 18240 17280 19200 20400 19200 19920 19440 19920 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 12968.47 12256.95 11536.95 10947.48 10715.95 10682.29 11534.89 10257.02 [2,] 14391.53 15103.05 14383.05 14012.52 15204.05 15717.71 15585.11 15182.98 [,9] [,10] [1,] 11174.89 NA [2,] 15225.11 NA $out [1] 10560 17040 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(12480, 13080, 13680, 14640, 16560, 9600, 11880, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/78j241376904503.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,] 8586.667 8880 8640 [2,] 11533.333 11520 11700 [3,] 13400.000 13320 13380 [4,] 15240.000 14880 15120 [5,] 18960.000 19200 19080 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 11709.36 11787.48 11820.12 [2,] 15090.64 14852.52 14939.88 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/17ucs1376904503.ps tmp/17ucs1376904503.png",intern=TRUE)) character(0) > try(system("convert tmp/2mdvv1376904503.ps tmp/2mdvv1376904503.png",intern=TRUE)) character(0) > try(system("convert tmp/3xr541376904503.ps tmp/3xr541376904503.png",intern=TRUE)) character(0) > try(system("convert tmp/4zuzh1376904503.ps tmp/4zuzh1376904503.png",intern=TRUE)) character(0) > try(system("convert tmp/5qk6y1376904503.ps tmp/5qk6y1376904503.png",intern=TRUE)) character(0) > try(system("convert tmp/6i9g01376904503.ps tmp/6i9g01376904503.png",intern=TRUE)) character(0) > try(system("convert tmp/78j241376904503.ps tmp/78j241376904503.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.935 1.113 6.029