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(10320,11400,9360,10080,10080,10800,10320,9720,10440,11160,9480,11160,9840,11160,8760,10320,9600,10680,10200,10680,10200,12480,8880,11280,9480,11040,9240,9360,9240,10680,10680,10320,9960,12240,8880,11280,9360,10320,9840,9120,9360,10800,9840,11760,9960,11160,9240,11520,9000,10200,10200,9840,8760,11520,9120,11280,10560,10680,9960,10200,10200,10320,9600,10080,9120,10920,7800,11880,9360,10920,9840,9360,10680,9720,9960,10680,9120,10320,8040,11280,8880,11040,9600,9600,11040,9720,9480,10200,9360,10800,8520,11520,9120,11040,8880,9600,10440,8880,8520,10800,8880,10560,8400,12480,10560,10800,9840,8880) > 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,] 10320 9840 9480 9360 9000 10200 10680 11040 10440 NA [2,] 11400 11160 11040 10320 10200 10320 9720 9720 8880 NA [3,] 9360 8760 9240 9840 10200 9600 9960 9480 8520 NA [4,] 10080 10320 9360 9120 9840 10080 10680 10200 10800 NA [5,] 10080 9600 9240 9360 8760 9120 9120 9360 8880 NA [6,] 10800 10680 10680 10800 11520 10920 10320 10800 10560 NA [7,] 10320 10200 10680 9840 9120 7800 8040 8520 8400 NA [8,] 9720 10680 10320 11760 11280 11880 11280 11520 12480 NA [9,] 10440 10200 9960 9960 10560 9360 8880 9120 10560 NA [10,] 11160 12480 12240 11160 10680 10920 11040 11040 10800 NA [11,] 9480 8880 8880 9240 9960 9840 9600 8880 9840 NA [12,] 11160 11280 11280 11520 10200 9360 9600 9600 8880 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1080 1320 1560 960 1200 120 -960 -1320 -1560 NA [2,] -2040 -2400 -1800 -480 0 -720 240 -240 -360 NA [3,] 720 1560 120 -720 -360 480 720 720 2280 NA [4,] 0 -720 -120 240 -1080 -960 -1560 -840 -1920 NA [5,] 720 1080 1440 1440 2760 1800 1200 1440 1680 NA [6,] -480 -480 0 -960 -2400 -3120 -2280 -2280 -2160 NA [7,] -600 480 -360 1920 2160 4080 3240 3000 4080 NA [8,] 720 -480 -360 -1800 -720 -2520 -2400 -2400 -1920 NA [9,] 720 2280 2280 1200 120 1560 2160 1920 240 NA [10,] -1680 -3600 -3360 -1920 -720 -1080 -1440 -2160 -960 NA [11,] 1680 2400 2400 2280 240 -480 0 720 -960 NA [12,] -1320 -1800 -1920 -2520 0 1320 1440 840 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/1cyns1376488946.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/2lnic1376488946.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/3b9iw1376488946.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/4ck131376488946.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,] 9000 8880 8520 9120 8760 10560 7800 9720 8880 10680 8880 8880 [2,] 9480 9720 9240 9840 9120 10680 8400 10680 9360 10920 8880 9600 [3,] 10200 10320 9480 10080 9240 10800 9120 11280 9960 11040 9480 10200 [4,] 10440 11040 9840 10320 9360 10800 10200 11760 10440 11160 9840 11280 [5,] 11040 11400 10200 10800 9600 10920 10680 12480 10560 11160 9960 11520 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 9694.4 9624.8 9164 9827.2 9113.6 10736.8 8172 10711.2 9391.2 10913.6 [2,] 10705.6 11015.2 9796 10332.8 9366.4 10863.2 10068 11848.8 10528.8 11166.4 [,11] [,12] [1,] 8974.4 9315.2 [2,] 9985.6 11084.8 $out [1] 10080 11520 10320 12480 12240 $group [1] 5 6 6 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(9000, 9480, 10200, 10440, 11040, 8880, 9720, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/57lrs1376488946.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,] -1560 -2400 -720 -1920 720 -3120 -600 -2520 120 -3600 -960 -2520 [2,] -960 -1800 120 -1080 1200 -2280 480 -2400 720 -2160 0 -1860 [3,] 960 -480 720 -840 1440 -2160 2160 -1800 1560 -1680 720 -660 [4,] 1200 -240 720 -120 1680 -480 3240 -480 2160 -1080 2280 1080 [5,] 1560 240 1560 240 1800 0 4080 720 2280 -720 2400 1440 $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] [1,] -177.6 -1301.6 404 -1345.6 1187.2 -3108 706.4 -2811.2 801.6 -2248.8 [2,] 2097.6 341.6 1036 -334.4 1692.8 -1212 3613.6 -788.8 2318.4 -1111.2 [,11] [,12] [1,] -480.8 -2302.3262 [2,] 1920.8 982.3262 $out [1] 2280 2760 $group [1] 3 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-1560, -960, 960, 1200, 1560, -2400, -1800, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6l3a41376488946.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] [1,] 9360 8760 8880 9120 8760 7800 8040 8520 8400 NA [2,] 9900 9720 9300 9360 9480 9360 9360 9240 8880 NA [3,] 10320 10260 10140 9900 10200 9960 9840 9660 10140 NA [4,] 10980 10920 10860 10980 10620 10620 10680 10920 10680 NA [5,] 11400 12480 12240 11760 11520 11880 11280 11520 12480 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9827.405 9712.672 9428.474 9161.107 9680.038 9385.306 9237.939 [2,] 10812.595 10807.328 10851.526 10638.893 10719.962 10534.694 10442.061 [,8] [,9] [,10] [1,] 8893.741 9319.008 NA [2,] 10426.259 10960.992 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(9360, 9900, 10320, 10980, 11400, 8760, 9720, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7oocf1376488946.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,] 9213.333 9120 9240 [2,] 9420.000 9480 9450 [3,] 10046.667 10140 10020 [4,] 10553.333 10560 10590 [5,] 11280.000 11280 11220 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 9529.746 9647.405 9500.038 [2,] 10563.588 10632.595 10539.962 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(9213.33333333333, 9420, 10046.6666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1cyns1376488946.ps tmp/1cyns1376488946.png",intern=TRUE)) character(0) > try(system("convert tmp/2lnic1376488946.ps tmp/2lnic1376488946.png",intern=TRUE)) character(0) > try(system("convert tmp/3b9iw1376488946.ps tmp/3b9iw1376488946.png",intern=TRUE)) character(0) > try(system("convert tmp/4ck131376488946.ps tmp/4ck131376488946.png",intern=TRUE)) character(0) > try(system("convert tmp/57lrs1376488946.ps tmp/57lrs1376488946.png",intern=TRUE)) character(0) > try(system("convert tmp/6l3a41376488946.ps tmp/6l3a41376488946.png",intern=TRUE)) character(0) > try(system("convert tmp/7oocf1376488946.ps tmp/7oocf1376488946.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.550 0.971 5.512