R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 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(11,13,15,29,31,22,36,39,30,20,18,13,11,16,20,29,31,24,40,41,25,19,19,18,10,17,25,30,32,24,38,36,26,25,26,16,12,15,21,33,32,24,41,38,28,24,30,18) > par1 = '4' > par1 <- '4' > #'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] 48 > (np <- floor(n / par1)) [1] 12 > 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] 12 12 12 12 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 11 31 30 11 31 25 10 32 26 12 32 28 NA [2,] 13 22 20 16 24 19 17 24 25 15 24 24 NA [3,] 15 36 18 20 40 19 25 38 26 21 41 30 NA [4,] 29 39 13 29 41 18 30 36 16 33 38 18 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 2 -9 -10 5 -7 -6 7 -8 -1 3 -8 -4 NA [2,] 2 14 -2 4 16 0 8 14 1 6 17 6 NA [3,] 14 3 -5 9 1 -1 5 -2 -10 12 -3 -12 NA [4,] 2 -9 -2 2 -16 -8 2 -10 -4 -1 -10 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/171st1476869431.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/25b5n1476869431.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/3ltey1476869431.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/4mcxt1476869431.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,] 10.0 13.0 15.0 13.0 [2,] 11.5 16.5 19.5 18.0 [3,] 27.0 21.0 25.5 29.5 [4,] 31.0 24.0 37.0 37.0 [5,] 32.0 25.0 41.0 41.0 $n [1] 12 12 12 12 $conf [,1] [,2] [,3] [,4] [1,] 18.10592 17.5792 17.51813 20.83397 [2,] 35.89408 24.4208 33.48187 38.16603 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(10, 11.5, 27, 31, 32, 13, 16.5, 21, 24, 25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/51eat1476869431.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,] -10.0 -2.0 -12 -16.0 [2,] -8.0 1.5 -4 -9.5 [3,] -5.0 6.0 0 -4.0 [4,] 2.5 14.0 7 0.5 [5,] 7.0 17.0 14 2.0 $n [1] 12 12 12 11 $conf [,1] [,2] [,3] [,4] [1,] -9.7891205 0.2986661 -5.017174 -8.7638792 [2,] -0.2108795 11.7013339 5.017174 0.7638792 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(-10, -8, -5, 2.5, 7, -2, 1.5, 6, 14, 17, -12, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/60v791476869431.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] [,13] [1,] 11 22.0 13.0 11.0 24.0 18.0 10.0 24 16.0 12.0 24.0 18 NA [2,] 12 26.5 15.5 13.5 27.5 18.5 13.5 28 20.5 13.5 28.0 21 NA [3,] 14 33.5 19.0 18.0 35.5 19.0 21.0 34 25.5 18.0 35.0 26 NA [4,] 22 37.5 25.0 24.5 40.5 22.0 27.5 37 26.0 27.0 39.5 29 NA [5,] 29 39.0 30.0 29.0 41.0 25.0 30.0 38 26.0 33.0 41.0 30 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 6.1 24.81 11.495 9.31 25.23 16.235 9.94 26.89 21.155 7.335 25.915 [2,] 21.9 42.19 26.505 26.69 45.77 21.765 32.06 41.11 29.845 28.665 44.085 [,12] [,13] [1,] 19.68 NA [2,] 32.32 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" NA Warning message: In bxp(list(stats = c(11, 12, 14, 22, 29, 22, 26.5, 33.5, 37.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/780q71476869431.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,] 20.25000 21.00 20.3750 [2,] 21.75000 23.25 20.8750 [3,] 25.33333 26.25 24.3125 [4,] 27.87500 28.25 27.6875 [5,] 28.33333 29.50 28.1250 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 20.49458 22.3 18.93062 [2,] 30.17208 30.2 29.69438 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(20.25, 21.75, 25.3333333333333, 27.875, 28.3333333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/171st1476869431.ps tmp/171st1476869431.png",intern=TRUE)) character(0) > try(system("convert tmp/25b5n1476869431.ps tmp/25b5n1476869431.png",intern=TRUE)) character(0) > try(system("convert tmp/3ltey1476869431.ps tmp/3ltey1476869431.png",intern=TRUE)) character(0) > try(system("convert tmp/4mcxt1476869431.ps tmp/4mcxt1476869431.png",intern=TRUE)) character(0) > try(system("convert tmp/51eat1476869431.ps tmp/51eat1476869431.png",intern=TRUE)) character(0) > try(system("convert tmp/60v791476869431.ps tmp/60v791476869431.png",intern=TRUE)) character(0) > try(system("convert tmp/780q71476869431.ps tmp/780q71476869431.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.459 0.202 2.694