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(-15,-15,-13,-8,-13,-9,-7,-4,-4,-2,0,-2,-3,1,-2,-1,1,-3,-4,-9,-9,-7,-14,-12,-16,-20,-12,-12,-10,-10,-13,-16,-14,-17,-24,-25,-23,-17,-24,-20,-19,-18,-16,-12,-7,-6,-6,-5,-4,-4,-8,-9,-6,-7,-10,-11,-11,-12,-14,-12,-9,-5,-6,-6,-3,-2,-6,-6,-10,-8,-4,-3) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -15 -3 -16 -23 -4 -9 NA [2,] -15 1 -20 -17 -4 -5 NA [3,] -13 -2 -12 -24 -8 -6 NA [4,] -8 -1 -12 -20 -9 -6 NA [5,] -13 1 -10 -19 -6 -3 NA [6,] -9 -3 -10 -18 -7 -2 NA [7,] -7 -4 -13 -16 -10 -6 NA [8,] -4 -9 -16 -12 -11 -6 NA [9,] -4 -9 -14 -7 -11 -10 NA [10,] -2 -7 -17 -6 -12 -8 NA [11,] 0 -14 -24 -6 -14 -4 NA [12,] -2 -12 -25 -5 -12 -3 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0 4 -4 6 0 4 NA [2,] 2 -3 8 -7 -4 -1 NA [3,] 5 1 0 4 -1 0 NA [4,] -5 2 2 1 3 3 NA [5,] 4 -4 0 1 -1 1 NA [6,] 2 -1 -3 2 -3 -4 NA [7,] 3 -5 -3 4 -1 0 NA [8,] 0 0 2 5 0 -4 NA [9,] 2 2 -3 1 -1 2 NA [10,] 2 -7 -7 0 -2 4 NA [11,] -2 2 -1 1 2 1 NA [12,] -1 -4 2 1 3 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/1r0d71457174905.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/2c28p1457174905.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/3n7981457174905.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/4qb921457174905.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,] -23 -20 -13 -20.0 -19 -18 -16.0 -16 -14.0 -17.0 -24 -25.0 [2,] -16 -17 -13 -12.0 -13 -10 -13.0 -12 -11.0 -12.0 -14 -12.0 [3,] -12 -10 -10 -8.5 -8 -8 -8.5 -10 -9.5 -7.5 -10 -8.5 [4,] -4 -4 -6 -6.0 -3 -3 -6.0 -6 -7.0 -6.0 -4 -3.0 [5,] -3 1 -2 -1.0 1 -2 -4.0 -4 -4.0 -2.0 0 -2.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -19.740388 -18.38542 -14.515226 -12.370194 -14.450323 -12.515226 [2,] -4.259612 -1.61458 -5.484774 -4.629806 -1.549677 -3.484774 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -13.015226 -13.870194 -12.080129 -11.370194 -16.450323 -14.305291 [2,] -3.984774 -6.129806 -6.919871 -3.629806 -3.549677 -2.694709 $out [1] -24 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-23, -16, -12, -4, -3, -20, -17, -10, -4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5924q1457174905.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,] -4 -7 -1.0 1 -4.0 -4 -5.0 0 -3.0 -7 -2 -4 [2,] 0 -4 0.0 1 -1.0 -3 -3.0 0 -1.0 -7 -1 -1 [3,] 2 -2 0.5 2 0.5 -2 -0.5 0 1.5 -1 1 1 [4,] 4 2 4.0 3 1.0 2 3.0 2 2.0 2 2 2 [5,] 6 8 5.0 3 4.0 2 4.0 5 2.0 4 2 3 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.5801292 -5.870194 -2.080129 0.7099354 -0.7900646 -5.225161 -4.370194 [2,] 4.5801292 1.870194 3.080129 3.2900646 1.7900646 1.225161 3.370194 [,8] [,9] [,10] [,11] [,12] [1,] -1.290065 -0.4350969 -6.805291 -0.9350969 -1.119792 [2,] 1.290065 3.4350969 4.805291 2.9350969 3.119792 $out [1] -5 -4 $group [1] 4 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4, 0, 2, 4, 6, -7, -4, -2, 2, 8, -1, 0, 0.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/62htz1457174905.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] [1,] -15.0 -14.0 -25.0 -24.0 -14.0 -10.0 NA [2,] -13.0 -9.0 -18.5 -19.5 -11.5 -7.0 NA [3,] -7.5 -3.5 -15.0 -16.5 -9.5 -6.0 NA [4,] -3.0 -1.5 -12.0 -6.5 -6.5 -3.5 NA [5,] 0.0 1.0 -10.0 -5.0 -4.0 -2.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -12.061067 -6.92080034 -17.96469 -22.42939 -11.780534 -7.596373 NA [2,] -2.938933 -0.07919966 -12.03531 -10.57061 -7.219466 -4.403627 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(-15, -13, -7.5, -3, 0, -14, -9, -3.5, -1.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7vyk21457174905.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,] -11.666667 -12.00 -10.5000 [2,] -10.166667 -10.00 -9.4375 [3,] -9.500000 -9.00 -9.1875 [4,] -8.916667 -8.25 -8.3125 [5,] -8.166667 -7.50 -6.8750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] -10.070133 -9.798187 -9.70062 [2,] -8.929867 -8.201813 -8.67438 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(-11.6666666666667, -10.1666666666667, -9.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1r0d71457174905.ps tmp/1r0d71457174905.png",intern=TRUE)) character(0) > try(system("convert tmp/2c28p1457174905.ps tmp/2c28p1457174905.png",intern=TRUE)) character(0) > try(system("convert tmp/3n7981457174905.ps tmp/3n7981457174905.png",intern=TRUE)) character(0) > try(system("convert tmp/4qb921457174905.ps tmp/4qb921457174905.png",intern=TRUE)) character(0) > try(system("convert tmp/5924q1457174905.ps tmp/5924q1457174905.png",intern=TRUE)) character(0) > try(system("convert tmp/62htz1457174905.ps tmp/62htz1457174905.png",intern=TRUE)) character(0) > try(system("convert tmp/7vyk21457174905.ps tmp/7vyk21457174905.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.382 0.379 2.790