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(9,13,12,5,13,11,8,8,8,8,0,3,0,-1,-1,-4,1,-1,0,-1,6,0,-3,-3,4,1,0,-4,-2,3,2,5,6,6,3,4,7,5,6,1,3,6,0,3,4,7,6,6,6,6,2,2,2,3,-1,-4,4,5,3,-1,-4,0,-1,-1,3,2,-4,-3,-1,3,-2,-10) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9 0 4 7 6 -4 NA [2,] 13 -1 1 5 6 0 NA [3,] 12 -1 0 6 2 -1 NA [4,] 5 -4 -4 1 2 -1 NA [5,] 13 1 -2 3 2 3 NA [6,] 11 -1 3 6 3 2 NA [7,] 8 0 2 0 -1 -4 NA [8,] 8 -1 5 3 -4 -3 NA [9,] 8 6 6 4 4 -1 NA [10,] 8 0 6 7 5 3 NA [11,] 0 -3 3 6 3 -2 NA [12,] 3 -3 4 6 -1 -10 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 4 -1 -3 -2 0 4 NA [2,] -1 0 -1 1 -4 -1 NA [3,] -7 -3 -4 -5 0 0 NA [4,] 8 5 2 2 0 4 NA [5,] -2 -2 5 3 1 -1 NA [6,] -3 1 -1 -6 -4 -6 NA [7,] 0 -1 3 3 -3 1 NA [8,] 0 7 1 1 8 2 NA [9,] 0 -6 0 3 1 4 NA [10,] -8 -3 -3 -1 -2 -5 NA [11,] 3 0 1 0 -4 -8 NA [12,] -3 7 3 0 -3 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/1va6s1381918439.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/2zr2s1381918439.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/3u5d91381918439.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/40pzz1381918439.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,] -4 -1 -1 -4 -2.0 -1 -4 -4 4 0.0 -3.0 -10 [2,] 0 0 -1 -4 1.0 2 -1 -3 4 3.0 -2.0 -3 [3,] 5 3 1 0 2.5 3 0 1 5 5.5 1.5 1 [4,] 7 6 6 2 3.0 6 2 5 6 7.0 3.0 4 [5,] 9 13 12 5 3.0 11 2 8 8 8.0 6.0 6 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.4847739 -0.8701938 -3.515226 -3.870194 1.209935 0.4198708 -1.935097 [2,] 9.5152261 6.8701938 5.515226 3.870194 3.790065 5.5801292 1.935097 [,8] [,9] [,10] [,11] [,12] [1,] -4.160258 3.709935 2.919871 -1.725161 -3.515226 [2,] 6.160258 6.290065 8.080129 4.725161 5.515226 $out [1] 13 8 -1 $group [1] 5 7 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4, 0, 5, 7, 9, -1, 0, 3, 6, 13, -1, -1, 1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/598s01381918439.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,] -3.0 -1 -7.0 0 -2 -6.0 -3.0 0.0 0.0 -8 -8 -3 [2,] -2.0 -1 -5.0 2 -2 -6.0 -1.0 1.0 0.0 -5 -4 -3 [3,] -0.5 -1 -3.5 3 0 -3.5 0.5 1.5 0.5 -3 0 0 [4,] 4.0 0 0.0 5 3 -1.0 3.0 7.0 3.0 -2 1 3 [5,] 4.0 1 0.0 8 5 1.0 3.0 8.0 4.0 -1 3 7 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -4.370194 -1.6450323 -6.7251615 1.064903 -3.225161 -6.7251615 -2.080129 [2,] 3.370194 -0.3549677 -0.2748385 4.935097 3.225161 -0.2748385 3.080129 [,8] [,9] [,10] [,11] [,12] [1,] -2.370194 -1.435097 -4.935097 -3.225161 -4.239585 [2,] 5.370194 2.435097 -1.064903 3.225161 4.239585 $out [1] -4 -6 $group [1] 2 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-3, -2, -0.5, 4, 4, -1, -1, -1, 0, 1, -7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6nho81381918439.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] [1,] 0.0 -4 -4.0 0.0 -4.0 -10.0 NA [2,] 6.5 -2 0.5 3.0 0.5 -3.5 NA [3,] 8.0 -1 3.0 5.5 2.5 -1.0 NA [4,] 11.5 0 4.5 6.0 4.5 1.0 NA [5,] 13.0 1 6.0 7.0 6.0 3.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 5.719466 -1.91221343 1.175573 4.13168 0.6755731 -3.05248 NA [2,] 10.280534 -0.08778657 4.824427 6.86832 4.3244269 1.05248 NA $out [1] 6 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(0, 6.5, 8, 11.5, 13, -4, -2, -1, 0, 1, -4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7dwzx1381918439.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,] -0.1666667 0.0 -0.7500 [2,] 1.0000000 1.0 0.6875 [3,] 3.1666667 2.0 2.1250 [4,] 4.0000000 4.0 3.8125 [5,] 4.8333333 5.5 5.1250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.798347 0.6316799 0.6996665 [2,] 4.534987 3.3683201 3.5503335 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(-0.166666666666667, 1, 3.16666666666667, 4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1va6s1381918439.ps tmp/1va6s1381918439.png",intern=TRUE)) character(0) > try(system("convert tmp/2zr2s1381918439.ps tmp/2zr2s1381918439.png",intern=TRUE)) character(0) > try(system("convert tmp/3u5d91381918439.ps tmp/3u5d91381918439.png",intern=TRUE)) character(0) > try(system("convert tmp/40pzz1381918439.ps tmp/40pzz1381918439.png",intern=TRUE)) character(0) > try(system("convert tmp/598s01381918439.ps tmp/598s01381918439.png",intern=TRUE)) character(0) > try(system("convert tmp/6nho81381918439.ps tmp/6nho81381918439.png",intern=TRUE)) character(0) > try(system("convert tmp/7dwzx1381918439.ps tmp/7dwzx1381918439.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.556 0.742 4.284