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(12.8,12.1,11.4,11.4,10.6,10.4,10.9,11.6,13.3,15.2,17.4,19.1,19.9,19.4,18.2,15.8,13.5,12.1,10.3,8.8,8.2,6.8,5.9,4.9,3.9,3.6,2.8,4,4.2,4.2,4.8,4,3.8,4,3.7,4,4.6,4.6,4.6,4.5,4.1,4.1,4.4,4.2,4.4,3.2,2.8,1.7,-0.2,-2.9,-5.2,-5.3,-4.8,-2.2,-0.8,-1.1,-1.5,-2,-2.8,-3.4,-4.1,-5.5,-8.6,-7.6,-8.6,-8.7,-4.6,-4.3,-1.5,1.2,1.8,0) > par1 = '4' > par1 <- '4' > #'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] 18 > 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] 18 18 18 18 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 12.8 10.6 13.3 19.9 13.5 8.2 3.9 4.2 3.8 4.6 4.1 4.4 -0.2 -4.8 [2,] 12.1 10.4 15.2 19.4 12.1 6.8 3.6 4.2 4.0 4.6 4.1 3.2 -2.9 -2.2 [3,] 11.4 10.9 17.4 18.2 10.3 5.9 2.8 4.8 3.7 4.6 4.4 2.8 -5.2 -0.8 [4,] 11.4 11.6 19.1 15.8 8.8 4.9 4.0 4.0 4.0 4.5 4.2 1.7 -5.3 -1.1 [,15] [,16] [,17] [,18] [,19] [1,] -1.5 -4.1 -8.6 -1.5 NA [2,] -2.0 -5.5 -8.7 1.2 NA [3,] -2.8 -8.6 -4.6 1.8 NA [4,] -3.4 -7.6 -4.3 0.0 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] -0.7 -0.2 1.9 -0.5 -1.4 -1.4 -0.3 0.0 0.2 0.0 0.0 -1.2 -2.7 2.6 [2,] -0.7 0.5 2.2 -1.2 -1.8 -0.9 -0.8 0.6 -0.3 0.0 0.3 -0.4 -2.3 1.4 [3,] 0.0 0.7 1.7 -2.4 -1.5 -1.0 1.2 -0.8 0.3 -0.1 -0.2 -1.1 -0.1 -0.3 [4,] -0.8 1.7 0.8 -2.3 -0.6 -1.0 0.2 -0.2 0.6 -0.4 0.2 -1.9 0.5 -0.4 [,15] [,16] [,17] [,18] [,19] [1,] -0.5 -1.4 -0.1 2.7 NA [2,] -0.8 -3.1 4.1 0.6 NA [3,] -0.6 1.0 0.3 -1.8 NA [4,] -0.7 -1.0 2.8 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/10ixs1424975097.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/2eazj1424975097.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/31bip1424975097.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/4xvq61424975097.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] [1,] -8.60 -8.70 -8.60 -7.6 [2,] -1.50 -2.00 -0.80 -1.1 [3,] 4.15 4.05 4.05 4.0 [4,] 10.60 10.40 10.30 8.8 [5,] 19.90 19.40 18.20 19.1 $n [1] 18 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] -0.3561558 -0.5678787 -0.08374624 0.3131452 [2,] 8.6561558 8.6678787 8.18374624 7.6868548 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/55qaw1424975097.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] [1,] -2.70 -3.10 -2.40 -2.3 [2,] -1.20 -0.90 -1.00 -0.8 [3,] -0.25 -0.35 -0.15 -0.4 [4,] 0.00 0.60 0.30 0.5 [5,] 0.20 2.20 1.70 1.7 $n [1] 18 18 18 17 $conf [,1] [,2] [,3] [,4] [1,] -0.6968915 -0.9086144 -0.6341324 -0.89816817 [2,] 0.1968915 0.2086144 0.3341324 0.09816817 $out [1] 1.9 2.6 2.7 4.1 2.8 $group [1] 1 1 1 2 4 $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(-2.7, -1.2, -0.25, 0, 0.2, -3.1, -0.899999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6wrwo1424975097.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] [,11] [,12] [,13] [1,] 11.40 10.40 13.30 15.80 8.80 4.90 2.80 4.0 3.70 4.50 4.10 1.70 -5.30 [2,] 11.40 10.50 14.25 17.00 9.55 5.40 3.20 4.1 3.75 4.55 4.10 2.25 -5.25 [3,] 11.75 10.75 16.30 18.80 11.20 6.35 3.75 4.2 3.90 4.60 4.15 3.00 -4.05 [4,] 12.45 11.25 18.25 19.65 12.80 7.50 3.95 4.5 4.00 4.60 4.30 3.80 -1.55 [5,] 12.80 11.60 19.10 19.90 13.50 8.20 4.00 4.8 4.00 4.60 4.40 4.40 -0.20 [,14] [,15] [,16] [,17] [,18] [,19] [1,] -4.80 -3.40 -8.60 -8.70 -1.50 NA [2,] -3.50 -3.10 -8.10 -8.65 -0.75 NA [3,] -1.65 -2.40 -6.55 -6.60 0.60 NA [4,] -0.95 -1.75 -4.80 -4.45 1.50 NA [5,] -0.80 -1.50 -4.10 -4.30 1.80 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 10.9205 10.1575 13.14 16.7065 8.6325 4.691 3.1575 3.884 3.7025 4.5605 [2,] 12.5795 11.3425 19.46 20.8935 13.7675 8.009 4.3425 4.516 4.0975 4.6395 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 3.992 1.7755 -6.973 -3.6645 -3.4665 -9.157 -9.918 -1.1775 NA [2,] 4.308 4.2245 -1.127 0.3645 -1.3335 -3.943 -3.282 2.3775 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" NA Warning message: In bxp(list(stats = c(11.4, 11.4, 11.75, 12.45, 12.8, 10.4, 10.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7he241424975097.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,] 4.016667 4.000 3.50000 [2,] 4.147222 4.025 3.82500 [3,] 4.350000 4.050 4.28125 [4,] 4.505556 4.100 4.46875 [5,] 4.588889 4.150 4.52500 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 4.066917 3.99075 3.772687 [2,] 4.633083 4.10925 4.789813 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(4.01666666666667, 4.14722222222222, 4.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/10ixs1424975097.ps tmp/10ixs1424975097.png",intern=TRUE)) character(0) > try(system("convert tmp/2eazj1424975097.ps tmp/2eazj1424975097.png",intern=TRUE)) character(0) > try(system("convert tmp/31bip1424975097.ps tmp/31bip1424975097.png",intern=TRUE)) character(0) > try(system("convert tmp/4xvq61424975097.ps tmp/4xvq61424975097.png",intern=TRUE)) character(0) > try(system("convert tmp/55qaw1424975097.ps tmp/55qaw1424975097.png",intern=TRUE)) character(0) > try(system("convert tmp/6wrwo1424975097.ps tmp/6wrwo1424975097.png",intern=TRUE)) character(0) > try(system("convert tmp/7he241424975097.ps tmp/7he241424975097.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.429 0.472 2.922