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(6.3,6.2,6.2,6.3,6.5,6.5,6.2,6.2,6.2,6.1,6.1,6.2,6.1,6.1,6.2,6.2,6.4,6.2,5.7,5.7,5.7,5.9,6,6.3,6.4,6.5,6.8,7,7.3,7.4,6.9,6.9,7,7.1,7.2,7.1,6.8,6.5,6.4,6.5,6.7,6.6,6.2,6.2,6.5,6.8,6.8,6.5,5.9,5.5,5.6,6,6.3,6.2,5.6,5.4,5.7,5.9,6.2,6.3,6.1,5.9,5.9,5.7,5.9,6.1,6.1,6.5,6.8,6.8,6.9,6.9,6.8,6.6,6.5,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] 76 > (np <- floor(n / par1)) [1] 6 > 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 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.3 6.1 6.4 6.8 5.9 6.1 6.8 [2,] 6.2 6.1 6.5 6.5 5.5 5.9 6.6 [3,] 6.2 6.2 6.8 6.4 5.6 5.9 6.5 [4,] 6.3 6.2 7.0 6.5 6.0 5.7 6.5 [5,] 6.5 6.4 7.3 6.7 6.3 5.9 NA [6,] 6.5 6.2 7.4 6.6 6.2 6.1 NA [7,] 6.2 5.7 6.9 6.2 5.6 6.1 NA [8,] 6.2 5.7 6.9 6.2 5.4 6.5 NA [9,] 6.2 5.7 7.0 6.5 5.7 6.8 NA [10,] 6.1 5.9 7.1 6.8 5.9 6.8 NA [11,] 6.1 6.0 7.2 6.8 6.2 6.9 NA [12,] 6.2 6.3 7.1 6.5 6.3 6.9 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.1 0.0 0.1 -0.3 -0.4 -0.2 -0.2 [2,] 0.0 0.1 0.3 -0.1 0.1 0.0 -0.1 [3,] 0.1 0.0 0.2 0.1 0.4 -0.2 0.0 [4,] 0.2 0.2 0.3 0.2 0.3 0.2 NA [5,] 0.0 -0.2 0.1 -0.1 -0.1 0.2 NA [6,] -0.3 -0.5 -0.5 -0.4 -0.6 0.0 NA [7,] 0.0 0.0 0.0 0.0 -0.2 0.4 NA [8,] 0.0 0.0 0.1 0.3 0.3 0.3 NA [9,] -0.1 0.2 0.1 0.3 0.2 0.0 NA [10,] 0.0 0.1 0.1 0.0 0.3 0.1 NA [11,] 0.1 0.3 -0.1 -0.3 0.1 0.0 NA [12,] -0.1 0.1 -0.3 -0.6 -0.2 -0.1 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/1wuje1362673052.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/2q87y1362673052.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/3fxae1362673052.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/42zvc1362673052.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,] 5.9 5.5 5.60 5.7 5.90 6.10 5.60 5.4 5.70 5.90 6.0 6.2 [2,] 6.1 6.0 6.05 6.1 6.30 6.20 5.70 5.7 5.70 5.90 6.1 6.3 [3,] 6.3 6.2 6.20 6.3 6.45 6.35 6.15 6.2 6.35 6.45 6.5 6.4 [4,] 6.6 6.5 6.45 6.5 6.70 6.60 6.20 6.5 6.80 6.80 6.9 6.9 [5,] 6.8 6.6 6.80 7.0 7.30 6.60 6.90 6.9 7.00 7.10 7.2 7.1 $n [1] 7 7 7 7 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.001408 5.901408 5.961126 6.061126 6.191987 6.091987 5.827484 5.683974 [2,] 6.598592 6.498592 6.438874 6.538874 6.708013 6.608013 6.472516 6.716026 [,9] [,10] [,11] [,12] [1,] 5.640464 5.869471 5.983974 6.012981 [2,] 7.059536 7.030529 7.016026 6.787019 $out [1] 7.4 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(5.9, 6.1, 6.3, 6.6, 6.8, 5.5, 6, 6.2, 6.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/52ijn1362673052.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.40 -0.10 -0.20 0.2 -0.20 -0.60 0 0.0 -0.10 0.0 -0.30 -0.30 [2,] -0.25 -0.05 0.00 0.2 -0.10 -0.50 0 0.0 0.00 0.0 -0.10 -0.30 [3,] -0.20 0.00 0.10 0.2 -0.05 -0.45 0 0.2 0.15 0.1 0.05 -0.15 [4,] -0.05 0.10 0.15 0.3 0.10 -0.30 0 0.3 0.20 0.1 0.10 -0.10 [5,] 0.10 0.30 0.20 0.3 0.20 0.00 0 0.3 0.30 0.1 0.30 0.10 $n [1] 7 7 7 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.31943677 -0.08957758 0.01042242 0.1354968 -0.17900646 -0.5790065 0 [2,] -0.08056323 0.08957758 0.18957758 0.2645032 0.07900646 -0.3209935 0 [,8] [,9] [,10] [,11] [,12] [1,] 0.00649031 0.02099354 0.03549677 -0.07900646 -0.27900646 [2,] 0.39350969 0.27900646 0.16450323 0.17900646 -0.02099354 $out [1] 0.4 -0.2 0.4 0.3 -0.6 $group [1] 3 7 7 10 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.4, -0.25, -0.199999999999999, -0.0499999999999998, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/60hiw1362673052.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] [1,] 6.1 5.7 6.40 6.20 5.4 5.7 6.50 [2,] 6.2 5.8 6.85 6.45 5.6 5.9 6.50 [3,] 6.2 6.1 7.00 6.50 5.9 6.1 6.55 [4,] 6.3 6.2 7.15 6.75 6.2 6.8 6.70 [5,] 6.3 6.4 7.40 6.80 6.3 6.9 6.80 $n [1] 12 12 12 12 12 12 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.154389 5.917557 6.863168 6.363168 5.626336 5.689504 6.392 [2,] 6.245611 6.282443 7.136832 6.636832 6.173664 6.510496 6.708 $out [1] 6.5 6.5 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(6.1, 6.2, 6.2, 6.3, 6.3, 5.7, 5.8, 6.1, 6.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7zrj71362673052.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,] 6.116667 6.150 6.0000 [2,] 6.207143 6.200 6.2500 [3,] 6.329762 6.325 6.3250 [4,] 6.508333 6.425 6.4375 [5,] 6.550000 6.500 6.5500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 6.192387 6.222376 6.23948 [2,] 6.467137 6.427624 6.41052 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(6.11666666666667, 6.20714285714286, 6.3297619047619, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1wuje1362673052.ps tmp/1wuje1362673052.png",intern=TRUE)) character(0) > try(system("convert tmp/2q87y1362673052.ps tmp/2q87y1362673052.png",intern=TRUE)) character(0) > try(system("convert tmp/3fxae1362673052.ps tmp/3fxae1362673052.png",intern=TRUE)) character(0) > try(system("convert tmp/42zvc1362673052.ps tmp/42zvc1362673052.png",intern=TRUE)) character(0) > try(system("convert tmp/52ijn1362673052.ps tmp/52ijn1362673052.png",intern=TRUE)) character(0) > try(system("convert tmp/60hiw1362673052.ps tmp/60hiw1362673052.png",intern=TRUE)) character(0) > try(system("convert tmp/7zrj71362673052.ps tmp/7zrj71362673052.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.814 0.773 5.566