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(56,55,54,52,72,71,56,46,47,47,48,50,44,38,33,33,52,54,39,22,31,31,38,42,41,31,36,34,51,47,31,19,30,33,36,40,32,25,28,29,55,55,40,38,44,41,49,59,61,47,43,39,66,68,63,68,67,59,68,78,82,70,62,68,94,102,100,104,103,93,110,114,120,102,95,103,122,139,135,135,137,130,148,148,145,128,131,133,146,163,151,157,152,149,172,167,160,150,160,165,171,179,171,176,170,169,194,196,188,174,186,191,197,206,197,204,201,190,213,213) > 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] 120 > (np <- floor(n / par1)) [1] 10 > 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] 10 10 10 10 10 10 10 10 10 10 10 10 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 56 44 41 32 61 82 120 145 160 188 NA [2,] 55 38 31 25 47 70 102 128 150 174 NA [3,] 54 33 36 28 43 62 95 131 160 186 NA [4,] 52 33 34 29 39 68 103 133 165 191 NA [5,] 72 52 51 55 66 94 122 146 171 197 NA [6,] 71 54 47 55 68 102 139 163 179 206 NA [7,] 56 39 31 40 63 100 135 151 171 197 NA [8,] 46 22 19 38 68 104 135 157 176 204 NA [9,] 47 31 30 44 67 103 137 152 170 201 NA [10,] 47 31 33 41 59 93 130 149 169 190 NA [11,] 48 38 36 49 68 110 148 172 194 213 NA [12,] 50 42 40 59 78 114 148 167 196 213 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -1 -6 -10 -7 -14 -12 -18 -17 -10 -14 NA [2,] -1 -5 5 3 -4 -8 -7 3 10 12 NA [3,] -2 0 -2 1 -4 6 8 2 5 5 NA [4,] 20 19 17 26 27 26 19 13 6 6 NA [5,] -1 2 -4 0 2 8 17 17 8 9 NA [6,] -15 -15 -16 -15 -5 -2 -4 -12 -8 -9 NA [7,] -10 -17 -12 -2 5 4 0 6 5 7 NA [8,] 1 9 11 6 -1 -1 2 -5 -6 -3 NA [9,] 0 0 3 -3 -8 -10 -7 -3 -1 -11 NA [10,] 1 7 3 8 9 17 18 23 25 23 NA [11,] 2 4 4 10 10 4 0 -5 2 0 NA [12,] -6 -1 -8 2 4 6 -3 -7 -8 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/1k2001387554394.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/2045r1387554394.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/3h1d41387554394.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/4wm9w1387554394.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,] 32.0 25.0 28 29 51 47.0 31.0 19 30 31 36 40 [2,] 44.0 38.0 36 34 55 55.0 40.0 38 44 41 48 50 [3,] 71.5 62.5 58 60 83 86.5 81.5 86 85 76 89 96 [4,] 145.0 128.0 131 133 146 163.0 151.0 157 152 149 172 167 [5,] 188.0 174.0 186 191 197 206.0 197.0 204 201 190 213 213 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 21.03637 17.53241 10.53421 10.53565 37.53277 32.53889 26.03997 [2,] 121.96363 107.46759 105.46579 109.46435 128.46723 140.46111 136.96003 [,8] [,9] [,10] [,11] [,12] [1,] 26.54286 31.03889 22.03889 27.04466 37.54214 [2,] 145.45714 138.96111 129.96111 150.95534 154.45786 $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(32, 44, 71.5, 145, 188, 25, 38, 62.5, 128, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/564ds1387554394.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,] -18 -8 -4.0 6 -4 -16.0 -17 -6 -11 1 -5 -8 [2,] -14 -5 -2.0 13 0 -15.0 -10 -3 -8 7 0 -7 [3,] -11 1 1.5 19 5 -10.5 2 0 -3 13 3 -3 [4,] -7 5 5.0 26 9 -5.0 5 6 0 23 4 2 [5,] -1 12 8.0 27 17 -2.0 7 11 3 25 10 6 $n [1] 10 10 10 10 10 10 10 10 10 10 10 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -14.497479 -3.996399 -1.997479 12.50468 0.5032412 -15.496399 -5.494598 [2,] -7.502521 5.996399 4.997479 25.49532 9.4967588 -5.503601 9.494598 [,8] [,9] [,10] [,11] [,12] [1,] -4.496759 -6.997119 5.005762 1.001441 -7.74 [2,] 4.496759 0.997119 20.994238 4.998559 1.74 $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(-18, -14, -11, -7, -1, -8, -5, 1, 5, 12, -4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jggz1387554394.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,] 46.0 22 19.0 25.0 39.0 62.0 95.0 128 150.0 174 NA [2,] 47.5 32 31.0 30.5 53.0 76.0 111.5 139 162.5 189 NA [3,] 53.0 38 35.0 40.5 64.5 97.0 132.5 150 170.5 197 NA [4,] 56.0 43 40.5 52.0 68.0 103.5 138.0 160 177.5 205 NA [5,] 56.0 54 51.0 59.0 78.0 114.0 148.0 172 196.0 213 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 49.12309 32.98283 30.66699 30.69371 57.6584 84.45707 120.4132 140.4218 [2,] 56.87691 43.01717 39.33301 50.30629 71.3416 109.54293 144.5868 159.5782 [,9] [,10] [,11] [1,] 163.6584 189.7023 NA [2,] 177.3416 204.2977 NA $out [1] 72 71 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(46, 47.5, 53, 56, 56, 22, 32, 38, 43, 54, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/76toq1387554394.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,] 82.00 58.00 79.875 [2,] 88.80 67.00 86.875 [3,] 97.55 82.25 95.625 [4,] 105.10 86.25 103.000 [5,] 110.70 96.00 107.625 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 90.11546 73.46995 88.27028 [2,] 104.98454 91.03005 102.97972 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(82, 88.8, 97.55, 105.1, 110.7, 58, 67, 82.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1k2001387554394.ps tmp/1k2001387554394.png",intern=TRUE)) character(0) > try(system("convert tmp/2045r1387554394.ps tmp/2045r1387554394.png",intern=TRUE)) character(0) > try(system("convert tmp/3h1d41387554394.ps tmp/3h1d41387554394.png",intern=TRUE)) character(0) > try(system("convert tmp/4wm9w1387554394.ps tmp/4wm9w1387554394.png",intern=TRUE)) character(0) > try(system("convert tmp/564ds1387554394.ps tmp/564ds1387554394.png",intern=TRUE)) character(0) > try(system("convert tmp/6jggz1387554394.ps tmp/6jggz1387554394.png",intern=TRUE)) character(0) > try(system("convert tmp/76toq1387554394.ps tmp/76toq1387554394.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.681 1.416 8.044