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(38.95,38.96,38.93,38.86,38.75,38.87,38.87,38.86,38.83,39.08,39.05,38.97,38.97,38.95,38.95,38.92,38.96,38.97,38.97,38.95,38.93,38.76,38.81,38.81,38.81,38.78,38.77,38.61,38.69,38.69,38.68,38.74,38.73,38.62,38.57,38.57,38.57,38.57,38.56,38.55,38.42,38.47,38.47,38.48,38.45,38.43,38.43,38.48,38.48,38.48,38.51,38.48,38.55,38.55,38.55,38.49,38.37,38.14,38.08,38.04,38.04,38.03,37.98,38.03,38.05,38.05,38.05,38.05,38.02,38.06,38.01,38,38,38,37.99,37.96,37.96,38.02,38.02,38.02,38,37.93,38,38,38,38,38,38.01,37.98,38,38,38,37.95,37.87,37.75,37.75) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 38.95 38.97 38.81 38.57 38.48 38.04 38.00 38.00 NA [2,] 38.96 38.95 38.78 38.57 38.48 38.03 38.00 38.00 NA [3,] 38.93 38.95 38.77 38.56 38.51 37.98 37.99 38.00 NA [4,] 38.86 38.92 38.61 38.55 38.48 38.03 37.96 38.01 NA [5,] 38.75 38.96 38.69 38.42 38.55 38.05 37.96 37.98 NA [6,] 38.87 38.97 38.69 38.47 38.55 38.05 38.02 38.00 NA [7,] 38.87 38.97 38.68 38.47 38.55 38.05 38.02 38.00 NA [8,] 38.86 38.95 38.74 38.48 38.49 38.05 38.02 38.00 NA [9,] 38.83 38.93 38.73 38.45 38.37 38.02 38.00 37.95 NA [10,] 39.08 38.76 38.62 38.43 38.14 38.06 37.93 37.87 NA [11,] 39.05 38.81 38.57 38.43 38.08 38.01 38.00 37.75 NA [12,] 38.97 38.81 38.57 38.48 38.04 38.00 38.00 37.75 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.01 -0.02 -0.03 0.00 0.00 -0.01 0.00 0.00 NA [2,] -0.03 0.00 -0.01 -0.01 0.03 -0.05 -0.01 0.00 NA [3,] -0.07 -0.03 -0.16 -0.01 -0.03 0.05 -0.03 0.01 NA [4,] -0.11 0.04 0.08 -0.13 0.07 0.02 0.00 -0.03 NA [5,] 0.12 0.01 0.00 0.05 0.00 0.00 0.06 0.02 NA [6,] 0.00 0.00 -0.01 0.00 0.00 0.00 0.00 0.00 NA [7,] -0.01 -0.02 0.06 0.01 -0.06 0.00 0.00 0.00 NA [8,] -0.03 -0.02 -0.01 -0.03 -0.12 -0.03 -0.02 -0.05 NA [9,] 0.25 -0.17 -0.11 -0.02 -0.23 0.04 -0.07 -0.08 NA [10,] -0.03 0.05 -0.05 0.00 -0.06 -0.05 0.07 -0.12 NA [11,] -0.08 0.00 0.00 0.05 -0.04 -0.01 0.00 0.00 NA [12,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 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/1gd751381918486.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/2pokk1381918486.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/3mocr1381918486.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/45xxn1381918486.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] [1,] 38.000 38.000 37.980 37.960 37.960 38.000 38.000 38.000 37.95 37.870 [2,] 38.020 38.015 37.995 38.020 38.015 38.035 38.035 38.035 38.01 37.995 [3,] 38.525 38.525 38.535 38.515 38.485 38.510 38.510 38.485 38.41 38.285 [4,] 38.880 38.865 38.850 38.735 38.720 38.780 38.775 38.800 38.78 38.690 [5,] 38.970 38.960 38.950 38.920 38.960 38.970 38.970 38.950 38.93 39.080 [,11] [,12] [1,] 37.750 37.75 [2,] 38.005 38.00 [3,] 38.255 38.26 [4,] 38.690 38.69 [5,] 39.050 38.97 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 38.04459 38.05018 38.05738 38.11559 38.09118 38.09383 38.09663 38.05766 [2,] 39.00541 38.99982 39.01262 38.91441 38.87882 38.92617 38.92337 38.91234 [,9] [,10] [,11] [,12] [1,] 37.97987 37.89676 37.87235 37.87456 [2,] 38.84013 38.67324 38.63765 38.64544 $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(38, 38.02, 38.525, 38.88, 38.97, 38, 38.015, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/54jgt1381918486.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] [1,] -0.030 -0.03 -7.000000e-02 -0.130 0.000 0 -0.020 -0.05 -0.230 -0.120 [2,] -0.015 -0.02 -5.000000e-02 -0.070 0.000 0 -0.015 -0.04 -0.140 -0.055 [3,] 0.000 -0.01 -3.000000e-02 0.010 0.015 0 0.000 -0.03 -0.075 -0.040 [4,] 0.000 0.00 -3.552714e-15 0.055 0.055 0 0.005 -0.02 0.010 0.025 [5,] 0.010 0.00 5.000000e-02 0.080 0.120 0 0.010 -0.01 0.040 0.070 [,11] [,12] [1,] -0.040 0 [2,] -0.025 0 [3,] 0.000 0 [4,] 0.000 0 [5,] 0.000 0 $n [1] 8 8 8 8 8 8 8 8 8 8 8 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.008379215 -0.021172287 -0.057930718 -0.05982679 -0.01572379 0 [2,] 0.008379215 0.001172287 -0.002069282 0.07982679 0.04572379 0 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.01117229 -0.04117229 -0.158792154 -0.084689149 -0.01396536 0 [2,] 0.01117229 -0.01882771 0.008792154 0.004689149 0.01396536 0 $out [1] 0.03 -0.05 -0.16 -0.01 0.06 -0.06 -0.12 0.25 -0.08 0.05 $group [1] 2 2 3 6 7 7 8 9 11 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0300000000000011, -0.014999999999997, 0, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6e00p1381918486.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] [,8] [,9] [1,] 38.750 38.760 38.570 38.420 38.040 37.980 37.930 37.87 NA [2,] 38.860 38.865 38.615 38.440 38.255 38.015 37.975 37.91 NA [3,] 38.900 38.950 38.690 38.475 38.480 38.035 38.000 38.00 NA [4,] 38.965 38.965 38.755 38.555 38.530 38.050 38.010 38.00 NA [5,] 39.080 38.970 38.810 38.570 38.550 38.060 38.020 38.01 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 38.85211 38.90439 38.62615 38.42255 38.35457 38.01904 37.98404 37.95895 [2,] 38.94789 38.99561 38.75385 38.52745 38.60543 38.05096 38.01596 38.04105 [,9] [1,] NA [2,] NA $out [1] 37.75 37.75 $group [1] 8 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(38.75, 38.86, 38.9, 38.965, 39.08, 38.76, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7l57v1381918486.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,] 38.32750 38.2550 38.3150 [2,] 38.38562 38.3475 38.3450 [3,] 38.43812 38.4975 38.3850 [4,] 38.45687 38.5200 38.4050 [5,] 38.47750 38.5350 38.4375 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 38.40563 38.41882 38.35763 [2,] 38.47062 38.57618 38.41237 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(38.3275, 38.385625, 38.438125, 38.456875, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1gd751381918486.ps tmp/1gd751381918486.png",intern=TRUE)) character(0) > try(system("convert tmp/2pokk1381918486.ps tmp/2pokk1381918486.png",intern=TRUE)) character(0) > try(system("convert tmp/3mocr1381918486.ps tmp/3mocr1381918486.png",intern=TRUE)) character(0) > try(system("convert tmp/45xxn1381918486.ps tmp/45xxn1381918486.png",intern=TRUE)) character(0) > try(system("convert tmp/54jgt1381918486.ps tmp/54jgt1381918486.png",intern=TRUE)) character(0) > try(system("convert tmp/6e00p1381918486.ps tmp/6e00p1381918486.png",intern=TRUE)) character(0) > try(system("convert tmp/7l57v1381918486.ps tmp/7l57v1381918486.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.339 0.744 4.070