R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(13.5,8.4,10.5,9,9.2,9.7,6.6,10.6,10.1,7.1,8,7.9,6.8,9.5,8.1,13.5,9.9,6.9,7.5,11.1,8.2,8,7.7,7.4,6.5,9.5,8.2,6.9,7.2,8.2,9.6,7.2,8.8,11.3,8.5,9.4,10.5,6.9,6.5,7.5,7.1,13.2,7.7,5.9,5.2,5.6,11.7,6,7.8,6.5) > 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] 50 > (np <- floor(n / par1)) [1] 4 > 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 4 4 4 4 4 4 4 4 4 4 > arr [,1] [,2] [,3] [,4] [,5] [1,] 13.5 6.8 6.5 10.5 7.8 [2,] 8.4 9.5 9.5 6.9 6.5 [3,] 10.5 8.1 8.2 6.5 NA [4,] 9.0 13.5 6.9 7.5 NA [5,] 9.2 9.9 7.2 7.1 NA [6,] 9.7 6.9 8.2 13.2 NA [7,] 6.6 7.5 9.6 7.7 NA [8,] 10.6 11.1 7.2 5.9 NA [9,] 10.1 8.2 8.8 5.2 NA [10,] 7.1 8.0 11.3 5.6 NA [11,] 8.0 7.7 8.5 11.7 NA [12,] 7.9 7.4 9.4 6.0 NA > darr [,1] [,2] [,3] [,4] [,5] [1,] -5.1 2.7 3.0 -3.6 -1.3 [2,] 2.1 -1.4 -1.3 -0.4 NA [3,] -1.5 5.4 -1.3 1.0 NA [4,] 0.2 -3.6 0.3 -0.4 NA [5,] 0.5 -3.0 1.0 6.1 NA [6,] -3.1 0.6 1.4 -5.5 NA [7,] 4.0 3.6 -2.4 -1.8 NA [8,] -0.5 -2.9 1.6 -0.7 NA [9,] -3.0 -0.2 2.5 0.4 NA [10,] 0.9 -0.3 -2.8 6.1 NA [11,] -0.1 -0.3 0.9 -5.7 NA [12,] -1.1 -0.9 1.1 1.8 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/122bd1355650294.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/2qph81355650294.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/33rkp1355650294.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/4nc1z1355650294.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.5 6.5 6.50 6.90 7.10 6.90 6.60 5.90 5.20 5.60 7.70 6.00 [2,] 6.8 6.9 7.30 7.20 7.15 7.55 7.05 6.55 6.70 6.35 7.85 6.70 [3,] 7.8 8.4 8.15 8.25 8.20 8.95 7.60 8.90 8.50 7.55 8.25 7.65 [4,] 10.5 9.5 9.35 11.25 9.55 11.45 8.65 10.85 9.45 9.65 10.10 8.65 [5,] 13.5 9.5 10.50 13.50 9.90 13.20 9.60 11.10 10.10 11.30 11.70 9.40 $n [1] 5 5 4 4 4 4 4 4 4 4 4 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 5.185589 6.562847 6.5305 5.0505 6.304 5.869 6.336 5.503 6.3275 [2,] 10.414411 10.237153 9.7695 11.4495 10.096 12.031 8.864 12.297 10.6725 [,10] [,11] [,12] [1,] 4.943 6.4725 6.1095 [2,] 10.157 10.0275 9.1905 $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.5, 6.8, 7.8, 10.5, 13.5, 6.5, 6.9, 8.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5flr21355650294.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,] -5.1 -1.40 -1.50 -3.60 -3.00 -5.50 -2.4 -2.90 -3.00 -2.80 -5.7 -1.10 [2,] -3.6 -1.35 -1.40 -2.00 -1.25 -4.30 -2.1 -1.80 -1.60 -1.55 -3.0 -1.00 [3,] -1.3 -0.85 -0.15 -0.10 0.75 -1.25 0.9 -0.60 0.10 0.30 -0.2 0.10 [4,] 2.7 0.85 3.20 0.25 3.55 1.00 3.8 0.55 1.45 3.50 0.4 1.45 [5,] 3.0 2.10 5.40 0.30 6.10 1.40 4.0 1.60 2.50 6.10 0.9 1.80 $n [1] 5 4 4 4 4 4 4 4 4 4 4 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -5.751564 -2.588 -3.784 -1.8775 -3.042 -5.437 -3.761 -2.4565 -2.3095 [2,] 3.151564 0.888 3.484 1.6775 4.542 2.937 5.561 1.2565 2.5095 [,10] [,11] [,12] [1,] -3.6895 -2.886 -1.8355 [2,] 4.2895 2.486 2.0355 $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(-5.1, -3.6, -1.3, 2.7, 3, -1.4, -1.35, -0.850000000000001, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/65k5c1355650294.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] [1,] 6.60 6.80 6.50 5.20 6.50 [2,] 7.95 7.45 7.20 5.95 6.50 [3,] 9.10 8.05 8.35 7.00 7.15 [4,] 10.30 9.70 9.45 9.10 7.80 [5,] 13.50 11.10 11.30 13.20 7.80 $n [1] 12 12 12 12 2 $conf [,1] [,2] [,3] [,4] [,5] [1,] 8.028149 7.02376 7.32376 5.563264 5.697603 [2,] 10.171851 9.07624 9.37624 8.436736 8.602397 $out [1] 13.5 $group [1] 2 $names [1] "1" "2" "3" "4" NA Warning message: In bxp(list(stats = c(6.6, 7.95, 9.1, 10.3, 13.5, 6.8, 7.45, 8.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/75liy1355650294.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.6750 7.550 7.66250 [2,] 8.0375 7.725 7.98750 [3,] 8.3375 8.225 8.28125 [4,] 8.9975 8.450 8.69375 [5,] 9.5000 8.950 9.22500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.899638 7.894323 7.959125 [2,] 8.775362 8.555677 8.603375 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(7.675, 8.0375, 8.3375, 8.9975, 9.5, 7.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/122bd1355650294.ps tmp/122bd1355650294.png",intern=TRUE)) character(0) > try(system("convert tmp/2qph81355650294.ps tmp/2qph81355650294.png",intern=TRUE)) character(0) > try(system("convert tmp/33rkp1355650294.ps tmp/33rkp1355650294.png",intern=TRUE)) character(0) > try(system("convert tmp/4nc1z1355650294.ps tmp/4nc1z1355650294.png",intern=TRUE)) character(0) > try(system("convert tmp/5flr21355650294.ps tmp/5flr21355650294.png",intern=TRUE)) character(0) > try(system("convert tmp/65k5c1355650294.ps tmp/65k5c1355650294.png",intern=TRUE)) character(0) > try(system("convert tmp/75liy1355650294.ps tmp/75liy1355650294.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.454 0.578 4.020