R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(28.53,28.48,28.68,28.89,29.2,29.21,29.15,29.22,29.34,29.13,28.84,28.76,28.75,28.89,28.82,29.12,29.21,29.3,29.32,29.52,29.64,29.54,29.54,29.34,29.34,29.54,29.94,30.17,30.23,30.34,30.34,30.36,30.3,30.28,29.89,29.58,29.68,29.73,30.07,30.32,30.55,30.62,30.67,30.79,30.8,30.5,30.07,29.41,29.42,29.99,30.14,30.41,30.78,30.88,30.92,30.93,31.62,31.48,31.3,31.11,31.16,31.22,31.66,32.11,32.27,32.36,32.42,32.52,32.41,31.87,31.04,30.58) > 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,] 28.53 28.75 29.34 29.68 29.42 31.16 NA [2,] 28.48 28.89 29.54 29.73 29.99 31.22 NA [3,] 28.68 28.82 29.94 30.07 30.14 31.66 NA [4,] 28.89 29.12 30.17 30.32 30.41 32.11 NA [5,] 29.20 29.21 30.23 30.55 30.78 32.27 NA [6,] 29.21 29.30 30.34 30.62 30.88 32.36 NA [7,] 29.15 29.32 30.34 30.67 30.92 32.42 NA [8,] 29.22 29.52 30.36 30.79 30.93 32.52 NA [9,] 29.34 29.64 30.30 30.80 31.62 32.41 NA [10,] 29.13 29.54 30.28 30.50 31.48 31.87 NA [11,] 28.84 29.54 29.89 30.07 31.30 31.04 NA [12,] 28.76 29.34 29.58 29.41 31.11 30.58 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.05 0.14 0.20 0.05 0.57 0.06 NA [2,] 0.20 -0.07 0.40 0.34 0.15 0.44 NA [3,] 0.21 0.30 0.23 0.25 0.27 0.45 NA [4,] 0.31 0.09 0.06 0.23 0.37 0.16 NA [5,] 0.01 0.09 0.11 0.07 0.10 0.09 NA [6,] -0.06 0.02 0.00 0.05 0.04 0.06 NA [7,] 0.07 0.20 0.02 0.12 0.01 0.10 NA [8,] 0.12 0.12 -0.06 0.01 0.69 -0.11 NA [9,] -0.21 -0.10 -0.02 -0.30 -0.14 -0.54 NA [10,] -0.29 0.00 -0.39 -0.43 -0.18 -0.83 NA [11,] -0.08 -0.20 -0.31 -0.66 -0.19 -0.46 NA [12,] -0.01 0.00 0.10 0.01 0.05 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/10fxf1381738489.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/2wn7a1381738489.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/3080u1381738489.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/4dear1381738489.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] [1,] 28.53 28.480 28.680 28.890 29.20 29.21 29.150 29.220 29.34 29.13 28.84 [2,] 28.75 28.890 28.820 29.120 29.21 29.30 29.320 29.520 29.64 29.54 29.54 [3,] 29.38 29.635 30.005 30.245 30.39 30.48 30.505 30.575 30.55 30.39 29.98 [4,] 29.68 29.990 30.140 30.410 30.78 30.88 30.920 30.930 31.62 31.48 31.04 [5,] 29.68 31.220 31.660 32.110 32.27 32.36 32.420 32.520 32.41 31.87 31.30 [,12] [1,] 28.760 [2,] 29.340 [3,] 29.495 [4,] 30.580 [5,] 31.110 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 28.78012 28.92546 29.15356 29.41291 29.3773 29.46085 29.47295 29.6655 [2,] 29.97988 30.34454 30.85644 31.07709 31.4027 31.49915 31.53705 31.4845 [,9] [,10] [,11] [,12] [1,] 29.27284 29.13864 29.01245 28.69516 [2,] 31.82716 31.64136 30.94755 30.29484 $out [1] 31.16 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(28.53, 28.75, 29.38, 29.68, 29.68, 28.48, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ktb21381738489.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.05 -0.07 0.21 0.060 0.07 -0.06 0.010 -0.110 -0.540 -0.43 -0.660 -0.01 [2,] 0.05 0.15 0.23 0.090 0.07 0.00 0.020 -0.060 -0.300 -0.43 -0.460 0.00 [3,] 0.10 0.27 0.26 0.195 0.09 0.03 0.085 0.065 -0.175 -0.34 -0.255 0.01 [4,] 0.20 0.40 0.30 0.310 0.10 0.05 0.120 0.120 -0.100 -0.18 -0.190 0.05 [5,] 0.20 0.44 0.30 0.370 0.11 0.06 0.200 0.120 -0.020 0.00 -0.080 0.10 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.003245155 0.1087419 0.2148477 0.05309289 0.07064903 -0.002251615 [2,] 0.196754845 0.4312581 0.3051523 0.33690711 0.10935097 0.062251615 [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.02049677 -0.05110581 -0.30400646 -0.5012581 -0.42915872 -0.02532987 [2,] 0.14950323 0.18110581 -0.04599354 -0.1787419 -0.08084128 0.04532987 $out [1] 0.57 0.45 0.01 0.69 -0.83 $group [1] 1 3 5 8 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0500000000000007, 0.0500000000000007, 0.0999999999999996, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jgw31381738489.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,] 28.480 28.750 29.340 29.410 29.420 30.580 NA [2,] 28.720 29.005 29.735 29.900 30.275 31.190 NA [3,] 29.010 29.310 30.200 30.410 30.900 31.990 NA [4,] 29.205 29.530 30.320 30.645 31.205 32.385 NA [5,] 29.340 29.640 30.360 30.800 31.620 32.520 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 28.78879 29.07054 29.93318 30.0702 30.47582 31.44495 NA [2,] 29.23121 29.54946 30.46682 30.7498 31.32418 32.53505 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(28.48, 28.72, 29.01, 29.205, 29.34, 28.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7puhq1381738489.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,] 29.48000 29.3800 29.25625 [2,] 29.84083 29.8075 29.72750 [3,] 30.27167 30.3175 30.14062 [4,] 30.46833 30.4925 30.26438 [5,] 30.68500 30.5750 30.61000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 29.98546 30.00507 29.89575 [2,] 30.55787 30.62993 30.38550 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(29.48, 29.8408333333333, 30.2716666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/10fxf1381738489.ps tmp/10fxf1381738489.png",intern=TRUE)) character(0) > try(system("convert tmp/2wn7a1381738489.ps tmp/2wn7a1381738489.png",intern=TRUE)) character(0) > try(system("convert tmp/3080u1381738489.ps tmp/3080u1381738489.png",intern=TRUE)) character(0) > try(system("convert tmp/4dear1381738489.ps tmp/4dear1381738489.png",intern=TRUE)) character(0) > try(system("convert tmp/5ktb21381738489.ps tmp/5ktb21381738489.png",intern=TRUE)) character(0) > try(system("convert tmp/6jgw31381738489.ps tmp/6jgw31381738489.png",intern=TRUE)) character(0) > try(system("convert tmp/7puhq1381738489.ps tmp/7puhq1381738489.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.484 0.708 4.180