R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-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(2.1,2.1,2.11,2.12,2.13,2.13,2.13,2.13,2.14,2.15,2.16,2.17,2.16,2.2,2.19,2.2,2.2,2.2,2.21,2.22,2.25,2.33,2.33,2.35,2.37,2.38,2.38,2.41,2.41,2.41,2.41,2.42,2.42,2.43,2.44,2.44,2.43,2.44,2.44,2.44,2.44,2.44,2.43,2.42,2.43,2.43,2.43,2.43,2.43,2.44,2.43,2.43,2.44,2.43,2.43,2.44,2.46,2.48,2.49,2.5,2.53,2.55,2.57,2.56,2.56,2.57,2.56,2.57,2.58,2.58,2.58,2.59) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean Plot (v1.0.4) 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) > (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,] 2.10 2.16 2.37 2.43 2.43 2.53 NA [2,] 2.10 2.20 2.38 2.44 2.44 2.55 NA [3,] 2.11 2.19 2.38 2.44 2.43 2.57 NA [4,] 2.12 2.20 2.41 2.44 2.43 2.56 NA [5,] 2.13 2.20 2.41 2.44 2.44 2.56 NA [6,] 2.13 2.20 2.41 2.44 2.43 2.57 NA [7,] 2.13 2.21 2.41 2.43 2.43 2.56 NA [8,] 2.13 2.22 2.42 2.42 2.44 2.57 NA [9,] 2.14 2.25 2.42 2.43 2.46 2.58 NA [10,] 2.15 2.33 2.43 2.43 2.48 2.58 NA [11,] 2.16 2.33 2.44 2.43 2.49 2.58 NA [12,] 2.17 2.35 2.44 2.43 2.50 2.59 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.00 0.04 0.01 0.01 0.01 0.02 NA [2,] 0.01 -0.01 0.00 0.00 -0.01 0.02 NA [3,] 0.01 0.01 0.03 0.00 0.00 -0.01 NA [4,] 0.01 0.00 0.00 0.00 0.01 0.00 NA [5,] 0.00 0.00 0.00 0.00 -0.01 0.01 NA [6,] 0.00 0.01 0.00 -0.01 0.00 -0.01 NA [7,] 0.00 0.01 0.01 -0.01 0.01 0.01 NA [8,] 0.01 0.03 0.00 0.01 0.02 0.01 NA [9,] 0.01 0.08 0.01 0.00 0.02 0.00 NA [10,] 0.01 0.00 0.01 0.00 0.01 0.00 NA [11,] 0.01 0.02 0.00 0.00 0.01 0.01 NA [12,] -0.01 0.02 -0.01 0.00 0.03 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/1u9r81350632965.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/280b41350632965.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/3zp2e1350632965.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/482gr1350632965.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,] 2.10 2.10 2.110 2.12 2.130 2.13 2.13 2.13 2.140 2.15 2.160 2.170 [2,] 2.16 2.20 2.190 2.20 2.200 2.20 2.21 2.22 2.250 2.33 2.330 2.350 [3,] 2.40 2.41 2.405 2.42 2.425 2.42 2.42 2.42 2.425 2.43 2.435 2.435 [4,] 2.43 2.44 2.440 2.44 2.440 2.44 2.43 2.44 2.460 2.48 2.490 2.500 [5,] 2.53 2.55 2.570 2.56 2.560 2.57 2.56 2.57 2.580 2.58 2.580 2.590 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2.225841 2.255192 2.243742 2.265192 2.270192 2.265192 2.278093 2.278093 [2,] 2.574159 2.564808 2.566258 2.574808 2.579808 2.574808 2.561907 2.561907 [,9] [,10] [,11] [,12] [1,] 2.289543 2.333245 2.331795 2.338245 [2,] 2.560457 2.526755 2.538205 2.531755 $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(2.1, 2.16, 2.4, 2.43, 2.53, 2.1, 2.2, 2.41, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5qx4q1350632965.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.00 -0.01 -0.010 0.00 0 -0.01 -0.01 0.00 0.00 0.000 0.00 -0.01 [2,] 0.01 -0.01 0.000 0.00 0 -0.01 0.00 0.01 0.00 0.000 0.00 -0.01 [3,] 0.01 0.00 0.005 0.00 0 0.00 0.01 0.01 0.01 0.005 0.01 0.00 [4,] 0.02 0.01 0.010 0.01 0 0.00 0.01 0.02 0.02 0.010 0.01 0.02 [5,] 0.02 0.02 0.010 0.01 0 0.01 0.01 0.03 0.02 0.010 0.02 0.03 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.003549677 -0.01290065 -0.001450323 -0.006450323 0 -0.006450323 [2,] 0.016450323 0.01290065 0.011450323 0.006450323 0 0.006450323 [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.003549677 0.003549677 -0.002900646 -0.001450323 0.003549677 -0.02119792 [2,] 0.016450323 0.016450323 0.022900646 0.011450323 0.016450323 0.02119792 $out [1] 0.04 0.03 -0.01 0.01 0.08 $group [1] 1 3 5 5 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0.00999999999999979, 0.00999999999999979, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6mm3i1350632965.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,] 2.100 2.160 2.370 2.42 2.43 2.55 NA [2,] 2.115 2.200 2.395 2.43 2.43 2.56 NA [3,] 2.130 2.205 2.410 2.43 2.44 2.57 NA [4,] 2.145 2.290 2.425 2.44 2.47 2.58 NA [5,] 2.170 2.350 2.440 2.44 2.50 2.59 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2.116317 2.16395 2.396317 2.425439 2.421756 2.560878 NA [2,] 2.143683 2.24605 2.423683 2.434561 2.458244 2.579122 NA $out [1] 2.53 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(2.1, 2.115, 2.13, 2.145, 2.17, 2.16, 2.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7m96g1350632965.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,] 2.336667 2.4000 2.321250 [2,] 2.356667 2.4150 2.343750 [3,] 2.363333 2.4200 2.345625 [4,] 2.390000 2.4275 2.391875 [5,] 2.413333 2.4350 2.427500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.348130 2.414299 2.323675 [2,] 2.378537 2.425701 2.367575 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(2.33666666666667, 2.35666666666667, 2.36333333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1u9r81350632965.ps tmp/1u9r81350632965.png",intern=TRUE)) character(0) > try(system("convert tmp/280b41350632965.ps tmp/280b41350632965.png",intern=TRUE)) character(0) > try(system("convert tmp/3zp2e1350632965.ps tmp/3zp2e1350632965.png",intern=TRUE)) character(0) > try(system("convert tmp/482gr1350632965.ps tmp/482gr1350632965.png",intern=TRUE)) character(0) > try(system("convert tmp/5qx4q1350632965.ps tmp/5qx4q1350632965.png",intern=TRUE)) character(0) > try(system("convert tmp/6mm3i1350632965.ps tmp/6mm3i1350632965.png",intern=TRUE)) character(0) > try(system("convert tmp/7m96g1350632965.ps tmp/7m96g1350632965.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.287 0.526 3.805