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(86.9,85.8,84.4,80.4,84.4,90.7,91.6,91.9,92.5,92.5,92,92,94.5,95.5,96.3,100,103.1,109.2,108.7,107.5,104.5,103.8,102.5,100.8,100.7,102.7,106.5,105.5,110.1,110.1,109,106.9,108,106.1,101.7,100.6,102.6,100.5,105.2,104.3,104.1,104.8,105.2,102.7,101,93.9,90.2,92.4,94.4,93.3,93.9,95.1,97.6,99.3,101.1,100.6,99.3,97,96.4,98.7) > 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,] 86.9 94.5 100.7 102.6 94.4 NA [2,] 85.8 95.5 102.7 100.5 93.3 NA [3,] 84.4 96.3 106.5 105.2 93.9 NA [4,] 80.4 100.0 105.5 104.3 95.1 NA [5,] 84.4 103.1 110.1 104.1 97.6 NA [6,] 90.7 109.2 110.1 104.8 99.3 NA [7,] 91.6 108.7 109.0 105.2 101.1 NA [8,] 91.9 107.5 106.9 102.7 100.6 NA [9,] 92.5 104.5 108.0 101.0 99.3 NA [10,] 92.5 103.8 106.1 93.9 97.0 NA [11,] 92.0 102.5 101.7 90.2 96.4 NA [12,] 92.0 100.8 100.6 92.4 98.7 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] -1.1 1.0 2.0 -2.1 -1.1 NA [2,] -1.4 0.8 3.8 4.7 0.6 NA [3,] -4.0 3.7 -1.0 -0.9 1.2 NA [4,] 4.0 3.1 4.6 -0.2 2.5 NA [5,] 6.3 6.1 0.0 0.7 1.7 NA [6,] 0.9 -0.5 -1.1 0.4 1.8 NA [7,] 0.3 -1.2 -2.1 -2.5 -0.5 NA [8,] 0.6 -3.0 1.1 -1.7 -1.3 NA [9,] 0.0 -0.7 -1.9 -7.1 -2.3 NA [10,] -0.5 -1.3 -4.4 -3.7 -0.6 NA [11,] 0.0 -1.7 -1.1 2.2 2.3 NA [12,] 2.5 -0.1 2.0 2.0 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/1tjko1337778110.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/2d31r1337778110.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/31sh01337778110.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/466571337778110.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,] 86.9 85.8 84.4 95.1 97.6 90.7 91.6 91.9 92.5 92.5 90.2 92.0 [2,] 94.4 93.3 93.9 95.1 97.6 99.3 101.1 100.6 99.3 93.9 92.0 92.4 [3,] 94.5 95.5 96.3 100.0 103.1 104.8 105.2 102.7 101.0 97.0 96.4 98.7 [4,] 100.7 100.5 105.2 104.3 104.1 109.2 108.7 106.9 104.5 103.8 101.7 100.6 [5,] 102.6 102.7 106.5 105.5 110.1 110.1 109.0 107.5 108.0 106.1 102.5 100.8 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 90.04844 90.4125 88.31545 93.4993 98.50712 97.80468 99.82986 [2,] 98.95156 100.5875 104.28455 106.5007 107.69288 111.79532 110.57014 [,8] [,9] [,10] [,11] [,12] [1,] 98.24844 97.32569 90.00468 89.546 92.9059 [2,] 107.15156 104.67431 103.99532 103.254 104.4941 $out [1] 80.4 84.4 $group [1] 4 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(86.9, 94.4, 94.5, 100.7, 102.6, 85.8, 93.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5fql11337778110.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,] -2.1 -1.4 -4.0 2.5 0.0 -1.1 -2.5 -3.0 -2.3 -4.4 -1.7 -0.10 [2,] -1.1 0.6 -1.0 2.5 0.7 -0.5 -2.1 -1.7 -2.3 -3.7 -1.1 0.95 [3,] -1.1 0.8 -0.9 3.1 1.7 0.4 -1.2 -1.3 -1.9 -1.3 0.0 2.00 [4,] 1.0 3.8 1.2 4.0 6.1 0.9 -0.5 0.6 -0.7 -0.6 2.2 2.25 [5,] 2.0 4.7 3.7 4.6 6.3 1.8 0.3 1.1 0.0 -0.5 2.3 2.50 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.5838547 -1.461112 -2.4545145 2.040104 -2.115626 -0.5892365 -2.33055597 [2,] 0.3838547 3.061112 0.6545145 4.159896 5.515626 1.3892365 -0.06944403 [,8] [,9] [,10] [,11] [,12] [1,] -2.9251742 -3.030556 -3.4904522 -2.331772 0.973 [2,] 0.3251742 -0.769444 0.8904522 2.331772 3.027 $out [1] -0.2 -7.1 $group [1] 4 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-2.09999999999999, -1.10000000000001, -1.10000000000001, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6e30h1337778110.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,] 80.40 94.50 100.6 90.20 93.30 NA [2,] 85.10 98.15 102.2 97.20 94.75 NA [3,] 91.15 102.80 106.3 102.65 97.30 NA [4,] 92.00 106.00 108.5 104.55 99.30 NA [5,] 92.50 109.20 110.1 105.20 101.10 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 88.00286 99.21956 103.4265 99.29762 95.22471 NA [2,] 94.29714 106.38044 109.1735 106.00238 99.37529 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(80.4, 85.1, 91.15, 92, 92.5, 94.5, 98.15, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7q77c1337778110.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,] 95.56 94.50 96.500 [2,] 96.73 96.35 97.225 [3,] 97.96 99.35 99.625 [4,] 101.49 102.90 102.825 [5,] 103.12 105.20 104.900 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 95.78893 96.3625 97.0708 [2,] 100.13107 102.3375 102.1792 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(95.56, 96.73, 97.96, 101.49, 103.12, 94.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1tjko1337778110.ps tmp/1tjko1337778110.png",intern=TRUE)) character(0) > try(system("convert tmp/2d31r1337778110.ps tmp/2d31r1337778110.png",intern=TRUE)) character(0) > try(system("convert tmp/31sh01337778110.ps tmp/31sh01337778110.png",intern=TRUE)) character(0) > try(system("convert tmp/466571337778110.ps tmp/466571337778110.png",intern=TRUE)) character(0) > try(system("convert tmp/5fql11337778110.ps tmp/5fql11337778110.png",intern=TRUE)) character(0) > try(system("convert tmp/6e30h1337778110.ps tmp/6e30h1337778110.png",intern=TRUE)) character(0) > try(system("convert tmp/7q77c1337778110.ps tmp/7q77c1337778110.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.870 0.467 2.336