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(2.19,2.2,2.2,2.22,2.21,2.21,2.21,2.2,2.21,2.2,2.23,2.27,2.3,2.33,2.3,2.32,2.29,2.25,2.24,2.22,2.28,2.38,2.4,2.44,2.44,2.48,2.54,2.58,2.58,2.57,2.58,2.59,2.58,2.59,2.59,2.58,2.58,2.57,2.57,2.56,2.56,2.52,2.51,2.52,2.52,2.48,2.5,2.5,2.5,2.52,2.5,2.49,2.5,2.46,2.49,2.49,2.5,2.51,2.55,2.62,2.65,2.65,2.65,2.65,2.66,2.66,2.66,2.67,2.66,2.67,2.68,2.67) > 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.19 2.30 2.44 2.58 2.50 2.65 NA [2,] 2.20 2.33 2.48 2.57 2.52 2.65 NA [3,] 2.20 2.30 2.54 2.57 2.50 2.65 NA [4,] 2.22 2.32 2.58 2.56 2.49 2.65 NA [5,] 2.21 2.29 2.58 2.56 2.50 2.66 NA [6,] 2.21 2.25 2.57 2.52 2.46 2.66 NA [7,] 2.21 2.24 2.58 2.51 2.49 2.66 NA [8,] 2.20 2.22 2.59 2.52 2.49 2.67 NA [9,] 2.21 2.28 2.58 2.52 2.50 2.66 NA [10,] 2.20 2.38 2.59 2.48 2.51 2.67 NA [11,] 2.23 2.40 2.59 2.50 2.55 2.68 NA [12,] 2.27 2.44 2.58 2.50 2.62 2.67 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.01 0.03 0.04 -0.01 0.02 0.00 NA [2,] 0.00 -0.03 0.06 0.00 -0.02 0.00 NA [3,] 0.02 0.02 0.04 -0.01 -0.01 0.00 NA [4,] -0.01 -0.03 0.00 0.00 0.01 0.01 NA [5,] 0.00 -0.04 -0.01 -0.04 -0.04 0.00 NA [6,] 0.00 -0.01 0.01 -0.01 0.03 0.00 NA [7,] -0.01 -0.02 0.01 0.01 0.00 0.01 NA [8,] 0.01 0.06 -0.01 0.00 0.01 -0.01 NA [9,] -0.01 0.10 0.01 -0.04 0.01 0.01 NA [10,] 0.03 0.02 0.00 0.02 0.04 0.01 NA [11,] 0.04 0.04 -0.01 0.00 0.07 -0.01 NA [12,] 0.03 0.00 0.00 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/1xytl1384774082.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/23kyb1384774082.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/3nv4s1384774082.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/4rvmk1384774082.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.19 2.20 2.20 2.220 2.21 2.21 2.21 2.200 2.21 2.200 2.230 2.27 [2,] 2.30 2.33 2.30 2.320 2.29 2.25 2.24 2.220 2.28 2.380 2.400 2.44 [3,] 2.47 2.50 2.52 2.525 2.53 2.49 2.50 2.505 2.51 2.495 2.525 2.54 [4,] 2.58 2.57 2.57 2.580 2.58 2.57 2.58 2.590 2.58 2.590 2.590 2.62 [5,] 2.65 2.65 2.65 2.650 2.66 2.66 2.66 2.670 2.66 2.670 2.680 2.67 $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.289391 2.345192 2.345841 2.357292 2.342941 2.28359 2.280689 2.266338 [2,] 2.650609 2.654808 2.694159 2.692708 2.717059 2.69641 2.719311 2.743662 [,9] [,10] [,11] [,12] [1,] 2.31649 2.359543 2.402444 2.423894 [2,] 2.70351 2.630457 2.647556 2.656106 $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.19, 2.3, 2.47, 2.58, 2.65, 2.2, 2.33, 2.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/530we1384774082.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] [1,] -0.010 -0.03 -0.01 -0.03 -0.040 -0.01 -0.020 -0.010 -0.01 0.00 -0.01 [2,] 0.000 -0.02 -0.01 -0.01 -0.040 -0.01 -0.010 -0.010 -0.01 0.01 -0.01 [3,] 0.015 0.00 0.01 0.00 -0.025 0.00 0.005 0.005 0.01 0.02 0.02 [4,] 0.030 0.00 0.02 0.01 0.000 0.01 0.010 0.010 0.01 0.03 0.04 [5,] 0.040 0.00 0.04 0.01 0.000 0.03 0.010 0.010 0.01 0.04 0.07 [,12] [1,] 0.00 [2,] 0.00 [3,] 0.00 [4,] 0.03 [5,] 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.004350969 -0.01290065 -0.009350969 -0.01290065 -0.050801292 -0.01290065 [2,] 0.034350969 0.01290065 0.029350969 0.01290065 0.000801292 0.01290065 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.007900646 -0.007900646 -0.002900646 0.007099354 -0.01225161 -0.02119792 [2,] 0.017900646 0.017900646 0.022900646 0.032900646 0.05225161 0.02119792 $out [1] 0.06 0.06 0.10 -0.04 $group [1] 2 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.0100000000000002, 0, 0.0150000000000001, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6s1py1384774082.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.190 2.220 2.540 2.480 2.460 2.65 NA [2,] 2.200 2.265 2.555 2.505 2.490 2.65 NA [3,] 2.210 2.300 2.580 2.520 2.500 2.66 NA [4,] 2.215 2.355 2.585 2.565 2.515 2.67 NA [5,] 2.230 2.440 2.590 2.580 2.550 2.68 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2.203158 2.25895 2.566317 2.492634 2.488597 2.650878 NA [2,] 2.216842 2.34105 2.593683 2.547366 2.511403 2.669122 NA $out [1] 2.27 2.44 2.48 2.62 $group [1] 1 3 3 5 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(2.19, 2.2, 2.21, 2.215, 2.23, 2.22, 2.265, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7d87f1384774082.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.443333 2.4700 2.430000 [2,] 2.448333 2.4975 2.440000 [3,] 2.459167 2.5075 2.457500 [4,] 2.470833 2.5250 2.478125 [5,] 2.491667 2.5400 2.532500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.448904 2.494957 2.440111 [2,] 2.469429 2.520043 2.474889 $out [1] 2.513333 $group [1] 1 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(2.44333333333333, 2.44833333333333, 2.45916666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xytl1384774082.ps tmp/1xytl1384774082.png",intern=TRUE)) character(0) > try(system("convert tmp/23kyb1384774082.ps tmp/23kyb1384774082.png",intern=TRUE)) character(0) > try(system("convert tmp/3nv4s1384774082.ps tmp/3nv4s1384774082.png",intern=TRUE)) character(0) > try(system("convert tmp/4rvmk1384774082.ps tmp/4rvmk1384774082.png",intern=TRUE)) character(0) > try(system("convert tmp/530we1384774082.ps tmp/530we1384774082.png",intern=TRUE)) character(0) > try(system("convert tmp/6s1py1384774082.ps tmp/6s1py1384774082.png",intern=TRUE)) character(0) > try(system("convert tmp/7d87f1384774082.ps tmp/7d87f1384774082.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.448 0.938 5.367