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(111.2,116.7,125.8,131.5,146.2,155.4,157.5,137.2,121.3,89.1,69.6,56.7,58.5,56.4,60.5,64.6,73.2,84.6,80.4,88.4,84.6,90.8,94.9,93.1,96.6,93.1,98.3,105,95.6,94.3,95.3,97.1,98.1,104.4,107.8,114.3,118.7,124.1,134.2,142.4,133.8,131,133.2,125.9,126.2,122.7,126.6,124.8,128,134.1,138.8,134,124,110.4,116.7,124.7,126,122.8,120.2,121.2,125.4,127.9,122,117.5,117.9,117.9,122.7,125.7,126.1,123.2,120.6,123.5) > 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,] 111.2 58.5 96.6 118.7 128.0 125.4 NA [2,] 116.7 56.4 93.1 124.1 134.1 127.9 NA [3,] 125.8 60.5 98.3 134.2 138.8 122.0 NA [4,] 131.5 64.6 105.0 142.4 134.0 117.5 NA [5,] 146.2 73.2 95.6 133.8 124.0 117.9 NA [6,] 155.4 84.6 94.3 131.0 110.4 117.9 NA [7,] 157.5 80.4 95.3 133.2 116.7 122.7 NA [8,] 137.2 88.4 97.1 125.9 124.7 125.7 NA [9,] 121.3 84.6 98.1 126.2 126.0 126.1 NA [10,] 89.1 90.8 104.4 122.7 122.8 123.2 NA [11,] 69.6 94.9 107.8 126.6 120.2 120.6 NA [12,] 56.7 93.1 114.3 124.8 121.2 123.5 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 5.5 -2.1 -3.5 5.4 6.1 2.5 NA [2,] 9.1 4.1 5.2 10.1 4.7 -5.9 NA [3,] 5.7 4.1 6.7 8.2 -4.8 -4.5 NA [4,] 14.7 8.6 -9.4 -8.6 -10.0 0.4 NA [5,] 9.2 11.4 -1.3 -2.8 -13.6 0.0 NA [6,] 2.1 -4.2 1.0 2.2 6.3 4.8 NA [7,] -20.3 8.0 1.8 -7.3 8.0 3.0 NA [8,] -15.9 -3.8 1.0 0.3 1.3 0.4 NA [9,] -32.2 6.2 6.3 -3.5 -3.2 -2.9 NA [10,] -19.5 4.1 3.4 3.9 -2.6 -2.6 NA [11,] -12.9 -1.8 6.5 -1.8 1.0 2.9 NA [12,] 1.8 3.5 4.4 3.2 4.2 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/16ik91413633245.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/2nyq71413633245.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/3ghb81413633245.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/4lqrz1413633245.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,] 58.50 56.4 60.5 64.6 73.20 84.60 80.4 88.4 84.60 89.10 69.6 [2,] 96.60 93.1 98.3 105.0 95.60 94.30 95.3 97.1 98.10 90.80 94.9 [3,] 114.95 120.4 123.9 124.5 120.95 114.15 119.7 125.2 123.65 113.55 114.0 [4,] 125.40 127.9 134.2 134.0 133.80 131.00 133.2 125.9 126.10 122.80 120.6 [5,] 128.00 134.1 138.8 142.4 146.20 155.40 157.5 137.2 126.20 123.20 126.6 [,12] [1,] 56.70 [2,] 93.10 [3,] 117.75 [4,] 123.50 [5,] 124.80 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.37307 97.95288 100.7433 105.7941 96.30977 90.47731 95.25328 [2,] 133.52693 142.84712 147.0567 143.2059 145.59023 137.82269 144.14672 [,8] [,9] [,10] [,11] [,12] [1,] 106.6231 105.5891 92.90897 97.42267 98.14102 [2,] 143.7769 141.7109 134.19103 130.57733 137.35898 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(58.5, 96.6, 114.95, 125.4, 128, 56.4, 93.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/51xul1413633245.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,] -3.50 4.10 -4.8 -10.0 -13.60 -4.20 -20.3 -3.80 -3.50 -2.6 -1.8 1.8 [2,] -2.10 4.10 -4.5 -9.4 -2.80 1.00 -7.3 -3.80 -3.50 -2.6 -1.8 3.2 [3,] 3.95 4.95 4.9 -4.1 -0.65 2.15 2.4 0.35 -3.05 0.4 -0.4 3.5 [4,] 5.50 9.10 6.7 8.6 9.20 4.80 8.0 1.00 6.20 3.9 2.9 4.2 [5,] 6.10 10.10 8.2 14.7 11.40 6.30 8.0 1.30 6.30 4.1 6.5 4.4 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.9522455 1.724839 -2.324362 -15.710581 -8.390388 -0.3011227 -7.468994 [2,] 8.8522455 8.175161 12.124362 7.510581 7.090388 4.6011227 12.268994 [,8] [,9] [,10] [,11] [,12] [1,] -2.746155 -9.306813 -3.79271 -3.431652 2.793403 [2,] 3.446155 3.206813 4.59271 2.631652 4.206597 $out [1] -5.9 -15.9 -32.2 -19.5 -12.9 $group [1] 2 8 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-3.5, -2.1, 3.95, 5.5, 6.09999999999999, 4.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6mlot1413633245.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,] 56.70 56.40 93.10 118.70 110.40 117.50 NA [2,] 100.15 62.55 95.45 124.45 120.70 119.25 NA [3,] 123.55 82.50 97.60 126.40 124.35 122.95 NA [4,] 141.70 89.60 104.70 133.50 131.00 125.55 NA [5,] 157.50 94.90 114.30 142.40 138.80 127.90 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 104.5988 70.16231 93.38101 122.2722 119.6521 120.0765 NA [2,] 142.5012 94.83769 101.81899 130.5278 129.0479 125.8235 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(56.7, 100.15, 123.55, 141.7, 157.5, 56.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7llif1413633245.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,] 105.6000 113.550 108.4875 [2,] 107.6667 114.550 111.3250 [3,] 113.4917 120.050 113.9750 [4,] 115.7167 123.775 115.9375 [5,] 117.6333 125.200 120.7500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 109.8200 115.8424 111.8712 [2,] 117.1633 124.2576 116.0788 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(105.6, 107.666666666667, 113.491666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/16ik91413633245.ps tmp/16ik91413633245.png",intern=TRUE)) character(0) > try(system("convert tmp/2nyq71413633245.ps tmp/2nyq71413633245.png",intern=TRUE)) character(0) > try(system("convert tmp/3ghb81413633245.ps tmp/3ghb81413633245.png",intern=TRUE)) character(0) > try(system("convert tmp/4lqrz1413633245.ps tmp/4lqrz1413633245.png",intern=TRUE)) character(0) > try(system("convert tmp/51xul1413633245.ps tmp/51xul1413633245.png",intern=TRUE)) character(0) > try(system("convert tmp/6mlot1413633245.ps tmp/6mlot1413633245.png",intern=TRUE)) character(0) > try(system("convert tmp/7llif1413633245.ps tmp/7llif1413633245.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.522 0.336 2.890