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(103.43,103.49,103.5,103.5,103.5,103.5,103.54,103.71,103.76,103.76,103.76,103.82,105.11,105.58,105.91,105.92,105.92,105.92,105.96,105.98,105.98,105.98,106.01,106.01,106.91,107.11,107.18,107.2,107.35,107.35,107.35,107.52,107.56,107.55,107.6,107.6,110.04,110.27,110.33,110.33,110.33,110.33,110.33,110.35,110.38,110.54,110.54,110.54,110.54,106.74,106.78,106.75,106.75,106.75,106.82,107.08,107.25,107.28,107.28,107.28,108.44,109.33,109.44,109.44,109.45,109.45,109.45,109.45,109.46,109.46,109.46,109.46,110.95,110.95,110.95,110.95,110.95,110.95,110.95,110.95,110.97,110.97,110.97,111) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 103.43 105.11 106.91 110.04 110.54 108.44 110.95 NA [2,] 103.49 105.58 107.11 110.27 106.74 109.33 110.95 NA [3,] 103.50 105.91 107.18 110.33 106.78 109.44 110.95 NA [4,] 103.50 105.92 107.20 110.33 106.75 109.44 110.95 NA [5,] 103.50 105.92 107.35 110.33 106.75 109.45 110.95 NA [6,] 103.50 105.92 107.35 110.33 106.75 109.45 110.95 NA [7,] 103.54 105.96 107.35 110.33 106.82 109.45 110.95 NA [8,] 103.71 105.98 107.52 110.35 107.08 109.45 110.95 NA [9,] 103.76 105.98 107.56 110.38 107.25 109.46 110.97 NA [10,] 103.76 105.98 107.55 110.54 107.28 109.46 110.97 NA [11,] 103.76 106.01 107.60 110.54 107.28 109.46 110.97 NA [12,] 103.82 106.01 107.60 110.54 107.28 109.46 111.00 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.06 0.47 0.20 0.23 -3.80 0.89 0.00 NA [2,] 0.01 0.33 0.07 0.06 0.04 0.11 0.00 NA [3,] 0.00 0.01 0.02 0.00 -0.03 0.00 0.00 NA [4,] 0.00 0.00 0.15 0.00 0.00 0.01 0.00 NA [5,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NA [6,] 0.04 0.04 0.00 0.00 0.07 0.00 0.00 NA [7,] 0.17 0.02 0.17 0.02 0.26 0.00 0.00 NA [8,] 0.05 0.00 0.04 0.03 0.17 0.01 0.02 NA [9,] 0.00 0.00 -0.01 0.16 0.03 0.00 0.00 NA [10,] 0.00 0.03 0.05 0.00 0.00 0.00 0.00 NA [11,] 0.06 0.00 0.00 0.00 0.00 0.00 0.03 NA [12,] 1.29 0.90 2.44 0.00 1.16 1.49 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/1m78f1389451089.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/2ut5i1389451089.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/36k281389451089.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/4r5eu1389451089.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,] 103.43 103.49 103.500 103.500 103.500 103.500 103.54 103.71 103.760 103.76 [2,] 106.01 106.16 106.345 106.335 106.335 106.335 106.39 106.53 106.615 106.63 [3,] 108.44 107.11 107.180 107.200 107.350 107.350 107.35 107.52 107.560 107.55 [4,] 110.29 109.80 109.885 109.885 109.890 109.890 109.89 109.90 109.920 110.00 [5,] 110.95 110.95 110.950 110.950 110.950 110.950 110.95 110.95 110.970 110.97 [,11] [,12] [1,] 103.760 103.820 [2,] 106.645 106.645 [3,] 107.600 107.600 [4,] 110.000 110.000 [5,] 110.970 111.000 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 105.8841 104.9363 105.066 105.08 105.227 105.227 105.2599 105.5075 [2,] 110.9959 109.2837 109.294 109.32 109.473 109.473 109.4401 109.5325 [,9] [,10] [,11] [,12] [1,] 105.5863 105.5375 105.5964 105.5964 [2,] 109.5337 109.5625 109.6036 109.6036 $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(103.43, 106.01, 108.44, 110.29, 110.95, 103.49, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5y6to1389451089.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.000 0.000 0.000 0 0.00 0.00 0.000 -0.010 0.000 0.000 0.900 [2,] 0.03 0.025 0.000 0.000 0 0.00 0.01 0.015 0.000 0.000 0.000 0.900 [3,] 0.20 0.060 0.000 0.000 0 0.00 0.02 0.030 0.000 0.000 0.000 1.225 [4,] 0.35 0.090 0.005 0.005 0 0.04 0.17 0.045 0.015 0.015 0.015 1.490 [5,] 0.47 0.110 0.010 0.010 0 0.07 0.26 0.050 0.030 0.030 0.030 1.490 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.008901162 0.02118305 -0.002985919 -0.002985919 0 -0.02388735 [2,] 0.391098838 0.09881695 0.002985919 0.002985919 0 0.02388735 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.07554942 0.01208448 -0.008957758 -0.008957758 -0.008957758 0.8444309 [2,] 0.11554942 0.04791552 0.008957758 0.008957758 0.008957758 1.6055691 $out [1] -3.80 0.89 0.33 0.02 -0.03 0.15 0.17 0.16 0.05 0.06 2.44 0.00 $group [1] 1 1 2 3 3 4 8 9 10 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0.029999999999994, 0.200000000000003, 0.349999999999994, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jlzd1389451089.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] [1,] 103.43 105.910 106.910 110.27 106.74 109.44 110.95 NA [2,] 103.50 105.915 107.190 110.33 106.75 109.44 110.95 NA [3,] 103.52 105.940 107.350 110.33 106.95 109.45 110.95 NA [4,] 103.76 105.980 107.555 110.46 107.28 109.46 110.97 NA [5,] 103.82 106.010 107.600 110.54 107.28 109.46 111.00 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 103.4014 105.9104 107.1835 110.2707 106.7083 109.4409 110.9409 NA [2,] 103.6386 105.9696 107.5165 110.3893 107.1917 109.4591 110.9591 NA $out [1] 105.11 105.58 110.04 110.54 108.44 109.33 $group [1] 2 2 4 5 6 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(103.43, 103.5, 103.52, 103.76, 103.82, 105.91, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7exl21389451089.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,] 107.6386 107.110 107.9800 [2,] 107.7386 107.275 108.1125 [3,] 107.8171 107.435 108.1450 [4,] 107.9257 107.580 108.2912 [5,] 107.9586 107.600 108.3225 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 107.7318 107.2959 108.0635 [2,] 107.9025 107.5741 108.2265 $out [1] 108.44 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(107.638571428571, 107.738571428571, 107.817142857143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1m78f1389451089.ps tmp/1m78f1389451089.png",intern=TRUE)) character(0) > try(system("convert tmp/2ut5i1389451089.ps tmp/2ut5i1389451089.png",intern=TRUE)) character(0) > try(system("convert tmp/36k281389451089.ps tmp/36k281389451089.png",intern=TRUE)) character(0) > try(system("convert tmp/4r5eu1389451089.ps tmp/4r5eu1389451089.png",intern=TRUE)) character(0) > try(system("convert tmp/5y6to1389451089.ps tmp/5y6to1389451089.png",intern=TRUE)) character(0) > try(system("convert tmp/6jlzd1389451089.ps tmp/6jlzd1389451089.png",intern=TRUE)) character(0) > try(system("convert tmp/7exl21389451089.ps tmp/7exl21389451089.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.171 1.559 8.713