R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(43200,41600,44000,35200,45600,44800,48000,49600,55200,48000,45600,56800,48000,36000,42400,32000,44800,36800,48800,44000,46400,52000,51200,60800,44000,36800,40800,29600,42400,32800,46400,44000,39200,56000,50400,57600,43200,40000,36000,29600,39200,35200,48000,46400,40000,53600,49600,64000,51200,31200,31200,31200,36800,36800,49600,45600,40800,51200,47200,68000,53600,31200,32800,27200,37600,43200,54400,53600,43200,50400,44800,64000,48800,39200,35200,26400,39200,47200,55200,52000,38400,55200,43200,66400,55200,40000,36800,24800,39200,37600,56800,56800,43200,56000,41600,64800,55200,40800,31200,21600,42400,40800,53600,61600,45600,51200,38400,66400) > 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,] 43200 48000 44000 43200 51200 53600 48800 55200 55200 NA [2,] 41600 36000 36800 40000 31200 31200 39200 40000 40800 NA [3,] 44000 42400 40800 36000 31200 32800 35200 36800 31200 NA [4,] 35200 32000 29600 29600 31200 27200 26400 24800 21600 NA [5,] 45600 44800 42400 39200 36800 37600 39200 39200 42400 NA [6,] 44800 36800 32800 35200 36800 43200 47200 37600 40800 NA [7,] 48000 48800 46400 48000 49600 54400 55200 56800 53600 NA [8,] 49600 44000 44000 46400 45600 53600 52000 56800 61600 NA [9,] 55200 46400 39200 40000 40800 43200 38400 43200 45600 NA [10,] 48000 52000 56000 53600 51200 50400 55200 56000 51200 NA [11,] 45600 51200 50400 49600 47200 44800 43200 41600 38400 NA [12,] 56800 60800 57600 64000 68000 64000 66400 64800 66400 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -1600 -12000 -7200 -3200 -20000 -22400 -9600 -15200 -14400 NA [2,] 2400 6400 4000 -4000 0 1600 -4000 -3200 -9600 NA [3,] -8800 -10400 -11200 -6400 0 -5600 -8800 -12000 -9600 NA [4,] 10400 12800 12800 9600 5600 10400 12800 14400 20800 NA [5,] -800 -8000 -9600 -4000 0 5600 8000 -1600 -1600 NA [6,] 3200 12000 13600 12800 12800 11200 8000 19200 12800 NA [7,] 1600 -4800 -2400 -1600 -4000 -800 -3200 0 8000 NA [8,] 5600 2400 -4800 -6400 -4800 -10400 -13600 -13600 -16000 NA [9,] -7200 5600 16800 13600 10400 7200 16800 12800 5600 NA [10,] -2400 -800 -5600 -4000 -4000 -5600 -12000 -14400 -12800 NA [11,] 11200 9600 7200 14400 20800 19200 23200 23200 28000 NA [12,] -8800 -16800 -14400 -12800 -14400 -15200 -11200 -9600 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/1f4ow1438352697.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/2t0mf1438352697.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/31e8z1438352697.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/4s7hb1438352697.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,] 43200 31200 31200 21600 36800 32800 46400 44000 38400 48000 38400 56800 [2,] 44000 36000 32800 26400 39200 36800 48000 45600 40000 51200 43200 60800 [3,] 48800 39200 36000 29600 39200 37600 49600 49600 43200 52000 45600 64000 [4,] 53600 40000 40800 31200 42400 43200 54400 53600 45600 55200 49600 66400 [5,] 55200 41600 44000 35200 45600 47200 56800 61600 46400 56000 51200 68000 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 43744 37093.33 31786.67 27072 37514.67 34229.33 46229.33 45386.67 40250.67 [2,] 53856 41306.67 40213.33 32128 40885.33 40970.67 52970.67 53813.33 46149.33 [,10] [,11] [,12] [1,] 49893.33 42229.33 61050.67 [2,] 54106.67 48970.67 66949.33 $out [1] 55200 $group [1] 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(43200, 44000, 48800, 53600, 55200, 31200, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ldjv1438352697.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,] -22400 -9600 -12000 9600 -9600 11200 -4800 -16000 5600 -14400 7200 [2,] -15200 -4000 -10400 10400 -4000 11200 -3200 -13600 5600 -12000 11200 [3,] -12000 0 -8800 12800 -1600 12800 -1600 -6400 10400 -5600 19200 [4,] -7200 2400 -6400 12800 0 12800 0 -4800 13600 -4000 23200 [5,] -1600 6400 -5600 14400 5600 13600 1600 5600 16800 -800 28000 [,12] [1,] -16800 [2,] -14800 [3,] -13600 [4,] -10400 [5,] -8800 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -16213.333 -3370.667 -10906.667 11536 -3706.6667 11957.33 -3285.33333 [2,] -7786.667 3370.667 -6693.333 14064 506.6667 13642.67 85.33333 [,8] [,9] [,10] [,11] [,12] [1,] -11034.667 6186.667 -9813.333 12880 -16057.9 [2,] -1765.333 14613.333 -1386.667 25520 -11142.1 $out [1] 0 5600 20800 8000 3200 8000 19200 8000 -7200 $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(-22400, -15200, -12000, -7200, -1600, -9600, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6t9nx1438352697.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,] 41600 32000 29600 29600 31200 27200 26400 24800 21600 NA [2,] 43600 39600 38000 37600 34000 35200 38800 38400 39600 NA [3,] 45600 45600 43200 41600 43200 44000 45200 42400 44000 NA [4,] 48800 50000 48400 48800 50400 53600 53600 56400 54400 NA [5,] 55200 60800 57600 64000 68000 64000 66400 64800 66400 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 43228.25 40856.49 38456.49 36491.6 35719.85 35607.64 38449.62 34190.08 [2,] 47971.75 50343.51 47943.51 46708.4 50680.15 52392.36 51950.38 50609.92 [,9] [,10] [1,] 37249.62 NA [2,] 50750.38 NA $out [1] 35200 56800 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(41600, 43600, 45600, 48800, 55200, 32000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7wrri1438352697.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,] 28622.22 29600 28800 [2,] 38444.44 38400 39000 [3,] 44666.67 44400 44600 [4,] 50800.00 49600 50400 [5,] 63200.00 64000 63600 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 39031.21 39291.6 39400.38 [2,] 50302.12 49508.4 49799.62 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1f4ow1438352697.ps tmp/1f4ow1438352697.png",intern=TRUE)) character(0) > try(system("convert tmp/2t0mf1438352697.ps tmp/2t0mf1438352697.png",intern=TRUE)) character(0) > try(system("convert tmp/31e8z1438352697.ps tmp/31e8z1438352697.png",intern=TRUE)) character(0) > try(system("convert tmp/4s7hb1438352697.ps tmp/4s7hb1438352697.png",intern=TRUE)) character(0) > try(system("convert tmp/5ldjv1438352697.ps tmp/5ldjv1438352697.png",intern=TRUE)) character(0) > try(system("convert tmp/6t9nx1438352697.ps tmp/6t9nx1438352697.png",intern=TRUE)) character(0) > try(system("convert tmp/7wrri1438352697.ps tmp/7wrri1438352697.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.498 0.435 2.960