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,99,99,100,101,101,100,101,100,101,100,100,102,102,102,102,102,102,103,103,103,103,103,103,104,104,104,106,106,106,106,107,106,106,106,106,106,106,106,105,105,105,105,105,104,104,104,104,103,104,104,103,103,103,103,103,103,104,104,104,104,104,105,105,104,104,104,104,103) > 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] 69 > (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] 6 6 6 6 6 6 6 6 6 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99 102 104 106 103 104 [2,] 99 102 104 106 104 104 [3,] 99 102 104 106 104 105 [4,] 100 102 106 105 103 105 [5,] 101 102 106 105 103 104 [6,] 101 102 106 105 103 104 [7,] 100 103 106 105 103 104 [8,] 101 103 107 105 103 104 [9,] 100 103 106 104 103 103 [10,] 101 103 106 104 104 NA [11,] 100 103 106 104 104 NA [12,] 100 103 106 104 104 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0 0 0 0 1 0 [2,] 0 0 0 0 0 1 [3,] 1 0 2 -1 -1 0 [4,] 1 0 0 0 0 -1 [5,] 0 0 0 0 0 0 [6,] -1 1 0 0 0 0 [7,] 1 0 1 0 0 0 [8,] -1 0 -1 -1 0 -1 [9,] 1 0 0 0 1 NA [10,] -1 0 0 0 0 NA [11,] 0 0 0 0 0 NA [12,] 2 1 0 -1 0 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/1kgcc1457375923.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/20cci1457375923.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/35qwx1457375923.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/4bzc61457375923.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.0 99 99 100 101.0 101.0 100.0 101.0 103 103 103 103 [2,] 102.0 102 102 102 102.0 102.0 103.0 103.0 103 103 103 103 [3,] 103.5 104 104 104 103.5 103.5 103.5 103.5 103 104 104 104 [4,] 104.0 104 105 105 105.0 105.0 105.0 105.0 104 104 104 104 [5,] 106.0 106 106 106 106.0 106.0 106.0 107.0 104 104 104 104 $n [1] 6 6 6 6 6 6 6 6 6 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 102.2099 102.7099 102.0649 102.0649 101.5649 101.5649 102.2099 102.2099 [2,] 104.7901 105.2901 105.9351 105.9351 105.4351 105.4351 104.7901 104.7901 [,9] [,10] [,11] [,12] [1,] 102.355 103.2934 103.2934 103.2934 [2,] 103.645 104.7066 104.7066 104.7066 $out [1] 100 106 101 106 100 106 100 106 $group [1] 9 9 10 10 11 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(99, 102, 103.5, 104, 106, 99, 102, 104, 104, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5d40n1457375923.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 0 -1 0 0 0 0 -1 0 0 0 -1 [2,] 0 0 -1 0 0 0 0 -1 0 0 0 0 [3,] 0 0 0 0 0 0 0 -1 0 0 0 0 [4,] 0 0 1 0 0 0 1 0 1 0 0 1 [5,] 0 0 2 0 0 0 1 0 1 0 0 2 $n [1] 6 6 6 6 6 6 6 6 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 0 -1.290065 0 0 0 -0.6450323 -1.6450323 -0.7065975 0 [2,] 0 0 1.290065 0 0 0 0.6450323 -0.3549677 0.7065975 0 [,11] [,12] [1,] 0 -0.7065975 [2,] 0 0.7065975 $out [1] 1 1 1 -1 -1 1 -1 $group [1] 1 2 4 4 6 6 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/690f51457375923.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,] 99.0 102.0 104 104.0 103 104 [2,] 99.5 102.0 105 104.0 103 104 [3,] 100.0 102.5 106 105.0 103 104 [4,] 101.0 103.0 106 105.5 104 104 [5,] 101.0 103.0 107 106.0 104 104 $n [1] 12 12 12 12 12 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.31584 102.0439 105.5439 104.3158 102.5439 104 [2,] 100.68416 102.9561 106.4561 105.6842 103.4561 104 $out [1] 105 105 103 $group [1] 6 6 6 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(99, 99.5, 100, 101, 101, 102, 102, 102.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7ih171457375923.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,] 103.0000 103.00 103.2500 [2,] 103.2500 103.50 103.4375 [3,] 103.4500 103.75 103.5000 [4,] 103.5000 104.00 103.6250 [5,] 103.8333 104.00 103.8750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 103.336 103.5219 103.4145 [2,] 103.564 103.9781 103.5855 $out [1] 103.125 $group [1] 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(103, 103.25, 103.45, 103.5, 103.833333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kgcc1457375923.ps tmp/1kgcc1457375923.png",intern=TRUE)) character(0) > try(system("convert tmp/20cci1457375923.ps tmp/20cci1457375923.png",intern=TRUE)) character(0) > try(system("convert tmp/35qwx1457375923.ps tmp/35qwx1457375923.png",intern=TRUE)) character(0) > try(system("convert tmp/4bzc61457375923.ps tmp/4bzc61457375923.png",intern=TRUE)) character(0) > try(system("convert tmp/5d40n1457375923.ps tmp/5d40n1457375923.png",intern=TRUE)) character(0) > try(system("convert tmp/690f51457375923.ps tmp/690f51457375923.png",intern=TRUE)) character(0) > try(system("convert tmp/7ih171457375923.ps tmp/7ih171457375923.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.582 0.429 3.032