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(100.8,100.9,101.5,101.8,102.3,102.7,103.3,104.3,103.9,104.1,104.5,104,105.3,105.3,105.7,105.7,105.3,105.6,106.5,107,106.6,106.4,105.6,105.8,106.3,105.2,104.1,103.4,102.6,101.6,101.7,101,100.7,100.8,100.3,99.8,100,100.3,100.1,100.8,100.1,99.9,100.5,100.6,99.9,99.5,99.2,98.9,98.8,98.4,98.9,98.4,98.3,98.1,98.2,97.6,96.8,96.6,96,94.9,95.2,95,93.7,92.9,92.3,93.2,89.6,89.2,88.7,88.4,88.9,88.3,85.8,86.8,86.9,85.7,84.5,84,85,85.2,85,84.8,84.5,85) > 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,] 100.8 105.3 106.3 100.0 98.8 95.2 85.8 NA [2,] 100.9 105.3 105.2 100.3 98.4 95.0 86.8 NA [3,] 101.5 105.7 104.1 100.1 98.9 93.7 86.9 NA [4,] 101.8 105.7 103.4 100.8 98.4 92.9 85.7 NA [5,] 102.3 105.3 102.6 100.1 98.3 92.3 84.5 NA [6,] 102.7 105.6 101.6 99.9 98.1 93.2 84.0 NA [7,] 103.3 106.5 101.7 100.5 98.2 89.6 85.0 NA [8,] 104.3 107.0 101.0 100.6 97.6 89.2 85.2 NA [9,] 103.9 106.6 100.7 99.9 96.8 88.7 85.0 NA [10,] 104.1 106.4 100.8 99.5 96.6 88.4 84.8 NA [11,] 104.5 105.6 100.3 99.2 96.0 88.9 84.5 NA [12,] 104.0 105.8 99.8 98.9 94.9 88.3 85.0 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.1 0.0 -1.1 0.3 -0.4 -0.2 1.0 NA [2,] 0.6 0.4 -1.1 -0.2 0.5 -1.3 0.1 NA [3,] 0.3 0.0 -0.7 0.7 -0.5 -0.8 -1.2 NA [4,] 0.5 -0.4 -0.8 -0.7 -0.1 -0.6 -1.2 NA [5,] 0.4 0.3 -1.0 -0.2 -0.2 0.9 -0.5 NA [6,] 0.6 0.9 0.1 0.6 0.1 -3.6 1.0 NA [7,] 1.0 0.5 -0.7 0.1 -0.6 -0.4 0.2 NA [8,] -0.4 -0.4 -0.3 -0.7 -0.8 -0.5 -0.2 NA [9,] 0.2 -0.2 0.1 -0.4 -0.2 -0.3 -0.2 NA [10,] 0.4 -0.8 -0.5 -0.3 -0.6 0.5 -0.3 NA [11,] -0.5 0.2 -0.5 -0.3 -1.1 -0.6 0.5 NA [12,] 1.3 0.5 0.2 -0.1 0.3 -2.5 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/16tkk1424983399.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/2jfrl1424983399.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/3wf0l1424983399.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/4rjsv1424983399.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,] 95.20 95.00 86.9 85.70 92.30 93.20 85.0 85.20 85.00 84.80 84.50 [2,] 97.00 96.70 96.3 95.65 95.30 95.65 93.9 93.40 92.75 92.50 92.45 [3,] 100.00 100.30 100.1 100.80 100.10 99.90 100.5 100.60 99.90 99.50 99.20 [4,] 103.05 103.05 102.8 102.60 102.45 102.15 102.5 102.65 102.30 102.45 102.40 [5,] 106.30 105.30 105.7 105.70 105.30 105.60 106.5 107.00 106.60 106.40 105.60 [,12] [1,] 85.0 [2,] 91.6 [3,] 98.9 [4,] 101.9 [5,] 105.8 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.38704 96.50788 96.2183 96.64957 95.83014 96.0183 95.36422 [2,] 103.61296 104.09212 103.9817 104.95043 104.36986 103.7817 105.63578 [,8] [,9] [,10] [,11] [,12] [1,] 95.07605 94.19689 93.55802 93.25802 92.74901 [2,] 106.12395 105.60311 105.44198 105.14198 105.05099 $out [1] 85.8 86.8 84.5 84.0 $group [1] 1 2 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(95.2, 97, 100, 103.05, 106.3, 95, 96.7, 100.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/50p5x1424983399.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,] -0.4 -1.30 -1.20 -1.20 -1.00 0.10 -0.70 -0.80 -0.40 -0.80 -1.10 -0.10 [2,] -0.3 -0.65 -0.75 -0.75 -0.35 0.10 -0.50 -0.60 -0.25 -0.55 -0.55 -0.10 [3,] 0.0 0.10 -0.50 -0.60 -0.20 0.60 0.10 -0.40 -0.20 -0.30 -0.50 0.25 [4,] 0.2 0.45 0.15 -0.25 0.35 0.75 0.35 -0.35 -0.05 0.05 -0.05 0.50 [5,] 0.3 0.60 0.70 -0.10 0.90 1.00 1.00 -0.20 0.20 0.50 0.50 1.30 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.2985919 -0.5569023 -1.03746548 -0.8985919 -0.6180287 0.2118305 [2,] 0.2985919 0.7569023 0.03746548 -0.3014081 0.2180287 0.9881695 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.4076063 -0.549296 -0.31943677 -0.65831032 -0.7985919 -0.1370194 [2,] 0.6076063 -0.250704 -0.08056323 0.05831032 -0.2014081 0.6370194 $out [1] -1.1 1.0 0.5 -3.6 -2.5 $group [1] 1 1 4 6 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.399999999999991, -0.299999999999997, 0, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6llvr1424983399.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,] 100.80 105.30 99.80 98.90 94.90 88.30 84.00 NA [2,] 101.65 105.45 100.75 99.70 96.70 88.80 84.65 NA [3,] 103.00 105.70 101.65 100.05 98.15 90.95 85.00 NA [4,] 104.05 106.45 103.75 100.40 98.40 93.45 85.75 NA [5,] 104.50 107.00 106.30 100.80 98.90 95.20 86.90 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 101.9053 105.2439 100.2817 99.73073 97.37462 88.8291 84.49828 NA [2,] 104.0947 106.1561 103.0183 100.36927 98.92538 93.0709 85.50172 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(100.8, 101.65, 103, 104.05, 104.5, 105.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7sli51424983399.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,] 96.67143 98.90 96.7500 [2,] 97.30000 99.70 97.5000 [3,] 97.85714 100.05 98.5375 [4,] 98.54286 100.40 99.3375 [5,] 98.88571 100.80 100.0250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 97.29027 99.73073 97.6994 [2,] 98.42402 100.36927 99.3756 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(96.6714285714286, 97.3, 97.8571428571429, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/16tkk1424983399.ps tmp/16tkk1424983399.png",intern=TRUE)) character(0) > try(system("convert tmp/2jfrl1424983399.ps tmp/2jfrl1424983399.png",intern=TRUE)) character(0) > try(system("convert tmp/3wf0l1424983399.ps tmp/3wf0l1424983399.png",intern=TRUE)) character(0) > try(system("convert tmp/4rjsv1424983399.ps tmp/4rjsv1424983399.png",intern=TRUE)) character(0) > try(system("convert tmp/50p5x1424983399.ps tmp/50p5x1424983399.png",intern=TRUE)) character(0) > try(system("convert tmp/6llvr1424983399.ps tmp/6llvr1424983399.png",intern=TRUE)) character(0) > try(system("convert tmp/7sli51424983399.ps tmp/7sli51424983399.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.529 0.492 3.040