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(6678,6554,6513,6210,5928,6268,5582,5869,5764,6082,6062,6810,6727,6537,6175,6014,6109) > 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] 17 > (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 1 1 1 1 1 1 1 > arr [,1] [,2] [1,] 6678 6727 [2,] 6554 6537 [3,] 6513 6175 [4,] 6210 6014 [5,] 5928 6109 [6,] 6268 NA [7,] 5582 NA [8,] 5869 NA [9,] 5764 NA [10,] 6082 NA [11,] 6062 NA [12,] 6810 NA > darr [,1] [,2] [1,] -124 -190 [2,] -41 -362 [3,] -303 -161 [4,] -282 95 [5,] 340 NA [6,] -686 NA [7,] 287 NA [8,] -105 NA [9,] 318 NA [10,] -20 NA [11,] 748 NA [12,] -83 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/1aoru1457866884.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/25qt81457866884.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/3g2ow1457866884.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/468wl1457866884.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,] 6678.0 6537.0 6175 6014 5928.0 6268 5582 5869 5764 6082 6062 6810 [2,] 6678.0 6537.0 6175 6014 5928.0 6268 5582 5869 5764 6082 6062 6810 [3,] 6702.5 6545.5 6344 6112 6018.5 6268 5582 5869 5764 6082 6062 6810 [4,] 6727.0 6554.0 6513 6210 6109.0 6268 5582 5869 5764 6082 6062 6810 [5,] 6727.0 6554.0 6513 6210 6109.0 6268 5582 5869 5764 6082 6062 6810 $n [1] 2 2 2 2 2 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 6647.756 6526.507 5966.377 5893.023 5816.282 6268 5582 5869 5764 6082 [2,] 6757.244 6564.493 6721.623 6330.977 6220.718 6268 5582 5869 5764 6082 [,11] [,12] [1,] 6062 6810 [2,] 6062 6810 $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(6678, 6678, 6702.5, 6727, 6727, 6537, 6537, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ypjs1457866884.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,] -190 -362.0 -303 -282.0 340 -686 287 -105 318 -20 748 -83 [2,] -190 -362.0 -303 -282.0 340 -686 287 -105 318 -20 748 -83 [3,] -157 -201.5 -232 -93.5 340 -686 287 -105 318 -20 748 -83 [4,] -124 -41.0 -161 95.0 340 -686 287 -105 318 -20 748 -83 [5,] -124 -41.0 -161 95.0 340 -686 287 -105 318 -20 748 -83 $n [1] 2 2 2 2 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -230.7371 -560.1304 -390.64648 -514.6952 340 -686 287 -105 318 -20 [2,] -83.2629 157.1304 -73.35352 327.6952 340 -686 287 -105 318 -20 [,11] [,12] [1,] 748 -83 [2,] 748 -83 $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(-190, -190, -157, -124, -124, -362, -362, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jmyw1457866884.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,] 5582.0 6014 [2,] 5898.5 6109 [3,] 6146.0 6175 [4,] 6533.5 6537 [5,] 6810.0 6727 $n [1] 12 5 $conf [,1] [,2] [1,] 5856.372 5872.576 [2,] 6435.628 6477.424 $out numeric(0) $group numeric(0) $names [1] "1" NA Warning message: In bxp(list(stats = c(5582, 5898.5, 6146, 6533.5, 6810, 6014, 6109, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/710ka1457866884.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,] 5582.00 5582.00 5582.00 [2,] 5943.75 5943.75 5943.75 [3,] 6097.00 6097.00 6097.00 [4,] 6444.75 6444.75 6444.75 [5,] 6810.00 6810.00 6810.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 5868.491 5868.491 5868.491 [2,] 6325.509 6325.509 6325.509 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(5582, 5943.75, 6097, 6444.75, 6810, 5582, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1aoru1457866884.ps tmp/1aoru1457866884.png",intern=TRUE)) character(0) > try(system("convert tmp/25qt81457866884.ps tmp/25qt81457866884.png",intern=TRUE)) character(0) > try(system("convert tmp/3g2ow1457866884.ps tmp/3g2ow1457866884.png",intern=TRUE)) character(0) > try(system("convert tmp/468wl1457866884.ps tmp/468wl1457866884.png",intern=TRUE)) character(0) > try(system("convert tmp/5ypjs1457866884.ps tmp/5ypjs1457866884.png",intern=TRUE)) character(0) > try(system("convert tmp/6jmyw1457866884.ps tmp/6jmyw1457866884.png",intern=TRUE)) character(0) > try(system("convert tmp/710ka1457866884.ps tmp/710ka1457866884.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.542 0.428 2.991