R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(104.42,104.42,104.42,104.42,104.42,104.42,104.42,104.44,104.44,104.44,105.19,105.19,105.19,106.38,106.38,106.38,106.38,106.38,106.38,106.72,106.73,106.72,108.6,108.6,109.65,109.65,109.65,109.65,109.65,109.65,109.65,109.65,112.27,112.27,112.27,112.27,112.27,114.98,114.98,114.98,114.98,114.98,114.98,116.04,116.59,116.59,116.59,116.59,118.75,118.75,118.75,118.75,118.75,118.75,118.75,119.31,119.31,119.31,119.31,119.31) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 104.42 105.19 109.65 112.27 118.75 NA [2,] 104.42 106.38 109.65 114.98 118.75 NA [3,] 104.42 106.38 109.65 114.98 118.75 NA [4,] 104.42 106.38 109.65 114.98 118.75 NA [5,] 104.42 106.38 109.65 114.98 118.75 NA [6,] 104.42 106.38 109.65 114.98 118.75 NA [7,] 104.42 106.38 109.65 114.98 118.75 NA [8,] 104.44 106.72 109.65 116.04 119.31 NA [9,] 104.44 106.73 112.27 116.59 119.31 NA [10,] 104.44 106.72 112.27 116.59 119.31 NA [11,] 105.19 108.60 112.27 116.59 119.31 NA [12,] 105.19 108.60 112.27 116.59 119.31 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.00 1.19 0.00 2.71 0.00 NA [2,] 0.00 0.00 0.00 0.00 0.00 NA [3,] 0.00 0.00 0.00 0.00 0.00 NA [4,] 0.00 0.00 0.00 0.00 0.00 NA [5,] 0.00 0.00 0.00 0.00 0.00 NA [6,] 0.00 0.00 0.00 0.00 0.00 NA [7,] 0.02 0.34 0.00 1.06 0.56 NA [8,] 0.00 0.01 2.62 0.55 0.00 NA [9,] 0.00 -0.01 0.00 0.00 0.00 NA [10,] 0.75 1.88 0.00 0.00 0.00 NA [11,] 0.00 0.00 0.00 0.00 0.00 NA [12,] 0.00 1.05 0.00 2.16 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/www/rcomp/tmp/1zq8m1337704539.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/www/rcomp/tmp/2hw531337704539.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/www/rcomp/tmp/35dy21337704539.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/www/rcomp/tmp/43xxx1337704539.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,] 104.42 104.42 104.42 104.42 104.42 104.42 104.42 104.44 104.44 104.44 [2,] 105.19 106.38 106.38 106.38 106.38 106.38 106.38 106.72 106.73 106.72 [3,] 109.65 109.65 109.65 109.65 109.65 109.65 109.65 109.65 112.27 112.27 [4,] 112.27 114.98 114.98 114.98 114.98 114.98 114.98 116.04 116.59 116.59 [5,] 118.75 118.75 118.75 118.75 118.75 118.75 118.75 119.31 119.31 119.31 [,11] [,12] [1,] 105.19 105.19 [2,] 108.60 108.60 [3,] 112.27 112.27 [4,] 116.59 116.59 [5,] 119.31 119.31 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 104.6473 103.5733 103.5733 103.5733 103.5733 103.5733 103.5733 103.0645 [2,] 114.6527 115.7267 115.7267 115.7267 115.7267 115.7267 115.7267 116.2355 [,9] [,10] [,11] [,12] [1,] 105.3029 105.2959 106.6243 106.6243 [2,] 119.2371 119.2441 117.9157 117.9157 $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(104.42, 105.19, 109.65, 112.27, 118.75, 104.42, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/58l3j1337704539.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.00 0 0 0 0 0 0.00 0.00 0 0.00 0 0.000 [2,] 0.00 0 0 0 0 0 0.02 0.00 0 0.00 0 0.000 [3,] 0.00 0 0 0 0 0 0.34 0.01 0 0.00 0 0.525 [4,] 1.19 0 0 0 0 0 0.56 0.55 0 0.75 0 1.605 [5,] 2.71 0 0 0 0 0 1.06 0.55 0 0.75 0 2.160 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -0.840851 0 0 0 0 0 -0.04156264 -0.3786286 0 -0.5299481 [2,] 0.840851 0 0 0 0 0 0.72156264 0.3986286 0 0.5299481 [,11] [,12] [1,] 0 -0.74295 [2,] 0 1.79295 $out [1] 2.62 -0.01 1.88 $group [1] 8 9 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0, 0, 1.19000000000000, 2.71000000000001, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6s1u11337704539.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] [1,] 104.42 106.380 109.65 114.98 118.75 NA [2,] 104.42 106.380 109.65 114.98 118.75 NA [3,] 104.42 106.380 109.65 114.98 118.75 NA [4,] 104.44 106.725 112.27 116.59 119.31 NA [5,] 104.44 106.730 112.27 116.59 119.31 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 104.4109 106.2226 108.455 114.2457 118.4946 NA [2,] 104.4291 106.5374 110.845 115.7143 119.0054 NA $out [1] 105.19 105.19 105.19 108.60 108.60 112.27 $group [1] 1 1 2 2 2 4 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(104.42, 104.42, 104.42, 104.44, 104.44, 106.38, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/7uarc1337704539.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,] 110.056 109.65 110.6800 [2,] 110.836 109.65 110.6800 [3,] 110.836 109.65 110.6800 [4,] 111.867 112.27 111.6575 [5,] 112.392 112.27 112.5950 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 110.3658 108.455 110.2342 [2,] 111.3062 110.845 111.1258 $out [1] 108.73 $group [1] 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(110.056, 110.836, 110.836, 111.867, 112.392, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zq8m1337704539.ps tmp/1zq8m1337704539.png",intern=TRUE)) character(0) > try(system("convert tmp/2hw531337704539.ps tmp/2hw531337704539.png",intern=TRUE)) character(0) > try(system("convert tmp/35dy21337704539.ps tmp/35dy21337704539.png",intern=TRUE)) character(0) > try(system("convert tmp/43xxx1337704539.ps tmp/43xxx1337704539.png",intern=TRUE)) character(0) > try(system("convert tmp/58l3j1337704539.ps tmp/58l3j1337704539.png",intern=TRUE)) character(0) > try(system("convert tmp/6s1u11337704539.ps tmp/6s1u11337704539.png",intern=TRUE)) character(0) > try(system("convert tmp/7uarc1337704539.ps tmp/7uarc1337704539.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.690 0.990 2.702