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(55.7,59.2,59.8,61.6,65.8,64.2,67,62.8,65.5,75.2,80.9,83.2,83.7,86.4,85.9,80.4,81.8,87.5,83.7,87,99.7,101.4,101.9,115.7,123.2,136.9,146.8,149.6,146.5,157,147.9,133.6,128.7,100.8,91.8,89.3,96.7,91.6,93.3,93.3,101,100.4,86.9,83.9,80.3,87.7,92.7,95.5,92,87.4,86.8,83.7,85,81.7,90.9,101.5,113.8,120.1,122.1,132.5,140,149.4,144.3,154.4,151.4,145.5,136.8,146.6,145.1,133.6,131.4,127.5,130.1,131.1,132.3,128.6,125.1,128.7,156.1,163.2,159.8,157.4,156.2,152.5) > par1 = '7' > par1 <- '7' > #'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] 12 > 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] 12 12 12 12 12 12 12 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 55.7 62.8 85.9 101.4 146.5 89.3 86.9 87.4 113.8 154.4 131.4 128.7 NA [2,] 59.2 65.5 80.4 101.9 157.0 96.7 83.9 86.8 120.1 151.4 127.5 156.1 NA [3,] 59.8 75.2 81.8 115.7 147.9 91.6 80.3 83.7 122.1 145.5 130.1 163.2 NA [4,] 61.6 80.9 87.5 123.2 133.6 93.3 87.7 85.0 132.5 136.8 131.1 159.8 NA [5,] 65.8 83.2 83.7 136.9 128.7 93.3 92.7 81.7 140.0 146.6 132.3 157.4 NA [6,] 64.2 83.7 87.0 146.8 100.8 101.0 95.5 90.9 149.4 145.1 128.6 156.2 NA [7,] 67.0 86.4 99.7 149.6 91.8 100.4 92.0 101.5 144.3 133.6 125.1 152.5 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 3.5 2.7 -5.5 0.5 10.5 7.4 -3.0 -0.6 6.3 -3.0 -3.9 27.4 NA [2,] 0.6 9.7 1.4 13.8 -9.1 -5.1 -3.6 -3.1 2.0 -5.9 2.6 7.1 NA [3,] 1.8 5.7 5.7 7.5 -14.3 1.7 7.4 1.3 10.4 -8.7 1.0 -3.4 NA [4,] 4.2 2.3 -3.8 13.7 -4.9 0.0 5.0 -3.3 7.5 9.8 1.2 -2.4 NA [5,] -1.6 0.5 3.3 9.9 -27.9 7.7 2.8 9.2 9.4 -1.5 -3.7 -1.2 NA [6,] 2.8 2.7 12.7 2.8 -9.0 -0.6 -3.5 10.6 -5.1 -11.5 -3.5 -3.7 NA [7,] -4.2 -0.5 1.7 -3.1 -2.5 -13.5 -4.6 12.3 10.1 -2.2 3.6 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/fisher/rcomp/tmp/1ejp21387018950.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/fisher/rcomp/tmp/2cml01387018950.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/fisher/rcomp/tmp/3qloi1387018950.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/fisher/rcomp/tmp/4n1bh1387018950.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] [1,] 55.70 59.20 59.80 61.60 65.80 64.20 67.00 [2,] 86.40 82.15 81.05 86.25 83.45 88.95 91.90 [3,] 95.35 99.30 103.65 108.25 111.00 100.90 100.95 [4,] 130.05 139.45 137.80 133.05 138.45 145.95 138.95 [5,] 154.40 157.00 163.20 159.80 157.40 156.20 152.50 $n [1] 12 12 12 12 12 12 12 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 75.44094 73.16509 77.76594 86.90421 85.91413 74.90192 79.49018 [2,] 115.25906 125.43491 129.53406 129.59579 136.08587 126.89808 122.40982 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" Warning message: In bxp(list(stats = c(55.7, 86.4, 95.35, 130.05, 154.4, 59.2, 82.15, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5b02w1387018950.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] [1,] -5.50 -9.10 -8.70 -4.90 -3.70 -11.50 -4.60 [2,] -3.00 -4.35 -1.20 -2.85 -1.55 -4.40 -3.65 [3,] 1.60 1.00 1.75 1.75 1.65 -2.05 -2.20 [4,] 6.85 4.85 6.55 6.25 8.45 2.80 2.65 [5,] 10.50 13.80 10.40 13.70 9.90 12.70 10.10 $n [1] 12 12 12 12 12 12 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.892651 -3.196182 -1.784827 -2.400571 -2.911067 -5.333968 -5.2012439 [2,] 6.092651 5.196182 5.284827 5.900571 6.211067 1.233968 0.8012439 $out [1] 27.4 -14.3 -27.9 -13.5 12.3 $group [1] 1 3 5 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" Warning message: In bxp(list(stats = c(-5.5, -3, 1.6, 6.85, 10.5, -9.09999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6pooq1387018950.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] [,10] [,11] [1,] 55.7 62.80 80.40 101.40 91.80 89.30 80.30 81.70 113.80 133.60 125.10 [2,] 59.5 70.35 82.75 108.80 114.75 92.45 85.40 84.35 121.10 140.95 128.05 [3,] 61.6 80.90 85.90 123.20 133.60 93.30 87.70 86.80 132.50 145.50 130.10 [4,] 65.0 83.45 87.25 141.85 147.20 98.55 92.35 89.15 142.15 149.00 131.25 [5,] 67.0 86.40 87.50 149.60 157.00 101.00 95.50 90.90 149.40 154.40 132.30 [,12] [,13] [1,] 152.5 NA [2,] 154.3 NA [3,] 156.2 NA [4,] 158.6 NA [5,] 163.2 NA $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 58.31549 73.07689 83.21267 103.4631 114.2214 89.65718 83.54957 83.93352 [2,] 64.88451 88.72311 88.58733 142.9369 152.9786 96.94282 91.85043 89.66648 [,9] [,10] [,11] [,12] [,13] [1,] 119.9293 140.6927 128.189 153.6321 NA [2,] 145.0707 150.3073 132.011 158.7679 NA $out [1] 99.7 101.5 128.7 $group [1] 3 8 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" NA Warning message: In bxp(list(stats = c(55.7, 59.5, 61.6, 65, 67, 62.8, 70.35, 80.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/75k5y1387018950.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,] 103.6833 95.35 107.6875 [2,] 107.6417 100.10 108.1312 [3,] 109.4167 100.95 109.8250 [4,] 111.9250 105.95 112.3687 [5,] 112.4333 111.00 117.7250 $n [1] 7 7 7 $conf [,1] [,2] [,3] [1,] 106.8587 97.45647 107.2944 [2,] 111.9746 104.44353 112.3556 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(103.683333333333, 107.641666666667, 109.416666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ejp21387018950.ps tmp/1ejp21387018950.png",intern=TRUE)) character(0) > try(system("convert tmp/2cml01387018950.ps tmp/2cml01387018950.png",intern=TRUE)) character(0) > try(system("convert tmp/3qloi1387018950.ps tmp/3qloi1387018950.png",intern=TRUE)) character(0) > try(system("convert tmp/4n1bh1387018950.ps tmp/4n1bh1387018950.png",intern=TRUE)) character(0) > try(system("convert tmp/5b02w1387018950.ps tmp/5b02w1387018950.png",intern=TRUE)) character(0) > try(system("convert tmp/6pooq1387018950.ps tmp/6pooq1387018950.png",intern=TRUE)) character(0) > try(system("convert tmp/75k5y1387018950.ps tmp/75k5y1387018950.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.941 1.408 7.337