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(280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710,295881,293299,288576,286445,297584,300431,298522,292213,285383,277537,277891,302686,300653,296369,287224,279998,283495,285775,282329,277799,271980,266730,262433,285378,286692,282917,277686,274371,277466,290604,290770,283654,278601,274405,272817,294292,300562,298982,296917,295008,297295) > 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,] 280190 269034 248541 264319 300431 285775 290604 NA [2,] 280408 264176 245039 268347 298522 282329 290770 NA [3,] 276836 255198 237080 273046 292213 277799 283654 NA [4,] 275216 253353 237085 273963 285383 271980 278601 NA [5,] 274352 246057 225554 267430 277537 266730 274405 NA [6,] 271311 235372 226839 271993 277891 262433 272817 NA [7,] 289802 258556 247934 292710 302686 285378 294292 NA [8,] 290726 260993 248333 295881 300653 286692 300562 NA [9,] 292300 254663 246969 293299 296369 282917 298982 NA [10,] 278506 250643 245098 288576 287224 277686 296917 NA [11,] 269826 243422 246263 286445 279998 274371 295008 NA [12,] 265861 247105 255765 297584 283495 277466 297295 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 218 -4858 -3502 4028 -1909 -3446 166 NA [2,] -3572 -8978 -7959 4699 -6309 -4530 -7116 NA [3,] -1620 -1845 5 917 -6830 -5819 -5053 NA [4,] -864 -7296 -11531 -6533 -7846 -5250 -4196 NA [5,] -3041 -10685 1285 4563 354 -4297 -1588 NA [6,] 18491 23184 21095 20717 24795 22945 21475 NA [7,] 924 2437 399 3171 -2033 1314 6270 NA [8,] 1574 -6330 -1364 -2582 -4284 -3775 -1580 NA [9,] -13794 -4020 -1871 -4723 -9145 -5231 -2065 NA [10,] -8680 -7221 1165 -2131 -7226 -3315 -1909 NA [11,] -3965 3683 9502 11139 3497 3095 2287 NA [12,] 3173 1436 8554 2847 2280 13138 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/1dh2j1387726178.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/2pmc91387726178.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/3qo8x1387726178.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/4ltqr1387726178.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] [1,] 248541.0 245039.0 255198.0 253353.0 246057.0 226839.0 247934 248333.0 [2,] 266676.5 266261.5 264122.0 262666.5 256393.5 248902.5 271967 273842.5 [3,] 280190.0 280408.0 276836.0 273963.0 267430.0 271311.0 289802 290726.0 [4,] 288189.5 286549.5 280726.5 276908.5 274378.5 272405.0 293501 298221.5 [5,] 300431.0 298522.0 292213.0 285383.0 277537.0 277891.0 302686 300653.0 [,9] [,10] [,11] [,12] [1,] 246969 245098.0 243422.0 247105 [2,] 268790 264164.5 258044.5 260813 [3,] 292300 278506.0 274371.0 277466 [4,] 294834 287900.0 283221.5 290395 [5,] 298982 296917.0 295008.0 297584 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 267342.8 268292.3 266920.1 265457.9 256689.6 257275.7 276942.2 276167.3 [2,] 293037.2 292523.7 286751.9 282468.1 278170.4 285346.3 302661.8 305284.7 [,9] [,10] [,11] [,12] [1,] 276746.9 264331.5 259335.7 259800.1 [2,] 307853.1 292680.5 289406.3 295131.9 $out [1] 237080 237085 225554 $group [1] 3 4 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(248541, 266676.5, 280190, 288189.5, 300431, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5j9pr1387726178.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] [1,] -4858 -8978.0 -6830.0 -11531 -4297.0 18491.0 -2033.0 -6330.0 -9145.0 [2,] -3474 -7537.5 -5436.0 -7571 -3669.0 20906.0 661.5 -4029.5 -7188.0 [3,] -1909 -6309.0 -1845.0 -6533 -1588.0 21475.0 1314.0 -2582.0 -4723.0 [4,] 192 -4051.0 -807.5 -4723 819.5 23064.5 2804.0 -1472.0 -3042.5 [5,] 4028 -3572.0 917.0 -864 4563.0 24795.0 3171.0 1574.0 -1871.0 [,10] [,11] [,12] [1,] -8680.0 2287.0 1436 [2,] -7223.5 2691.0 2280 [3,] -3315.0 3497.0 3010 [4,] -2020.0 6592.5 8554 [5,] 1165.0 11139.0 13138 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -4098.2761 -8391.082 -4609.0655 -8233.78 -4268.46 20185.98 34.53356 [2,] 280.2761 -4226.918 919.0655 -4832.22 1092.46 22764.02 2593.46644 [,8] [,9] [,10] [,11] [,12] [1,] -4109.298 -7198.626 -6422.4463 1167.087 -1036.933 [2,] -1054.702 -2247.374 -207.5537 5826.913 7056.933 $out [1] 4699 -10685 6270 -13794 -3965 $group [1] 2 5 7 9 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4858, -3474, -1909, 192, 4028, -8978, -7537.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6hbt81387726178.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,] 265861.0 235372.0 225554.0 264319.0 277537.0 262433.0 272817.0 NA [2,] 272831.5 246581.0 237082.5 270170.0 281746.5 273175.5 281127.5 NA [3,] 277671.0 254008.0 245680.5 280204.0 289718.5 277742.5 292531.0 NA [4,] 285105.0 259774.5 248133.5 293004.5 299476.5 284147.5 297106.0 NA [5,] 292300.0 269034.0 255765.0 297584.0 302686.0 286692.0 300562.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 272073 247990.4 240640.1 269789 281631.7 272738.1 285243.1 NA [2,] 283269 260025.6 250720.9 290619 297805.3 282746.9 299818.9 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(265861, 272831.5, 277671, 285105, 292300, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7qba91387726178.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,] 259808.0 267430 260653.8 [2,] 269351.0 274167 270210.2 [3,] 274944.4 277986 275818.1 [4,] 278885.2 285105 279622.5 [5,] 283405.7 292300 286032.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 270595.7 272997.1 271525.1 [2,] 279293.0 282974.9 280111.1 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(259808, 269351, 274944.357142857, 278885.214285714, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1dh2j1387726178.ps tmp/1dh2j1387726178.png",intern=TRUE)) character(0) > try(system("convert tmp/2pmc91387726178.ps tmp/2pmc91387726178.png",intern=TRUE)) character(0) > try(system("convert tmp/3qo8x1387726178.ps tmp/3qo8x1387726178.png",intern=TRUE)) character(0) > try(system("convert tmp/4ltqr1387726178.ps tmp/4ltqr1387726178.png",intern=TRUE)) character(0) > try(system("convert tmp/5j9pr1387726178.ps tmp/5j9pr1387726178.png",intern=TRUE)) character(0) > try(system("convert tmp/6hbt81387726178.ps tmp/6hbt81387726178.png",intern=TRUE)) character(0) > try(system("convert tmp/7qba91387726178.ps tmp/7qba91387726178.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.865 0.954 5.800