R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(31.1,31.8,32.5,34.4,35.5,35.5,36.6,37.1,37.9,38.1,39,41.5,41.8,41.9,44.6,46.1,46.4,47.2,47.7,49.2,49.3,49.3,49.5,50.1,51.9,52.6,53.2,53.5,53.7,53.7,53.9,54.1,54.8,55.4,55.9,56.8,58.4,59.3,60.3,60.5,60.8,61,61.1,61.3,61.4,61.5,63.9,63.9,64,64.1,64.5,64.5,65.9,66.8,68.7,69.2,69.6,70.2,70.6,70.7,70.7,71,72.1,73.7,77.4,79.7,91.6,93.6,94.3,97.3,101.7,103,103.1,104.6,107.2,107.7,108.3,108.8,113.1,113.8,113.8,116.5,116.9,117.6) > 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,] 31.1 41.8 51.9 58.4 64.0 70.7 103.1 NA [2,] 31.8 41.9 52.6 59.3 64.1 71.0 104.6 NA [3,] 32.5 44.6 53.2 60.3 64.5 72.1 107.2 NA [4,] 34.4 46.1 53.5 60.5 64.5 73.7 107.7 NA [5,] 35.5 46.4 53.7 60.8 65.9 77.4 108.3 NA [6,] 35.5 47.2 53.7 61.0 66.8 79.7 108.8 NA [7,] 36.6 47.7 53.9 61.1 68.7 91.6 113.1 NA [8,] 37.1 49.2 54.1 61.3 69.2 93.6 113.8 NA [9,] 37.9 49.3 54.8 61.4 69.6 94.3 113.8 NA [10,] 38.1 49.3 55.4 61.5 70.2 97.3 116.5 NA [11,] 39.0 49.5 55.9 63.9 70.6 101.7 116.9 NA [12,] 41.5 50.1 56.8 63.9 70.7 103.0 117.6 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.7 0.1 0.7 0.9 0.1 0.3 1.5 NA [2,] 0.7 2.7 0.6 1.0 0.4 1.1 2.6 NA [3,] 1.9 1.5 0.3 0.2 0.0 1.6 0.5 NA [4,] 1.1 0.3 0.2 0.3 1.4 3.7 0.6 NA [5,] 0.0 0.8 0.0 0.2 0.9 2.3 0.5 NA [6,] 1.1 0.5 0.2 0.1 1.9 11.9 4.3 NA [7,] 0.5 1.5 0.2 0.2 0.5 2.0 0.7 NA [8,] 0.8 0.1 0.7 0.1 0.4 0.7 0.0 NA [9,] 0.2 0.0 0.6 0.1 0.6 3.0 2.7 NA [10,] 0.9 0.2 0.5 2.4 0.4 4.4 0.4 NA [11,] 2.5 0.6 0.9 0.0 0.1 1.3 0.7 NA [12,] 0.3 1.8 1.6 0.1 0.0 0.1 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/1dwc01337511459.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/22sl81337511459.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/390xy1337511459.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/48rjm1337511459.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,] 31.10 31.80 32.5 34.4 35.50 35.50 36.60 37.10 37.90 38.10 39.00 [2,] 46.85 47.25 48.9 49.8 50.05 50.45 50.80 51.65 52.05 52.35 52.70 [3,] 58.40 59.30 60.3 60.5 60.80 61.00 61.10 61.30 61.40 61.50 63.90 [4,] 67.35 67.55 68.3 69.1 71.65 73.25 80.15 81.40 81.95 83.75 86.15 [5,] 70.70 71.00 72.1 73.7 77.40 79.70 113.10 113.80 113.80 116.50 116.90 [,12] [1,] 41.50 [2,] 53.45 [3,] 63.90 [4,] 86.85 [5,] 117.60 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 46.15773 47.17717 48.71463 48.97435 47.90083 47.38421 43.57265 43.53378 [2,] 70.64227 71.42283 71.88537 72.02565 73.69917 74.61579 78.62735 79.06622 [,9] [,10] [,11] [,12] [1,] 43.5442 42.74843 43.9242 43.95406 [2,] 79.2558 80.25157 83.8758 83.84594 $out [1] 103.1 104.6 107.2 107.7 108.3 108.8 $group [1] 1 2 3 4 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(31.1, 46.85, 58.4, 67.35, 70.7, 31.8, 47.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5yfvo1337511459.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.1 0.40 0.00 0.20 0.00 0.10 0.20 0.0 0.00 0.20 0.00 0.0 [2,] 0.2 0.65 0.25 0.30 0.10 0.35 0.35 0.1 0.15 0.40 0.35 0.1 [3,] 0.7 1.00 0.50 0.60 0.50 1.10 0.50 0.4 0.60 0.50 0.70 0.2 [4,] 0.8 1.85 1.55 1.25 0.85 3.10 1.10 0.7 1.65 1.65 1.10 1.6 [5,] 1.5 2.70 1.90 1.40 0.90 4.30 2.00 0.8 3.00 2.40 1.30 1.8 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.3416897 0.2833794 -0.276339 0.03267533 0.0521121 -0.5422556 0.0521121 [2,] 1.0583103 1.7166206 1.276339 1.16732467 0.9478879 2.7422556 0.9478879 [,8] [,9] [,10] [,11] [,12] [1,] 0.04168968 -0.2957758 -0.2464798 0.2521121 -0.7675484 [2,] 0.75831032 1.4957758 1.2464798 1.1478879 1.1675484 $out [1] 3.7 2.3 11.9 4.4 2.5 $group [1] 4 5 6 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.0999999999999943, 0.199999999999999, 0.699999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6bwy81337511459.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,] 31.10 41.80 51.90 59.30 64.00 70.70 103.10 NA [2,] 33.45 45.35 53.35 60.40 64.50 72.90 107.45 NA [3,] 36.05 47.45 53.80 61.05 67.75 85.65 110.95 NA [4,] 38.00 49.30 55.10 61.45 69.90 95.80 115.15 NA [5,] 41.50 50.10 56.80 61.50 70.70 103.00 117.60 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 33.97471 45.64838 53.00181 60.57109 65.28702 75.20516 107.438 NA [2,] 38.12529 49.25162 54.59819 61.52891 70.21298 96.09484 114.462 NA $out [1] 58.4 63.9 63.9 $group [1] 4 4 4 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(31.1, 33.45, 36.05, 38, 41.5, 41.8, 45.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/77xtc1337511459.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,] 60.14286 59.30 57.1000 [2,] 62.48571 60.40 59.0250 [3,] 66.10000 61.05 63.6625 [4,] 69.24286 61.45 67.5250 [5,] 71.94286 61.50 70.1500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 63.01802 60.57109 59.78559 [2,] 69.18198 61.52891 67.53941 $out [1] 58.4 63.9 63.9 $group [1] 2 2 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(60.1428571428571, 62.4857142857143, 66.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1dwc01337511459.ps tmp/1dwc01337511459.png",intern=TRUE)) character(0) > try(system("convert tmp/22sl81337511459.ps tmp/22sl81337511459.png",intern=TRUE)) character(0) > try(system("convert tmp/390xy1337511459.ps tmp/390xy1337511459.png",intern=TRUE)) character(0) > try(system("convert tmp/48rjm1337511459.ps tmp/48rjm1337511459.png",intern=TRUE)) character(0) > try(system("convert tmp/5yfvo1337511459.ps tmp/5yfvo1337511459.png",intern=TRUE)) character(0) > try(system("convert tmp/6bwy81337511459.ps tmp/6bwy81337511459.png",intern=TRUE)) character(0) > try(system("convert tmp/77xtc1337511459.ps tmp/77xtc1337511459.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.597 0.540 2.142