R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(26.73,26.85,27.01,27.09,27.11,27.16,27.13,27.19,27.49,27.63,27.72,27.77,27.81,27.92,28.07,28.14,28.17,28.2,28.21,28.2,28.19,28.24,28.25,28.26,28.33,28.67,28.81,28.99,29.16,29.25,29.25,29.38,29.48,29.65,29.69,29.73,29.81,30.05,30.29,30.37,30.5,30.67,30.76,30.84,30.86,31.09,31.2,31.19,31.18,31.31,31.39,31.39,31.37,31.36,31.37,31.35,31.34,31.47,31.48,31.54) > 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] 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,] 26.73 27.81 28.33 29.81 31.18 NA [2,] 26.85 27.92 28.67 30.05 31.31 NA [3,] 27.01 28.07 28.81 30.29 31.39 NA [4,] 27.09 28.14 28.99 30.37 31.39 NA [5,] 27.11 28.17 29.16 30.50 31.37 NA [6,] 27.16 28.20 29.25 30.67 31.36 NA [7,] 27.13 28.21 29.25 30.76 31.37 NA [8,] 27.19 28.20 29.38 30.84 31.35 NA [9,] 27.49 28.19 29.48 30.86 31.34 NA [10,] 27.63 28.24 29.65 31.09 31.47 NA [11,] 27.72 28.25 29.69 31.20 31.48 NA [12,] 27.77 28.26 29.73 31.19 31.54 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.12 0.11 0.34 0.24 0.13 NA [2,] 0.16 0.15 0.14 0.24 0.08 NA [3,] 0.08 0.07 0.18 0.08 0.00 NA [4,] 0.02 0.03 0.17 0.13 -0.02 NA [5,] 0.05 0.03 0.09 0.17 -0.01 NA [6,] -0.03 0.01 0.00 0.09 0.01 NA [7,] 0.06 -0.01 0.13 0.08 -0.02 NA [8,] 0.30 -0.01 0.10 0.02 -0.01 NA [9,] 0.14 0.05 0.17 0.23 0.13 NA [10,] 0.09 0.01 0.04 0.11 0.01 NA [11,] 0.05 0.01 0.04 -0.01 0.06 NA [12,] 0.04 0.07 0.08 -0.01 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/1j9qa1338281943.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/2a4ym1338281943.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/3komu1338281943.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/4qf4z1338281943.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,] 26.73 26.85 27.01 27.09 27.11 27.16 27.13 27.19 27.49 27.63 27.72 27.77 [2,] 27.81 27.92 28.07 28.14 28.17 28.20 28.21 28.20 28.19 28.24 28.25 28.26 [3,] 28.33 28.67 28.81 28.99 29.16 29.25 29.25 29.38 29.48 29.65 29.69 29.73 [4,] 29.81 30.05 30.29 30.37 30.50 30.67 30.76 30.84 30.86 31.09 31.20 31.19 [5,] 31.18 31.31 31.39 31.39 31.37 31.36 31.37 31.35 31.34 31.47 31.48 31.54 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 26.91681 27.16495 27.24135 27.41429 27.51363 27.5047 27.44818 27.51458 [2,] 29.74319 30.17505 30.37865 30.56571 30.80637 30.9953 31.05182 31.24542 [,9] [,10] [,11] [,12] [1,] 27.59338 27.6362 27.60554 27.65967 [2,] 31.36662 31.6638 31.77446 31.80033 $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(26.73, 27.81, 28.33, 29.81, 31.18, 26.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5q2k31338281943.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.11 0.14 0.07 -0.02 -0.01 0.00 -0.02 -0.01 0.13 0.01 -0.01 -0.010 [2,] 0.12 0.14 0.07 0.02 0.03 0.00 -0.01 -0.01 0.13 0.01 0.01 0.015 [3,] 0.13 0.15 0.08 0.03 0.05 0.01 0.06 0.02 0.14 0.04 0.04 0.055 [4,] 0.24 0.16 0.08 0.13 0.09 0.01 0.08 0.10 0.17 0.09 0.05 0.075 [5,] 0.34 0.16 0.08 0.17 0.17 0.01 0.13 0.10 0.17 0.11 0.06 0.080 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.0452083 0.1358681 0.07293403 -0.04772572 0.007604151 0.002934025 [2,] 0.2147917 0.1641319 0.08706597 0.10772572 0.092395849 0.017065975 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.003593773 -0.05772572 0.1117361 -0.0165278 0.0117361 0.0076 [2,] 0.123593773 0.09772572 0.1682639 0.0965278 0.0682639 0.1024 $out [1] 0.24 0.08 0.18 0.00 -0.03 0.09 0.30 0.05 0.23 $group [1] 2 2 3 3 6 6 8 9 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.110000000000003, 0.120000000000001, 0.129999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6zy6i1338281943.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,] 26.730 28.070 28.330 29.810 31.310 NA [2,] 27.050 28.105 28.900 30.330 31.345 NA [3,] 27.145 28.195 29.250 30.715 31.370 NA [4,] 27.560 28.225 29.565 30.975 31.430 NA [5,] 27.770 28.260 29.730 31.200 31.540 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 26.91239 28.14027 28.94669 30.42081 31.33123 NA [2,] 27.37761 28.24973 29.55331 31.00919 31.40877 NA $out [1] 27.81 27.92 31.18 $group [1] 2 2 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(26.73, 27.05, 27.145, 27.56, 27.77, 28.07, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/79fu81338281943.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,] 28.772 28.330 28.8100 [2,] 29.155 28.900 29.2175 [3,] 29.336 29.250 29.4600 [4,] 29.544 29.565 29.5950 [5,] 29.698 29.730 29.7250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 29.15857 28.94669 29.28782 [2,] 29.51343 29.55331 29.63218 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(28.772, 29.155, 29.336, 29.544, 29.698, 28.33, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1j9qa1338281943.ps tmp/1j9qa1338281943.png",intern=TRUE)) character(0) > try(system("convert tmp/2a4ym1338281943.ps tmp/2a4ym1338281943.png",intern=TRUE)) character(0) > try(system("convert tmp/3komu1338281943.ps tmp/3komu1338281943.png",intern=TRUE)) character(0) > try(system("convert tmp/4qf4z1338281943.ps tmp/4qf4z1338281943.png",intern=TRUE)) character(0) > try(system("convert tmp/5q2k31338281943.ps tmp/5q2k31338281943.png",intern=TRUE)) character(0) > try(system("convert tmp/6zy6i1338281943.ps tmp/6zy6i1338281943.png",intern=TRUE)) character(0) > try(system("convert tmp/79fu81338281943.ps tmp/79fu81338281943.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.755 0.414 2.175