R version 3.3.0 (2016-05-03) -- "Supposedly Educational" 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(4,7,9,6,9,13,18,8,15,4,8,14,8,3,5,6,12,7,3,11,6,9,6,10,10,6,13,10,9,15,8,12,13,9,6,7,8,7,6,8,3,7,8,8,7,12,7,5,9,9,8,11,9,8,9,11,8,9,9,5) > 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,] 4 8 10 8 9 NA [2,] 7 3 6 7 9 NA [3,] 9 5 13 6 8 NA [4,] 6 6 10 8 11 NA [5,] 9 12 9 3 9 NA [6,] 13 7 15 7 8 NA [7,] 18 3 8 8 9 NA [8,] 8 11 12 8 11 NA [9,] 15 6 13 7 8 NA [10,] 4 9 9 12 9 NA [11,] 8 6 6 7 9 NA [12,] 14 10 7 5 5 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 3 -5 -4 -1 0 NA [2,] 2 2 7 -1 -1 NA [3,] -3 1 -3 2 3 NA [4,] 3 6 -1 -5 -2 NA [5,] 4 -5 6 4 -1 NA [6,] 5 -4 -7 1 1 NA [7,] -10 8 4 0 2 NA [8,] 7 -5 1 -1 -3 NA [9,] -11 3 -4 5 1 NA [10,] 4 -3 -3 -5 0 NA [11,] 6 4 1 -2 -4 NA [12,] -6 0 1 4 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/15adr1464530684.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/2v3jb1464530684.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/3ci4r1464530684.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/43jyx1464530684.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,] 8 6 5 6 9 7 8 8 6 9 6 5 [2,] 8 6 6 6 9 7 8 8 7 9 6 5 [3,] 8 7 8 8 9 8 8 11 8 9 7 7 [4,] 9 7 9 10 9 13 9 11 13 9 8 10 [5,] 10 7 13 11 9 15 9 12 15 9 9 14 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.293403 6.293403 5.880208 5.17361 9 3.760415 7.293403 8.880208 [2,] 8.706597 7.706597 10.119792 10.82639 9 12.239585 8.706597 13.119792 [,9] [,10] [,11] [,12] [1,] 3.760415 9 5.586805 3.467013 [2,] 12.239585 9 8.413195 10.532987 $out [1] 4 3 9 12 3 18 3 4 12 $group [1] 1 2 2 5 5 7 7 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(8, 8, 8, 9, 10, 6, 6, 7, 7, 7, 5, 6, 8, 9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/57rku1464530684.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,] -5 -1 -3 -5 -5 -7 0 -5 -11 -5 -4 -6.0 [2,] -4 -1 -3 -2 -1 -4 0 -3 -4 -3 -2 -3.0 [3,] -1 2 1 -1 4 1 2 -1 1 -3 1 0.5 [4,] 0 2 2 3 4 1 4 1 3 0 4 2.5 [5,] 3 2 3 6 6 5 8 7 5 4 6 4.0 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -3.82639 -0.1197924 -2.532987 -4.532987 0.4670126 -2.532987 -0.8263899 [2,] 1.82639 4.1197924 4.532987 2.532987 7.5329874 4.532987 4.8263899 [,8] [,9] [,10] [,11] [,12] [1,] -3.82639 -3.946182 -5.1197924 -3.239585 -3.845 [2,] 1.82639 5.946182 -0.8802076 5.239585 4.845 $out [1] 7 -10 $group [1] 2 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-5, -4, -1, 0, 3, -1, -1, 2, 2, 2, -3, -3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/60e4w1464530684.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,] 4.0 3.0 6.0 5.0 8 NA [2,] 6.5 5.5 7.5 6.5 8 NA [3,] 8.5 6.5 9.5 7.0 9 NA [4,] 13.5 9.5 12.5 8.0 9 NA [5,] 18.0 12.0 15.0 8.0 9 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5.307253 4.675573 7.219466 6.31584 8.543893 NA [2,] 11.692747 8.324427 11.780534 7.68416 9.456107 NA $out [1] 3 12 11 11 5 $group [1] 4 4 5 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(4, 6.5, 8.5, 13.5, 18, 3, 5.5, 6.5, 9.5, 12, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7yf231464530684.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,] 6.4 7.0 6.50 [2,] 8.0 7.5 7.50 [3,] 8.3 8.0 8.50 [4,] 9.5 8.5 9.25 [5,] 10.0 9.0 10.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.61584 7.543893 7.701813 [2,] 8.98416 8.456107 9.298187 $out [1] 11 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(6.4, 8, 8.3, 9.5, 10, 7, 7.5, 8, 8.5, 9, 6.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15adr1464530684.ps tmp/15adr1464530684.png",intern=TRUE)) character(0) > try(system("convert tmp/2v3jb1464530684.ps tmp/2v3jb1464530684.png",intern=TRUE)) character(0) > try(system("convert tmp/3ci4r1464530684.ps tmp/3ci4r1464530684.png",intern=TRUE)) character(0) > try(system("convert tmp/43jyx1464530684.ps tmp/43jyx1464530684.png",intern=TRUE)) character(0) > try(system("convert tmp/57rku1464530684.ps tmp/57rku1464530684.png",intern=TRUE)) character(0) > try(system("convert tmp/60e4w1464530684.ps tmp/60e4w1464530684.png",intern=TRUE)) character(0) > try(system("convert tmp/7yf231464530684.ps tmp/7yf231464530684.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.452 0.352 2.836