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(37800,36400,38500,30800,39900,39200,42000,43400,48300,42000,39900,49700,42000,31500,37100,28000,39200,32200,42700,38500,40600,45500,44800,53200,38500,32200,35700,25900,37100,28700,40600,38500,34300,49000,44100,50400,37800,35000,31500,25900,34300,30800,42000,40600,35000,46900,43400,56000,44800,27300,27300,27300,32200,32200,43400,39900,35700,44800,41300,59500,46900,27300,28700,23800,32900,37800,47600,46900,37800,44100,39200,56000,42700,34300,30800,23100,34300,41300,48300,45500,33600,48300,37800,58100,48300,35000,32200,21700,34300,32900,49700,49700,37800,49000,36400,56700,48300,35700,27300,18900,37100,35700,46900,53900,39900,44800,33600,58100) > 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,] 37800 42000 38500 37800 44800 46900 42700 48300 48300 NA [2,] 36400 31500 32200 35000 27300 27300 34300 35000 35700 NA [3,] 38500 37100 35700 31500 27300 28700 30800 32200 27300 NA [4,] 30800 28000 25900 25900 27300 23800 23100 21700 18900 NA [5,] 39900 39200 37100 34300 32200 32900 34300 34300 37100 NA [6,] 39200 32200 28700 30800 32200 37800 41300 32900 35700 NA [7,] 42000 42700 40600 42000 43400 47600 48300 49700 46900 NA [8,] 43400 38500 38500 40600 39900 46900 45500 49700 53900 NA [9,] 48300 40600 34300 35000 35700 37800 33600 37800 39900 NA [10,] 42000 45500 49000 46900 44800 44100 48300 49000 44800 NA [11,] 39900 44800 44100 43400 41300 39200 37800 36400 33600 NA [12,] 49700 53200 50400 56000 59500 56000 58100 56700 58100 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -1400 -10500 -6300 -2800 -17500 -19600 -8400 -13300 -12600 NA [2,] 2100 5600 3500 -3500 0 1400 -3500 -2800 -8400 NA [3,] -7700 -9100 -9800 -5600 0 -4900 -7700 -10500 -8400 NA [4,] 9100 11200 11200 8400 4900 9100 11200 12600 18200 NA [5,] -700 -7000 -8400 -3500 0 4900 7000 -1400 -1400 NA [6,] 2800 10500 11900 11200 11200 9800 7000 16800 11200 NA [7,] 1400 -4200 -2100 -1400 -3500 -700 -2800 0 7000 NA [8,] 4900 2100 -4200 -5600 -4200 -9100 -11900 -11900 -14000 NA [9,] -6300 4900 14700 11900 9100 6300 14700 11200 4900 NA [10,] -2100 -700 -4900 -3500 -3500 -4900 -10500 -12600 -11200 NA [11,] 9800 8400 6300 12600 18200 16800 20300 20300 24500 NA [12,] -7700 -14700 -12600 -11200 -12600 -13300 -9800 -8400 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/1z4g41439729590.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/20rsh1439729590.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/32bwm1439729590.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/4ua2y1439729590.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,] 37800 27300 27300 18900 32200 28700 40600 38500 33600 42000 33600 49700 [2,] 38500 31500 28700 23100 34300 32200 42000 39900 35000 44800 37800 53200 [3,] 42700 34300 31500 25900 34300 32900 43400 43400 37800 45500 39900 56000 [4,] 46900 35000 35700 27300 37100 37800 47600 46900 39900 48300 43400 58100 [5,] 48300 36400 38500 30800 39900 41300 49700 53900 40600 49000 44800 59500 $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,] 38276 32456.67 27813.33 23688 32825.33 29950.67 40450.67 39713.33 35219.33 [2,] 47124 36143.33 35186.67 28112 35774.67 35849.33 46349.33 47086.67 40380.67 [,10] [,11] [,12] [1,] 43656.67 36950.67 53419.33 [2,] 47343.33 42849.33 58580.67 $out [1] 48300 $group [1] 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(37800, 38500, 42700, 46900, 48300, 27300, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5jedr1439729590.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,] -19600 -8400 -10500 8400 -8400 9800 -4200 -14000 4900 -12600 6300 [2,] -13300 -3500 -9100 9100 -3500 9800 -2800 -11900 4900 -10500 9800 [3,] -10500 0 -7700 11200 -1400 11200 -1400 -5600 9100 -4900 16800 [4,] -6300 2100 -5600 11200 0 11200 0 -4200 11900 -3500 20300 [5,] -1400 5600 -4900 12600 4900 11900 1400 4900 14700 -700 24500 [,12] [1,] -14700 [2,] -12950 [3,] -11900 [4,] -9100 [5,] -7700 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -14186.667 -2949.333 -9543.333 10094 -3243.3333 10462.67 -2874.66667 [2,] -6813.333 2949.333 -5856.667 12306 443.3333 11937.33 74.66667 [,8] [,9] [,10] [,11] [,12] [1,] -9655.333 5413.333 -8586.667 11270 -14050.665 [2,] -1544.667 12786.667 -1213.333 22330 -9749.335 $out [1] 0 4900 18200 7000 2800 7000 16800 7000 -6300 $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(-19600, -13300, -10500, -6300, -1400, -8400, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6zfch1439729590.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,] 36400 28000 25900 25900 27300 23800 23100 21700 18900 NA [2,] 38150 34650 33250 32900 29750 30800 33950 33600 34650 NA [3,] 39900 39900 37800 36400 37800 38500 39550 37100 38500 NA [4,] 42700 43750 42350 42700 44100 46900 46900 49350 47600 NA [5,] 48300 53200 50400 56000 59500 56000 58100 56700 58100 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 37824.71 35749.43 33649.43 31930.15 31254.87 31156.68 33643.42 29916.32 [2,] 41975.29 44050.57 41950.57 40869.85 44345.13 45843.32 45456.58 44283.68 [,9] [,10] [1,] 32593.42 NA [2,] 44406.58 NA $out [1] 30800 49700 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(36400, 38150, 39900, 42700, 48300, 28000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7rak91439729590.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,] 25044.44 25900 25200 [2,] 33638.89 33600 34125 [3,] 39083.33 38850 39025 [4,] 44450.00 43400 44100 [5,] 55300.00 56000 55650 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 34152.31 34380.15 34475.34 [2,] 44014.35 43319.85 43574.66 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1z4g41439729590.ps tmp/1z4g41439729590.png",intern=TRUE)) character(0) > try(system("convert tmp/20rsh1439729590.ps tmp/20rsh1439729590.png",intern=TRUE)) character(0) > try(system("convert tmp/32bwm1439729590.ps tmp/32bwm1439729590.png",intern=TRUE)) character(0) > try(system("convert tmp/4ua2y1439729590.ps tmp/4ua2y1439729590.png",intern=TRUE)) character(0) > try(system("convert tmp/5jedr1439729590.ps tmp/5jedr1439729590.png",intern=TRUE)) character(0) > try(system("convert tmp/6zfch1439729590.ps tmp/6zfch1439729590.png",intern=TRUE)) character(0) > try(system("convert tmp/7rak91439729590.ps tmp/7rak91439729590.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.435 0.485 2.948