R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(11201,7804,8918,7874,8374,9099,7860,8000,7930,9079,8620,2513,13991,10095,11445,8792,8716,9607,7843,7221,8242,8839,6874,2478,11351,6480,6809,5464,4791,5179,4605,3809,5366,4402,4225,1719,7064,4820,6150,4971,4295,5713,4588,4253,5275,5114,5450,2088,9228,6060,7322,6147,6102,5988,5095,4971,5883,6211,6352,2581,9787,6187,7456,5127,5615,6243,5161,5439,4939,5349,4959,3080,7695,4965,6179,5166,5012,5094,4855,4272,4658,5146,5346,6009) > 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,] 11201 13991 11351 7064 9228 9787 7695 NA [2,] 7804 10095 6480 4820 6060 6187 4965 NA [3,] 8918 11445 6809 6150 7322 7456 6179 NA [4,] 7874 8792 5464 4971 6147 5127 5166 NA [5,] 8374 8716 4791 4295 6102 5615 5012 NA [6,] 9099 9607 5179 5713 5988 6243 5094 NA [7,] 7860 7843 4605 4588 5095 5161 4855 NA [8,] 8000 7221 3809 4253 4971 5439 4272 NA [9,] 7930 8242 5366 5275 5883 4939 4658 NA [10,] 9079 8839 4402 5114 6211 5349 5146 NA [11,] 8620 6874 4225 5450 6352 4959 5346 NA [12,] 2513 2478 1719 2088 2581 3080 6009 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -3397 -3896 -4871 -2244 -3168 -3600 -2730 NA [2,] 1114 1350 329 1330 1262 1269 1214 NA [3,] -1044 -2653 -1345 -1179 -1175 -2329 -1013 NA [4,] 500 -76 -673 -676 -45 488 -154 NA [5,] 725 891 388 1418 -114 628 82 NA [6,] -1239 -1764 -574 -1125 -893 -1082 -239 NA [7,] 140 -622 -796 -335 -124 278 -583 NA [8,] -70 1021 1557 1022 912 -500 386 NA [9,] 1149 597 -964 -161 328 410 488 NA [10,] -459 -1965 -177 336 141 -390 200 NA [11,] -6107 -4396 -2506 -3362 -3771 -1879 663 NA [12,] 11478 8873 5345 7140 7206 4615 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/1rdaj1413574946.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/2hsbx1413574946.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/338vn1413574946.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/4imox1413574946.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] [1,] 7064.0 4820.0 6150 4971.0 4295.0 5094 4588 3809.0 4658.0 4402 4225.0 [2,] 8461.5 5512.5 6494 5146.5 4901.5 5446 4730 4262.5 5107.0 5130 5152.5 [3,] 9787.0 6187.0 7322 5464.0 5615.0 5988 5095 4971.0 5366.0 5349 5450.0 [4,] 11276.0 7142.0 8187 7010.5 7238.0 7671 6502 6330.0 6906.5 7525 6613.0 [5,] 13991.0 7804.0 8918 8792.0 8716.0 9607 7860 8000.0 8242.0 9079 8620.0 [,12] [1,] 1719.0 [2,] 2283.0 [3,] 2513.0 [4,] 2830.5 [5,] 3080.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 8106.226 5213.889 6310.968 4350.849 4219.68 4659.266 4036.79 3736.322 [2,] 11467.774 7160.111 8333.032 6577.151 7010.32 7316.734 6153.21 6205.678 [,9] [,10] [,11] [,12] [1,] 4291.368 3918.745 4577.813 2186.042 [2,] 6440.632 6779.255 6322.187 2839.958 $out [1] 10095 11445 6009 $group [1] 2 3 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(7064, 8461.5, 9787, 11276, 13991, 4820, 5512.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ytri1413574946.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,] -4871 1114.0 -2653.0 -676.0 -114 -1764.0 -796.0 -500.0 -161.0 -459.0 [2,] -3748 1164.0 -1837.0 -413.5 235 -1182.0 -602.5 158.0 83.5 -424.5 [3,] -3397 1262.0 -1179.0 -76.0 628 -1082.0 -335.0 912.0 410.0 -177.0 [4,] -2949 1299.5 -1109.5 221.5 808 -733.5 8.0 1021.5 542.5 170.5 [5,] -2244 1350.0 -1013.0 500.0 1418 -239.0 278.0 1557.0 1149.0 336.0 [,11] [,12] [1,] -6107.0 4615 [2,] -4083.5 5345 [3,] -3362.0 7173 [4,] -2192.5 8873 [5,] -1879.0 11478 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -3874.15 1181.082 -1613.4513 -455.2118 285.8136 -1349.837 -699.58075 [2,] -2919.85 1342.918 -744.5487 303.2118 970.1864 -814.163 29.58075 [,8] [,9] [,10] [,11] [,12] [1,] 396.3317 135.8926 -532.3244 -4491.275 4897.326 [2,] 1427.6683 684.1074 178.3244 -2232.725 9448.674 $out [1] 329 -964 -1965 663 $group [1] 2 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4871, -3748, -3397, -2949, -2244, 1114, 1164, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/66dud1413574946.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,] 7804.0 6874 3809.0 4253.0 4971.0 4939 4272.0 NA [2,] 7867.0 7532 4313.5 4441.5 5489.0 5043 4910.0 NA [3,] 8187.0 8754 4985.0 5042.5 6081.0 5394 5120.0 NA [4,] 8998.5 9851 5972.0 5581.5 6281.5 6215 5677.5 NA [5,] 9099.0 11445 6809.0 7064.0 7322.0 7456 6179.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7670.915 7696.289 4228.547 4522.538 5719.535 4859.443 4769.938 NA [2,] 8703.085 9811.711 5741.453 5562.462 6442.465 5928.557 5470.062 NA $out [1] 11201 2513 13991 2478 11351 1719 2088 9228 2581 9787 3080 7695 $group [1] 1 1 2 2 3 3 4 5 5 6 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(7804, 7867, 8187, 8998.5, 9099, 6874, 7532, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/75lrt1413574946.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,] 5423.571 4971.0 5296.250 [2,] 5845.214 5222.0 5749.375 [3,] 6174.714 5457.0 6074.125 [4,] 6666.714 6087.5 6443.000 [5,] 7754.143 7322.0 7340.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 5800.023 5062.24 5757.758 [2,] 6549.406 5851.76 6390.492 $out [1] 10045.29 2924.00 9787.00 2513.00 9868.75 2556.75 $group [1] 1 1 2 2 3 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(5423.57142857143, 5845.21428571429, 6174.71428571429, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1rdaj1413574946.ps tmp/1rdaj1413574946.png",intern=TRUE)) character(0) > try(system("convert tmp/2hsbx1413574946.ps tmp/2hsbx1413574946.png",intern=TRUE)) character(0) > try(system("convert tmp/338vn1413574946.ps tmp/338vn1413574946.png",intern=TRUE)) character(0) > try(system("convert tmp/4imox1413574946.ps tmp/4imox1413574946.png",intern=TRUE)) character(0) > try(system("convert tmp/5ytri1413574946.ps tmp/5ytri1413574946.png",intern=TRUE)) character(0) > try(system("convert tmp/66dud1413574946.ps tmp/66dud1413574946.png",intern=TRUE)) character(0) > try(system("convert tmp/75lrt1413574946.ps tmp/75lrt1413574946.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.599 0.459 3.083