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(193590,193745,193885,194040,194190,194345,194495,194650,194805,194955,195110,195260,195415,195570,195710,195865,196015,196170,196320,196475,196630,196780,196935,197085,197240,197395,197540,197695,197845,198000,198150,198305,198460,198610,198765,198915,199070,199225,199365,199520,199670,199825,199975,200130,200285,200435,200590,200740,200895,201050,201190,201345,201495,201650,201800,201955,202110,202260,202415,202565,202720,202875,203015,203170,203320,203475,203625,203780,203935,204085,204240,204390,204545,204700,204845,205000,205150,205305,205455,205610,205765,205915,206070,206220,206375,206530,206670,206825,206975,207130,207280,207435,207590,207740,207895,208045,208200,208355,208495,208650,208800,208955,209105,209260,209415,209565,209720,209870) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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] 9 9 9 9 9 9 9 9 9 9 9 9 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 193590 195415 197240 199070 200895 202720 204545 206375 208200 NA [2,] 193745 195570 197395 199225 201050 202875 204700 206530 208355 NA [3,] 193885 195710 197540 199365 201190 203015 204845 206670 208495 NA [4,] 194040 195865 197695 199520 201345 203170 205000 206825 208650 NA [5,] 194190 196015 197845 199670 201495 203320 205150 206975 208800 NA [6,] 194345 196170 198000 199825 201650 203475 205305 207130 208955 NA [7,] 194495 196320 198150 199975 201800 203625 205455 207280 209105 NA [8,] 194650 196475 198305 200130 201955 203780 205610 207435 209260 NA [9,] 194805 196630 198460 200285 202110 203935 205765 207590 209415 NA [10,] 194955 196780 198610 200435 202260 204085 205915 207740 209565 NA [11,] 195110 196935 198765 200590 202415 204240 206070 207895 209720 NA [12,] 195260 197085 198915 200740 202565 204390 206220 208045 209870 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 155 155 155 155 155 155 155 155 155 NA [2,] 140 140 145 140 140 140 145 140 140 NA [3,] 155 155 155 155 155 155 155 155 155 NA [4,] 150 150 150 150 150 150 150 150 150 NA [5,] 155 155 155 155 155 155 155 155 155 NA [6,] 150 150 150 150 150 150 150 150 150 NA [7,] 155 155 155 155 155 155 155 155 155 NA [8,] 155 155 155 155 155 155 155 155 155 NA [9,] 150 150 150 150 150 150 150 150 150 NA [10,] 155 155 155 155 155 155 155 155 155 NA [11,] 150 150 150 150 150 150 150 150 150 NA [12,] 155 155 155 155 155 155 155 155 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/1w5j21439765506.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/2lzpc1439765506.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/33vbq1439765506.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/4f52d1439765506.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] [1,] 193590 193745 193885 194040 194190 194345 194495 194650 194805 194955 [2,] 197240 197395 197540 197695 197845 198000 198150 198305 198460 198610 [3,] 200895 201050 201190 201345 201495 201650 201800 201955 202110 202260 [4,] 204545 204700 204845 205000 205150 205305 205455 205610 205765 205915 [5,] 208200 208355 208495 208650 208800 208955 209105 209260 209415 209565 [,11] [,12] [1,] 195110 195260 [2,] 198765 198915 [3,] 202415 202565 [4,] 206070 206220 [5,] 209720 209870 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 197047.7 197202.7 197342.7 197497.7 197647.7 197802.7 197952.7 198107.7 [2,] 204742.3 204897.3 205037.3 205192.3 205342.3 205497.3 205647.3 205802.3 [,9] [,10] [,11] [,12] [1,] 198262.7 198412.7 198567.7 198717.7 [2,] 205957.3 206107.3 206262.3 206412.3 $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(193590, 197240, 200895, 204545, 208200, 193745, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5bd191439765506.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,] 155 140 155 150 155 150 155 155 150 155 150 155 [2,] 155 140 155 150 155 150 155 155 150 155 150 155 [3,] 155 140 155 150 155 150 155 155 150 155 150 155 [4,] 155 140 155 150 155 150 155 155 150 155 150 155 [5,] 155 140 155 150 155 150 155 155 150 155 150 155 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 155 140 155 150 155 150 155 155 150 155 150 155 [2,] 155 140 155 150 155 150 155 155 150 155 150 155 $out [1] 145 145 $group [1] 2 2 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6fgki1439765506.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,] 193590.0 195415.0 197240.0 199070.0 200895.0 202720.0 204545.0 206375.0 [2,] 193962.5 195787.5 197617.5 199442.5 201267.5 203092.5 204922.5 206747.5 [3,] 194420.0 196245.0 198075.0 199900.0 201725.0 203550.0 205380.0 207205.0 [4,] 194880.0 196705.0 198535.0 200360.0 202185.0 204010.0 205840.0 207665.0 [5,] 195260.0 197085.0 198915.0 200740.0 202565.0 204390.0 206220.0 208045.0 [,9] [,10] [1,] 208200.0 NA [2,] 208572.5 NA [3,] 209030.0 NA [4,] 209490.0 NA [5,] 209870.0 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 194001.5 195826.5 197656.5 199481.5 201306.5 203131.5 204961.5 206786.5 [2,] 194838.5 196663.5 198493.5 200318.5 202143.5 203968.5 205798.5 207623.5 [,9] [,10] [1,] 208611.5 NA [2,] 209448.5 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/76xii1439765506.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,] 200894.4 200895.0 200892.5 [2,] 201268.1 201267.5 201270.0 [3,] 201725.6 201725.0 201727.5 [4,] 202185.6 202185.0 202187.5 [5,] 202565.6 202565.0 202567.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 201307.1 201306.5 201309 [2,] 202144.0 202143.5 202146 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1w5j21439765506.ps tmp/1w5j21439765506.png",intern=TRUE)) character(0) > try(system("convert tmp/2lzpc1439765506.ps tmp/2lzpc1439765506.png",intern=TRUE)) character(0) > try(system("convert tmp/33vbq1439765506.ps tmp/33vbq1439765506.png",intern=TRUE)) character(0) > try(system("convert tmp/4f52d1439765506.ps tmp/4f52d1439765506.png",intern=TRUE)) character(0) > try(system("convert tmp/5bd191439765506.ps tmp/5bd191439765506.png",intern=TRUE)) character(0) > try(system("convert tmp/6fgki1439765506.ps tmp/6fgki1439765506.png",intern=TRUE)) character(0) > try(system("convert tmp/76xii1439765506.ps tmp/76xii1439765506.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.539 0.472 3.035