R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(99.1,98.9,98.8,98.8,99.2,99.6,100.5,100.6,100.7,101,101.3,101.5,102.3,103,102.9,103.5,103.8,103.6,103.4,103.4,103.3,103.2,103.2,103.5,104.5,105.7,106.5,107,106.7,107.1,106.1,106.2,106.5,106.8,107,107.2,107.8,107.9,107.9,108.2,108.9,109.1,109.3,109.8,109.8,109.9,109.9,109.9,108.8,108.5,108.8,108.8,108.8,108.9,108.8,108.4,107.7,107.3,107,107.7) > par1 = '48' > par1 <- '48' > #'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] 60 > (np <- floor(n / par1)) [1] 1 > 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] 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 > arr [,1] [,2] [1,] 99.1 108.8 [2,] 98.9 108.5 [3,] 98.8 108.8 [4,] 98.8 108.8 [5,] 99.2 108.8 [6,] 99.6 108.9 [7,] 100.5 108.8 [8,] 100.6 108.4 [9,] 100.7 107.7 [10,] 101.0 107.3 [11,] 101.3 107.0 [12,] 101.5 107.7 [13,] 102.3 NA [14,] 103.0 NA [15,] 102.9 NA [16,] 103.5 NA [17,] 103.8 NA [18,] 103.6 NA [19,] 103.4 NA [20,] 103.4 NA [21,] 103.3 NA [22,] 103.2 NA [23,] 103.2 NA [24,] 103.5 NA [25,] 104.5 NA [26,] 105.7 NA [27,] 106.5 NA [28,] 107.0 NA [29,] 106.7 NA [30,] 107.1 NA [31,] 106.1 NA [32,] 106.2 NA [33,] 106.5 NA [34,] 106.8 NA [35,] 107.0 NA [36,] 107.2 NA [37,] 107.8 NA [38,] 107.9 NA [39,] 107.9 NA [40,] 108.2 NA [41,] 108.9 NA [42,] 109.1 NA [43,] 109.3 NA [44,] 109.8 NA [45,] 109.8 NA [46,] 109.9 NA [47,] 109.9 NA [48,] 109.9 NA > darr [,1] [,2] [1,] -0.2 -0.3 [2,] -0.1 0.3 [3,] 0.0 0.0 [4,] 0.4 0.0 [5,] 0.4 0.1 [6,] 0.9 -0.1 [7,] 0.1 -0.4 [8,] 0.1 -0.7 [9,] 0.3 -0.4 [10,] 0.3 -0.3 [11,] 0.2 0.7 [12,] 0.8 NA [13,] 0.7 NA [14,] -0.1 NA [15,] 0.6 NA [16,] 0.3 NA [17,] -0.2 NA [18,] -0.2 NA [19,] 0.0 NA [20,] -0.1 NA [21,] -0.1 NA [22,] 0.0 NA [23,] 0.3 NA [24,] 1.0 NA [25,] 1.2 NA [26,] 0.8 NA [27,] 0.5 NA [28,] -0.3 NA [29,] 0.4 NA [30,] -1.0 NA [31,] 0.1 NA [32,] 0.3 NA [33,] 0.3 NA [34,] 0.2 NA [35,] 0.2 NA [36,] 0.6 NA [37,] 0.1 NA [38,] 0.0 NA [39,] 0.3 NA [40,] 0.7 NA [41,] 0.2 NA [42,] 0.2 NA [43,] 0.5 NA [44,] 0.0 NA [45,] 0.1 NA [46,] 0.0 NA [47,] 0.0 NA [48,] -1.1 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/1hnvx1445017071.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/2jmyw1445017071.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/3i8bl1445017071.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/4qk5g1445017071.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,] 99.10 98.9 98.8 98.8 99.2 99.60 100.50 100.6 100.7 101.00 101.30 [2,] 99.10 98.9 98.8 98.8 99.2 99.60 100.50 100.6 100.7 101.00 101.30 [3,] 103.95 103.7 103.8 103.8 104.0 104.25 104.65 104.5 104.2 104.15 104.15 [4,] 108.80 108.5 108.8 108.8 108.8 108.90 108.80 108.4 107.7 107.30 107.00 [5,] 108.80 108.5 108.8 108.8 108.8 108.90 108.80 108.4 107.7 107.30 107.00 [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [1,] 101.5 102.3 103 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 [2,] 101.5 102.3 103 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 [3,] 104.6 102.3 103 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 [4,] 107.7 102.3 103 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 [5,] 107.7 102.3 103 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 [,24] [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [1,] 103.5 104.5 105.7 106.5 107 106.7 107.1 106.1 106.2 106.5 106.8 107 [2,] 103.5 104.5 105.7 106.5 107 106.7 107.1 106.1 106.2 106.5 106.8 107 [3,] 103.5 104.5 105.7 106.5 107 106.7 107.1 106.1 106.2 106.5 106.8 107 [4,] 103.5 104.5 105.7 106.5 107 106.7 107.1 106.1 106.2 106.5 106.8 107 [5,] 103.5 104.5 105.7 106.5 107 106.7 107.1 106.1 106.2 106.5 106.8 107 [,36] [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [1,] 107.2 107.8 107.9 107.9 108.2 108.9 109.1 109.3 109.8 109.8 109.9 109.9 [2,] 107.2 107.8 107.9 107.9 108.2 108.9 109.1 109.3 109.8 109.8 109.9 109.9 [3,] 107.2 107.8 107.9 107.9 108.2 108.9 109.1 109.3 109.8 109.8 109.9 109.9 [4,] 107.2 107.8 107.9 107.9 108.2 108.9 109.1 109.3 109.8 109.8 109.9 109.9 [5,] 107.2 107.8 107.9 107.9 108.2 108.9 109.1 109.3 109.8 109.8 109.9 109.9 [,48] [1,] 109.9 [2,] 109.9 [3,] 109.9 [4,] 109.9 [5,] 109.9 $n [1] 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 93.11288 92.9746 92.62771 92.62771 93.2746 93.85977 95.377 [2,] 114.78712 114.4254 114.97229 114.97229 114.7254 114.64023 113.923 [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] 95.78562 96.3794 97.11146 97.7818 97.67318 102.3 103 102.9 103.5 [2,] 113.21438 112.0206 111.18854 110.5182 111.52682 102.3 103 102.9 103.5 [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28] [1,] 103.8 103.6 103.4 103.4 103.3 103.2 103.2 103.5 104.5 105.7 106.5 107 [2,] 103.8 103.6 103.4 103.4 103.3 103.2 103.2 103.5 104.5 105.7 106.5 107 [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [1,] 106.7 107.1 106.1 106.2 106.5 106.8 107 107.2 107.8 107.9 107.9 108.2 [2,] 106.7 107.1 106.1 106.2 106.5 106.8 107 107.2 107.8 107.9 107.9 108.2 [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [1,] 108.9 109.1 109.3 109.8 109.8 109.9 109.9 109.9 [2,] 108.9 109.1 109.3 109.8 109.8 109.9 109.9 109.9 $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" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" [31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" [46] "46" "47" "48" Warning message: In bxp(list(stats = c(99.1, 99.1, 103.95, 108.8, 108.8, 98.9, 98.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5a3r31445017071.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] [,13] [1,] -0.30 -0.1 0 0.0 0.10 -0.1 -0.40 -0.7 -0.40 -0.3 0.20 0.8 0.7 [2,] -0.30 -0.1 0 0.0 0.10 -0.1 -0.40 -0.7 -0.40 -0.3 0.20 0.8 0.7 [3,] -0.25 0.1 0 0.2 0.25 0.4 -0.15 -0.3 -0.05 0.0 0.45 0.8 0.7 [4,] -0.20 0.3 0 0.4 0.40 0.9 0.10 0.1 0.30 0.3 0.70 0.8 0.7 [5,] -0.20 0.3 0 0.4 0.40 0.9 0.10 0.1 0.30 0.3 0.70 0.8 0.7 [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [1,] -0.1 0.6 0.3 -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 [2,] -0.1 0.6 0.3 -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 [3,] -0.1 0.6 0.3 -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 [4,] -0.1 0.6 0.3 -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 [5,] -0.1 0.6 0.3 -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [1,] 0.8 0.5 -0.3 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 [2,] 0.8 0.5 -0.3 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 [3,] 0.8 0.5 -0.3 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 [4,] 0.8 0.5 -0.3 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 [5,] 0.8 0.5 -0.3 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [1,] 0 0.3 0.7 0.2 0.2 0.5 0 0.1 0 0 -1.1 [2,] 0 0.3 0.7 0.2 0.2 0.5 0 0.1 0 0 -1.1 [3,] 0 0.3 0.7 0.2 0.2 0.5 0 0.1 0 0 -1.1 [4,] 0 0.3 0.7 0.2 0.2 0.5 0 0.1 0 0 -1.1 [5,] 0 0.3 0.7 0.2 0.2 0.5 0 0.1 0 0 -1.1 $n [1] 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.3617229 -0.3468915 0 -0.2468915 -0.08516861 -0.7172287 -0.7086144 [2,] -0.1382771 0.5468915 0 0.6468915 0.58516861 1.5172287 0.4086144 [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] -1.193783 -0.8320601 -0.6703372 -0.1086144 0.8 0.7 -0.1 0.6 0.3 [2,] 0.593783 0.7320601 0.6703372 1.0086144 0.8 0.7 -0.1 0.6 0.3 [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28] [1,] -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 0.8 0.5 -0.3 [2,] -0.2 -0.2 0 -0.1 -0.1 0 0.3 1 1.2 0.8 0.5 -0.3 [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [1,] 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 0 0.3 0.7 [2,] 0.4 -1 0.1 0.3 0.3 0.2 0.2 0.6 0.1 0 0.3 0.7 [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [1,] 0.2 0.2 0.5 0 0.1 0 0 -1.1 [2,] 0.2 0.2 0.5 0 0.1 0 0 -1.1 $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" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" [31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" [46] "46" "47" "48" Warning message: In bxp(list(stats = c(-0.299999999999997, -0.299999999999997, -0.249999999999993, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/62d3m1445017071.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] [1,] 98.80 107.00 [2,] 101.90 107.70 [3,] 104.15 108.65 [4,] 107.50 108.80 [5,] 109.90 108.90 $n [1] 48 12 $conf [,1] [,2] [1,] 102.8729 108.1483 [2,] 105.4271 109.1517 $out numeric(0) $group numeric(0) $names [1] "1" NA Warning message: In bxp(list(stats = c(98.8, 101.9, 104.15, 107.5, 109.9, 107, 107.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7hzsi1445017071.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,] 102.300 102.300 102.300 [2,] 103.750 103.750 103.750 [3,] 104.625 104.625 104.625 [4,] 107.500 107.500 107.500 [5,] 109.900 109.900 109.900 $n [1] 48 48 48 $conf [,1] [,2] [,3] [1,] 103.7698 103.7698 103.7698 [2,] 105.4802 105.4802 105.4802 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1hnvx1445017071.ps tmp/1hnvx1445017071.png",intern=TRUE)) character(0) > try(system("convert tmp/2jmyw1445017071.ps tmp/2jmyw1445017071.png",intern=TRUE)) character(0) > try(system("convert tmp/3i8bl1445017071.ps tmp/3i8bl1445017071.png",intern=TRUE)) character(0) > try(system("convert tmp/4qk5g1445017071.ps tmp/4qk5g1445017071.png",intern=TRUE)) character(0) > try(system("convert tmp/5a3r31445017071.ps tmp/5a3r31445017071.png",intern=TRUE)) character(0) > try(system("convert tmp/62d3m1445017071.ps tmp/62d3m1445017071.png",intern=TRUE)) character(0) > try(system("convert tmp/7hzsi1445017071.ps tmp/7hzsi1445017071.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.566 0.459 3.043