R version 3.0.1 (2013-05-16) -- "Good Sport" 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(36439,36368,36290,36147,37615,37543,36439,35705,35777,35777,35848,35998,35998,35335,35043,35335,36368,36218,34822,33640,33419,32977,33276,33640,33497,33198,32614,33198,33718,33568,31873,31139,30405,29814,29743,30184,29593,29372,29151,30405,30548,29814,27826,26943,25547,24955,25247,25689,25689,25326,25247,26430,27385,26943,25468,24735,23189,22234,22968,23702,23702,22747,22676,23922,24735,24442,22968,22013,19947,19142,19434,20688,20759,18921,19584,21201,21935,21493,19506,18109,16492,15238,15751,16855,16563,14946,15459,17076,17960,17447,15459,14576,13251,11854,12075,13179,13322,11997,12218,14063,14504,13764,11042,9646,7801,5963,6554,7359,7217,5813,6625,8613,9496,9055,7288,5892,4417,2721,3021,3534) > 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,] 36439 35998 33497 29593 25689 23702 20759 16563 13322 7217 NA [2,] 36368 35335 33198 29372 25326 22747 18921 14946 11997 5813 NA [3,] 36290 35043 32614 29151 25247 22676 19584 15459 12218 6625 NA [4,] 36147 35335 33198 30405 26430 23922 21201 17076 14063 8613 NA [5,] 37615 36368 33718 30548 27385 24735 21935 17960 14504 9496 NA [6,] 37543 36218 33568 29814 26943 24442 21493 17447 13764 9055 NA [7,] 36439 34822 31873 27826 25468 22968 19506 15459 11042 7288 NA [8,] 35705 33640 31139 26943 24735 22013 18109 14576 9646 5892 NA [9,] 35777 33419 30405 25547 23189 19947 16492 13251 7801 4417 NA [10,] 35777 32977 29814 24955 22234 19142 15238 11854 5963 2721 NA [11,] 35848 33276 29743 25247 22968 19434 15751 12075 6554 3021 NA [12,] 35998 33640 30184 25689 23702 20688 16855 13179 7359 3534 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -71 -663 -299 -221 -363 -955 -1838 -1617 -1325 -1404 NA [2,] -78 -292 -584 -221 -79 -71 663 513 221 812 NA [3,] -143 292 584 1254 1183 1246 1617 1617 1845 1988 NA [4,] 1468 1033 520 143 955 813 734 884 441 883 NA [5,] -72 -150 -150 -734 -442 -293 -442 -513 -740 -441 NA [6,] -1104 -1396 -1695 -1988 -1475 -1474 -1987 -1988 -2722 -1767 NA [7,] -734 -1182 -734 -883 -733 -955 -1397 -883 -1396 -1396 NA [8,] 72 -221 -734 -1396 -1546 -2066 -1617 -1325 -1845 -1475 NA [9,] 0 -442 -591 -592 -955 -805 -1254 -1397 -1838 -1696 NA [10,] 71 299 -71 292 734 292 513 221 591 300 NA [11,] 150 364 441 442 734 1254 1104 1104 805 513 NA [12,] 0 -143 -591 0 0 71 -292 143 -142 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/15quf1376313440.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/2cm701376313440.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/3af8x1376313440.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/44t931376313440.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,] 7217.0 5813.0 6625.0 8613 9496 9055.0 7288 5892 4417 2721 3021 [2,] 16563.0 14946.0 15459.0 17076 17960 17447.0 15459 14576 13251 11854 12075 [3,] 24695.5 24036.5 23961.5 25176 26060 25692.5 24218 23374 21568 20688 21201 [4,] 33497.0 33198.0 32614.0 33198 33718 33568.0 31873 31139 30405 29814 29743 [5,] 36439.0 36368.0 36290.0 36147 37615 37543.0 36439 35705 35777 35777 35848 [,12] [1,] 3534 [2,] 13179 [3,] 22195 [4,] 30184 [5,] 35998 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 16234.6 14917.07 15390.18 17120.81 18186.67 17637.81 16016.91 15098.46 [2,] 33156.4 33155.93 32532.82 33231.19 33933.33 33747.19 32419.09 31649.54 [,9] [,10] [,11] [,12] [1,] 12997.18 11714.47 12373.36 13698.62 [2,] 30138.82 29661.53 30028.64 30691.38 $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(7217, 16563, 24695.5, 33497, 36439, 5813, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5owe71376313440.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,] -1838 -584.0 -143 143 -740.0 -2722 -1397 -2066.0 -1838 -71.0 150.0 -292 [2,] -1404 -221.0 584 520 -513.0 -1988 -1396 -1617.0 -1397 221.0 441.0 -143 [3,] -809 -74.5 1250 848 -441.5 -1731 -919 -1435.5 -880 295.5 623.5 0 [4,] -299 513.0 1617 955 -150.0 -1474 -734 -734.0 -591 513.0 1104.0 0 [5,] -71 812.0 1988 1468 -72.0 -1104 -733 72.0 0 734.0 1254.0 143 $n [1] 10 10 10 10 10 10 10 10 10 10 10 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -1361.1021 -441.2357 733.872 630.6567 -622.8693 -1987.815 -1249.7616 [2,] -256.8979 292.2357 1766.128 1065.3433 -260.1307 -1474.185 -588.2384 [,8] [,9] [,10] [,11] [,12] [1,] -1876.682 -1282.7097 149.6052 292.2388 -75.31333 [2,] -994.318 -477.2903 441.3948 954.7612 75.31333 $out [1] -591 $group [1] 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-1838, -1404, -809, -299, -71, -584, -221, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/68h651376313440.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] [1,] 35705.0 32977.0 29743.0 24955.0 22234.0 19142.0 15238.0 11854.0 5963.0 [2,] 35812.5 33529.5 30294.5 25618.0 23445.5 20317.5 16673.5 13215.0 7580.0 [3,] 36218.5 34932.5 32243.5 28488.5 25286.5 22711.5 19213.5 15202.5 11519.5 [4,] 36439.0 35666.5 33347.5 29703.5 26059.5 23812.0 20980.0 16819.5 13543.0 [5,] 36439.0 36368.0 33718.0 30548.0 27385.0 24735.0 21935.0 17960.0 14504.0 [,10] [,11] [1,] 2721.0 NA [2,] 3975.5 NA [3,] 6258.5 NA [4,] 7950.5 NA [5,] 9496.0 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 35932.75 33957.8 30851.01 26625.08 24094.24 21117.64 17249.28 13558.46 [2,] 36504.25 35907.2 33635.99 30351.92 26478.76 24305.36 21177.72 16846.54 [,9] [,10] [,11] [1,] 8799.736 4445.476 NA [2,] 14239.264 8071.524 NA $out [1] 37615 37543 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(35705, 35812.5, 36218.5, 36439, 36439, 32977, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7k0qn1376313440.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,] 20067.50 20688.00 20649.62 [2,] 21053.65 21881.50 21602.50 [3,] 23335.70 23999.00 23878.31 [4,] 24458.45 24935.75 25185.00 [5,] 25426.40 26060.00 25939.62 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 21782.75 22605.94 22244.31 [2,] 24888.65 25392.06 25512.31 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(20067.5, 21053.65, 23335.7, 24458.45, 25426.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15quf1376313440.ps tmp/15quf1376313440.png",intern=TRUE)) character(0) > try(system("convert tmp/2cm701376313440.ps tmp/2cm701376313440.png",intern=TRUE)) character(0) > try(system("convert tmp/3af8x1376313440.ps tmp/3af8x1376313440.png",intern=TRUE)) character(0) > try(system("convert tmp/44t931376313440.ps tmp/44t931376313440.png",intern=TRUE)) character(0) > try(system("convert tmp/5owe71376313440.ps tmp/5owe71376313440.png",intern=TRUE)) character(0) > try(system("convert tmp/68h651376313440.ps tmp/68h651376313440.png",intern=TRUE)) character(0) > try(system("convert tmp/7k0qn1376313440.ps tmp/7k0qn1376313440.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.032 0.910 4.933