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(7.8,8,8.1,8.2,8.1,7.7,6.9,6.6,6.7,7,7.1,7,6.9,6.8,6.8,7,7,6.8,6.7,6.6,6.4,6.4,6.4,6.5,6.6,6.5,6.3,6.2,6.1,6.5,7.1,7.2,6.9,6.2,6,6.2,6.9,7.4,7.8,7.8,7.7,7.7,7.6,7.6,7.7,8,8.2,8.4,8.2,8.1,8.1,8.2,8.3,8.4,8.5,8.3,8.1,7.9,7.7,7.6,7.4,7.3,7,6.8,6.8,6.9,7.3,7.5,7.5,7.2,7,6.9,7,7.1,7.1,7.2,7.3,7.3,7.2,7.5,8,8.7,9,9,8.8,8.5,8.5,8.5,8.5,8.6,8.7,8.8,8.8,8.7,8.7,8.8) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > ar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-0.2 0.1 -0.2 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/1jrd11424687709.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/2jk3q1424687709.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/3sqik1424687709.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/40n4p1424687709.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,] 6.6 6.50 6.30 6.2 6.1 6.50 6.70 6.60 6.40 6.20 6.00 6.2 [2,] 6.9 6.95 6.90 6.9 6.9 6.85 7.00 6.90 6.80 6.70 6.70 6.7 [3,] 7.2 7.35 7.45 7.5 7.5 7.50 7.25 7.50 7.60 7.55 7.40 7.3 [4,] 8.0 8.05 8.10 8.2 8.2 8.05 8.05 7.95 8.05 8.35 8.45 8.6 [5,] 8.8 8.50 8.50 8.5 8.5 8.60 8.70 8.80 8.80 8.70 9.00 9.0 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.585524 6.735524 6.779663 6.773801 6.773801 6.829663 6.663455 6.913455 [2,] 7.814476 7.964476 8.120337 8.226199 8.226199 8.170337 7.836545 8.086545 [,9] [,10] [,11] [,12] [1,] 6.901732 6.628286 6.422425 6.238633 [2,] 8.298268 8.471714 8.377575 8.361367 $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(6.6, 6.9, 7.2, 8, 8.8, 6.5, 6.95, 7.35, 8.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5c1xg1424687709.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.30 -0.30 -0.20 -0.10 -0.40 -0.10 -0.30 -0.3 -0.70 -0.20 -0.10 -0.2 [2,] -0.10 -0.10 -0.05 -0.10 -0.10 -0.10 -0.15 -0.2 -0.25 -0.20 -0.10 -0.2 [3,] -0.10 0.00 0.05 0.00 0.05 0.00 0.05 0.0 -0.05 0.00 0.05 -0.1 [4,] 0.15 0.05 0.10 0.05 0.10 0.25 0.15 0.1 0.30 0.15 0.15 0.1 [5,] 0.50 0.10 0.20 0.10 0.40 0.60 0.30 0.5 0.70 0.30 0.20 0.1 $n [1] 8 8 8 8 8 8 8 8 8 8 8 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.23965359 -0.08379215 -0.03379215 -0.08379215 -0.06172287 -0.195515 [2,] 0.03965359 0.08379215 0.13379215 0.08379215 0.16172287 0.195515 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.1175843 -0.1675843 -0.3572379 -0.195515 -0.08965359 -0.27915516 [2,] 0.2175843 0.1675843 0.2572379 0.195515 0.18965359 0.07915516 $out [1] 0.4 -0.8 0.7 $group [1] 2 6 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.300000000000001, -0.100000000000001, -0.0999999999999996, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/69qyy1424687709.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] [1,] 6.60 6.40 6.00 7.4 7.60 6.80 7.00 8.5 NA [2,] 6.95 6.45 6.20 7.6 8.00 6.90 7.15 8.5 NA [3,] 7.40 6.75 6.40 7.7 8.15 7.10 7.30 8.7 NA [4,] 8.05 6.85 6.75 7.9 8.30 7.35 8.35 8.8 NA [5,] 8.20 7.00 7.20 8.2 8.50 7.50 9.00 8.8 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.898283 6.567557 6.149141 7.563168 8.013168 6.894752 6.752672 8.563168 [2,] 7.901717 6.932443 6.650859 7.836832 8.286832 7.305248 7.847328 8.836832 [,9] [1,] NA [2,] NA $out [1] 6.9 8.4 $group [1] 4 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(6.6, 6.95, 7.4, 8.05, 8.2, 6.4, 6.45, 6.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7gwbp1424687709.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,] 7.45000 7.200 7.37500 [2,] 7.46875 7.325 7.42500 [3,] 7.49375 7.475 7.51875 [4,] 7.51250 7.500 7.56250 [5,] 7.55000 7.600 7.65000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.473795 7.395181 7.456035 [2,] 7.513705 7.554819 7.581465 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(7.45, 7.46875, 7.49375, 7.5125, 7.55, 7.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1jrd11424687709.ps tmp/1jrd11424687709.png",intern=TRUE)) character(0) > try(system("convert tmp/2jk3q1424687709.ps tmp/2jk3q1424687709.png",intern=TRUE)) character(0) > try(system("convert tmp/3sqik1424687709.ps tmp/3sqik1424687709.png",intern=TRUE)) character(0) > try(system("convert tmp/40n4p1424687709.ps tmp/40n4p1424687709.png",intern=TRUE)) character(0) > try(system("convert tmp/5c1xg1424687709.ps tmp/5c1xg1424687709.png",intern=TRUE)) character(0) > try(system("convert tmp/69qyy1424687709.ps tmp/69qyy1424687709.png",intern=TRUE)) character(0) > try(system("convert tmp/7gwbp1424687709.ps tmp/7gwbp1424687709.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.752 0.462 3.236