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(37.3,39.5,40.6,41.4,41.3,43.5,44,44.9,46.4,47.4,48.7,49.7,51.1,53.2,56.2,58.1,60.6,64.1,67.4,68,70.9,72.8,74.9,76.1,77,78.1,80,79.7,82.7,84.3,83.5,85.9,87,88.6,90.6,91.3,91.6,93.2,95,95.2,97.4,98.6,99.6,100.6,101.3,102.8,103.2,103,105.4,104.7,105.2,105.2,102.8,100.3,99.8,99.4,100.6,100.2,100.4,98.8,96.9,96.3,96.1,93.5,92.1,91.7,87.9,86.4,84.9,81.7,82.6,83.1) > par1 = '4' > par1 <- '4' > #'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] 18 > 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] 18 18 18 18 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 37.3 41.3 46.4 51.1 60.6 70.9 77.0 82.7 87.0 91.6 97.4 101.3 105.4 102.8 [2,] 39.5 43.5 47.4 53.2 64.1 72.8 78.1 84.3 88.6 93.2 98.6 102.8 104.7 100.3 [3,] 40.6 44.0 48.7 56.2 67.4 74.9 80.0 83.5 90.6 95.0 99.6 103.2 105.2 99.8 [4,] 41.4 44.9 49.7 58.1 68.0 76.1 79.7 85.9 91.3 95.2 100.6 103.0 105.2 99.4 [,15] [,16] [,17] [,18] [,19] [1,] 100.6 96.9 92.1 84.9 NA [2,] 100.2 96.3 91.7 81.7 NA [3,] 100.4 96.1 87.9 82.6 NA [4,] 98.8 93.5 86.4 83.1 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 2.2 2.2 1.0 2.1 3.5 1.9 1.1 1.6 1.6 1.6 1.2 1.5 -0.7 -2.5 [2,] 1.1 0.5 1.3 3.0 3.3 2.1 1.9 -0.8 2.0 1.8 1.0 0.4 0.5 -0.5 [3,] 0.8 0.9 1.0 1.9 0.6 1.2 -0.3 2.4 0.7 0.2 1.0 -0.2 0.0 -0.4 [4,] -0.1 1.5 1.4 2.5 2.9 0.9 3.0 1.1 0.3 2.2 0.7 2.4 -2.4 1.2 [,15] [,16] [,17] [,18] [,19] [1,] -0.4 -0.6 -0.4 -3.2 NA [2,] 0.2 -0.2 -3.8 0.9 NA [3,] -1.6 -2.6 -1.5 0.5 NA [4,] -1.9 -1.4 -1.5 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/1brbk1413025934.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/2ql2q1413025934.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/32x3j1413025934.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/4u0n41413025935.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] [1,] 37.30 39.50 40.6 41.40 [2,] 60.60 64.10 67.4 68.00 [3,] 85.95 86.45 85.7 86.15 [4,] 97.40 98.60 99.6 98.80 [5,] 105.40 104.70 105.2 105.20 $n [1] 18 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] 72.24533 73.60187 73.70841 74.67979 [2,] 99.65467 99.29813 97.69159 97.62021 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(37.3, 60.6, 85.95, 97.4, 105.4, 39.5, 64.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5d3ok1413025935.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] [1,] -3.20 -0.80 -1.60 -2.4 [2,] -0.40 0.20 -0.30 -0.1 [3,] 1.35 0.95 0.55 1.1 [4,] 1.90 1.90 1.00 2.2 [5,] 3.50 3.30 2.40 3.0 $n [1] 18 18 18 17 $conf [,1] [,2] [,3] [,4] [1,] 0.493458 0.3169037 0.06586756 0.2186255 [2,] 2.206542 1.5830963 1.03413244 1.9813745 $out [1] -3.8 -2.6 $group [1] 2 3 $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(-3.2, -0.399999999999991, 1.34999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6eqoy1413025935.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] [,11] [,12] [1,] 37.30 41.30 46.40 51.10 60.60 70.90 77.00 82.7 87.00 91.6 97.4 101.30 [2,] 38.40 42.40 46.90 52.15 62.35 71.85 77.55 83.1 87.80 92.4 98.0 102.05 [3,] 40.05 43.75 48.05 54.70 65.75 73.85 78.90 83.9 89.60 94.1 99.1 102.90 [4,] 41.00 44.45 49.20 57.15 67.70 75.50 79.85 85.1 90.95 95.1 100.1 103.10 [5,] 41.40 44.90 49.70 58.10 68.00 76.10 80.00 85.9 91.30 95.2 100.6 103.20 [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 104.70 99.40 98.8 93.5 86.40 81.70 NA [2,] 104.95 99.60 99.5 94.8 87.15 82.15 NA [3,] 105.20 100.05 100.3 96.2 89.80 82.85 NA [4,] 105.30 101.55 100.5 96.6 91.90 84.00 NA [5,] 105.40 102.80 100.6 96.9 92.10 84.90 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 37.996 42.1305 46.233 50.75 61.5235 70.9665 77.083 82.32 87.1115 91.967 [2,] 42.104 45.3695 49.867 58.65 69.9765 76.7335 80.717 85.48 92.0885 96.233 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 97.441 102.0705 104.9235 98.5095 99.51 94.778 86.0475 81.3885 NA [2,] 100.759 103.7295 105.4765 101.5905 101.09 97.622 93.5525 84.3115 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" NA Warning message: In bxp(list(stats = c(37.3, 38.4, 40.05, 41, 41.4, 41.3, 42.4, 43.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7c2761413025935.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,] 79.29444 85.700 80.22500 [2,] 79.67500 85.825 81.18750 [3,] 80.46389 86.050 83.05625 [4,] 81.00000 86.300 83.98125 [5,] 81.12778 86.450 84.00000 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 79.41714 85.67475 80.84919 [2,] 81.51064 86.42525 85.26331 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(79.2944444444445, 79.675, 80.4638888888889, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1brbk1413025934.ps tmp/1brbk1413025934.png",intern=TRUE)) character(0) > try(system("convert tmp/2ql2q1413025934.ps tmp/2ql2q1413025934.png",intern=TRUE)) character(0) > try(system("convert tmp/32x3j1413025934.ps tmp/32x3j1413025934.png",intern=TRUE)) character(0) > try(system("convert tmp/4u0n41413025935.ps tmp/4u0n41413025935.png",intern=TRUE)) character(0) > try(system("convert tmp/5d3ok1413025935.ps tmp/5d3ok1413025935.png",intern=TRUE)) character(0) > try(system("convert tmp/6eqoy1413025935.ps tmp/6eqoy1413025935.png",intern=TRUE)) character(0) > try(system("convert tmp/7c2761413025935.ps tmp/7c2761413025935.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.395 0.325 2.752