R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" 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 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Mon, 30 Nov 2015 07:01:18 +0000) > #Author: root > #To cite this work: Wessa P., (2015), Mean Plot (v1.0.5) 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) > x <- na.omit(x) > (n <- length(x)) [1] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.1 102.3 104.5 107.8 108.8 NA [2,] 98.9 103.0 105.7 107.9 108.5 NA [3,] 98.8 102.9 106.5 107.9 108.8 NA [4,] 98.8 103.5 107.0 108.2 108.8 NA [5,] 99.2 103.8 106.7 108.9 108.8 NA [6,] 99.6 103.6 107.1 109.1 108.9 NA [7,] 100.5 103.4 106.1 109.3 108.8 NA [8,] 100.6 103.4 106.2 109.8 108.4 NA [9,] 100.7 103.3 106.5 109.8 107.7 NA [10,] 101.0 103.2 106.8 109.9 107.3 NA [11,] 101.3 103.2 107.0 109.9 107.0 NA [12,] 101.5 103.5 107.2 109.9 107.7 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.2 0.7 1.2 0.1 -0.3 NA [2,] -0.1 -0.1 0.8 0.0 0.3 NA [3,] 0.0 0.6 0.5 0.3 0.0 NA [4,] 0.4 0.3 -0.3 0.7 0.0 NA [5,] 0.4 -0.2 0.4 0.2 0.1 NA [6,] 0.9 -0.2 -1.0 0.2 -0.1 NA [7,] 0.1 0.0 0.1 0.5 -0.4 NA [8,] 0.1 -0.1 0.3 0.0 -0.7 NA [9,] 0.3 -0.1 0.3 0.1 -0.4 NA [10,] 0.3 0.0 0.2 0.0 -0.3 NA [11,] 0.2 0.3 0.2 0.0 0.7 NA [12,] 0.8 1.0 0.6 -1.1 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/1ueuz1452198033.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/2hab51452198033.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/3ytxw1452198033.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/4gjmw1452198033.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,] 99.1 98.9 98.8 98.8 99.2 99.6 100.5 100.6 100.7 101.0 101.3 101.5 [2,] 102.3 103.0 102.9 103.5 103.8 103.6 103.4 103.4 103.3 103.2 103.2 103.5 [3,] 104.5 105.7 106.5 107.0 106.7 107.1 106.1 106.2 106.5 106.8 107.0 107.2 [4,] 107.8 107.9 107.9 108.2 108.8 108.9 108.8 108.4 107.7 107.3 107.0 107.7 [5,] 108.8 108.5 108.8 108.8 108.9 109.1 109.3 109.8 109.8 109.9 109.9 109.9 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 100.6137 102.2377 102.967 103.679 103.167 103.355 102.2844 102.667 103.391 [2,] 108.3863 109.1623 110.033 110.321 110.233 110.845 109.9156 109.733 109.609 [,10] [,11] [,12] [1,] 103.903 104.3149 104.2323 [2,] 109.697 109.6851 110.1677 $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(99.1, 102.3, 104.5, 107.8, 108.8, 98.9, 103, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5hmtw1452198033.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,] -0.3 -0.1 0.0 -0.3 -0.2 -0.2 0.0 -0.1 -0.4 -0.3 0.2 -1.10 [2,] -0.2 -0.1 0.0 0.0 0.1 -0.2 0.0 -0.1 -0.1 0.0 0.2 -0.25 [3,] 0.1 0.0 0.3 0.3 0.2 -0.1 0.1 0.0 0.1 0.0 0.2 0.70 [4,] 0.7 0.3 0.5 0.4 0.4 0.2 0.1 0.1 0.3 0.2 0.3 0.90 [5,] 1.2 0.8 0.6 0.7 0.4 0.2 0.1 0.3 0.3 0.3 0.3 1.00 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.5359377 -0.282639 -0.05329874 0.01736101 -0.01197924 -0.382639 [2,] 0.7359377 0.282639 0.65329874 0.58263899 0.41197924 0.182639 [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.02934025 -0.1413195 -0.182639 -0.1413195 0.1293403 -0.2085 [2,] 0.17065975 0.1413195 0.382639 0.1413195 0.2706597 1.6085 $out [1] 0.9 -1.0 0.5 -0.4 -0.7 0.0 0.7 $group [1] 6 6 7 7 8 11 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.299999999999997, -0.199999999999989, 0.100000000000009, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6252l1452198034.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] [1,] 98.80 102.90 105.70 107.80 107.00 NA [2,] 99.00 103.10 106.15 108.05 107.70 NA [3,] 100.05 103.35 106.60 109.20 108.65 NA [4,] 100.85 103.50 107.00 109.85 108.80 NA [5,] 101.50 103.80 107.20 109.90 108.90 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.2062 103.1676 106.2123 108.379 108.1483 NA [2,] 100.8938 103.5324 106.9877 110.021 109.1517 NA $out [1] 102.3 104.5 $group [1] 2 3 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(98.8, 99, 100.05, 100.85, 101.5, 102.9, 103.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7gjld1452198034.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,] 104.50 105.70 105.050 [2,] 105.12 106.15 105.325 [3,] 105.61 106.60 105.550 [4,] 105.67 107.00 106.000 [5,] 105.96 107.20 106.300 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 105.3591 106.2123 105.2421 [2,] 105.8609 106.9877 105.8579 $out [1] 104.5 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(104.5, 105.12, 105.61, 105.67, 105.96, 105.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ueuz1452198033.ps tmp/1ueuz1452198033.png",intern=TRUE)) character(0) > try(system("convert tmp/2hab51452198033.ps tmp/2hab51452198033.png",intern=TRUE)) character(0) > try(system("convert tmp/3ytxw1452198033.ps tmp/3ytxw1452198033.png",intern=TRUE)) character(0) > try(system("convert tmp/4gjmw1452198033.ps tmp/4gjmw1452198033.png",intern=TRUE)) character(0) > try(system("convert tmp/5hmtw1452198033.ps tmp/5hmtw1452198033.png",intern=TRUE)) character(0) > try(system("convert tmp/6252l1452198034.ps tmp/6252l1452198034.png",intern=TRUE)) character(0) > try(system("convert tmp/7gjld1452198034.ps tmp/7gjld1452198034.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.655 0.502 3.182