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(-5.3,-7.1,-8,-8.9,-7.7,-1.1,4,9.6,10.9,13,14.9,20.1,10.8,11,3.8,10.8,7.6,10.2,2.2,-0.1,-1.7,-4.8,-9.9,-13.5,-18.1,-18,-15.7,-15.2,-15.1,-17.9,-14.5,-9.4,-4.2,-2.2,4.5,12.4,15.8,11.5,14.1,18.8,26.1,27.9,25.4,23.4,11.5,9.9,8.1,12.6,8.2,5.4,1,-2.9,-3.7,-7,-7.2,-11.8,-2.1,1.2,2.5,4.8,-6.6,-16,-22.7,-17.7,-18.2,-18.9,-16,-12.2,-17.1,-18.6,-17.5,-24.9) > 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] 72 > (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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -5.3 10.8 -18.1 15.8 8.2 -6.6 NA [2,] -7.1 11.0 -18.0 11.5 5.4 -16.0 NA [3,] -8.0 3.8 -15.7 14.1 1.0 -22.7 NA [4,] -8.9 10.8 -15.2 18.8 -2.9 -17.7 NA [5,] -7.7 7.6 -15.1 26.1 -3.7 -18.2 NA [6,] -1.1 10.2 -17.9 27.9 -7.0 -18.9 NA [7,] 4.0 2.2 -14.5 25.4 -7.2 -16.0 NA [8,] 9.6 -0.1 -9.4 23.4 -11.8 -12.2 NA [9,] 10.9 -1.7 -4.2 11.5 -2.1 -17.1 NA [10,] 13.0 -4.8 -2.2 9.9 1.2 -18.6 NA [11,] 14.9 -9.9 4.5 8.1 2.5 -17.5 NA [12,] 20.1 -13.5 12.4 12.6 4.8 -24.9 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -1.8 0.2 0.1 -4.3 -2.8 -9.4 NA [2,] -0.9 -7.2 2.3 2.6 -4.4 -6.7 NA [3,] -0.9 7.0 0.5 4.7 -3.9 5.0 NA [4,] 1.2 -3.2 0.1 7.3 -0.8 -0.5 NA [5,] 6.6 2.6 -2.8 1.8 -3.3 -0.7 NA [6,] 5.1 -8.0 3.4 -2.5 -0.2 2.9 NA [7,] 5.6 -2.3 5.1 -2.0 -4.6 3.8 NA [8,] 1.3 -1.6 5.2 -11.9 9.7 -4.9 NA [9,] 2.1 -3.1 2.0 -1.6 3.3 -1.5 NA [10,] 1.9 -5.1 6.7 -1.8 1.3 1.1 NA [11,] 5.2 -3.6 7.9 4.5 2.3 -7.4 NA [12,] -9.3 -4.6 3.4 -4.4 -11.4 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/1jiby1362653954.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/2vpxp1362653954.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/3x8pd1362653954.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/4wsu11362653954.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,] -18.10 -18.00 -22.7 -17.7 -18.2 -18.90 -16.0 -12.20 -17.1 -18.6 -17.5 [2,] -6.60 -16.00 -15.7 -15.2 -15.1 -17.90 -14.5 -11.80 -4.2 -4.8 -9.9 [3,] 1.45 -0.85 -3.5 -5.9 -5.7 -4.05 -2.5 -4.75 -1.9 -0.5 3.5 [4,] 10.80 11.00 3.8 10.8 7.6 10.20 4.0 9.60 10.9 9.9 8.1 [5,] 15.80 11.50 14.1 18.8 26.1 27.90 25.4 23.40 11.5 13.0 14.9 [,12] [1,] -24.9 [2,] -13.5 [3,] 8.6 [4,] 12.6 [5,] 20.1 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -9.773562 -18.26587 -16.07813 -22.67084 -20.342233 -22.17541 -14.433098 [2,] 12.673562 16.56587 9.07813 10.87084 8.942233 14.07541 9.433098 [,8] [,9] [,10] [,11] [,12] [1,] -18.553691 -11.639988 -9.981975 -8.110581 -8.235343 [2,] 9.053691 7.839988 8.981975 15.110581 25.435343 $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(-18.1, -6.6, 1.45, 10.8, 15.8, -18, -16, -0.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5k61u1362653954.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,] -9.4 -7.20 -3.9 -3.2 -3.30 -8.00 -4.6 -11.90 -3.10 -5.1 -7.4 -11.4 [2,] -4.3 -6.70 -0.9 -0.8 -2.80 -2.50 -2.3 -4.90 -1.60 -1.8 -3.6 -9.3 [3,] -2.3 -2.65 2.6 -0.2 0.55 1.35 0.9 -0.15 0.25 1.2 3.4 -4.6 [4,] 0.1 2.30 5.0 1.2 2.60 3.40 5.1 5.20 2.10 1.9 5.2 -4.4 [5,] 0.2 2.60 7.0 1.2 6.60 5.10 5.6 9.70 3.30 6.7 7.9 -4.4 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -5.1381421 -8.455291 -1.205691 -1.490065 -2.933174 -2.455691 -3.873239 [2,] 0.5381421 3.155291 6.405691 1.090065 4.033174 5.155691 5.673239 [,8] [,9] [,10] [,11] [,12] [1,] -6.664826 -2.13662 -1.18662 -2.276284 -8.062328 [2,] 6.364826 2.63662 3.58662 9.076284 -1.137672 $out [1] 7.3 3.4 $group [1] 4 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-9.4, -4.3, -2.3, 0.100000000000001, 0.199999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6obkc1362653954.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,] -8.90 -13.50 -18.1 8.10 -11.80 -22.70 NA [2,] -7.40 -3.25 -16.8 11.50 -5.35 -18.75 NA [3,] 1.45 3.00 -14.8 14.95 -0.55 -17.60 NA [4,] 11.95 10.50 -3.2 24.40 3.65 -16.00 NA [5,] 20.10 11.00 12.4 27.90 8.20 -12.20 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -7.375665 -3.271467 -21.003051 9.066223 -4.65496 -18.85429 NA [2,] 10.275665 9.271467 -8.596949 20.833777 3.55496 -16.34571 NA $out [1] -6.6 -24.9 $group [1] 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(-8.9, -7.4, 1.45, 11.95, 20.1, -13.5, -3.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7isbu1362653954.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,] -4.5833333 -5.900 -5.33750 [2,] -2.0166667 -4.400 -4.06875 [3,] -0.7333333 -2.200 -2.05000 [4,] 0.1750000 0.475 1.80000 [5,] 1.9166667 3.500 2.03750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] -1.7329672 -4.42352022 -4.7267763 [2,] 0.2663005 0.02352022 0.6267763 $out [1] 8.6 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(-4.58333333333333, -2.01666666666667, -0.733333333333334, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1jiby1362653954.ps tmp/1jiby1362653954.png",intern=TRUE)) character(0) > try(system("convert tmp/2vpxp1362653954.ps tmp/2vpxp1362653954.png",intern=TRUE)) character(0) > try(system("convert tmp/3x8pd1362653954.ps tmp/3x8pd1362653954.png",intern=TRUE)) character(0) > try(system("convert tmp/4wsu11362653954.ps tmp/4wsu11362653954.png",intern=TRUE)) character(0) > try(system("convert tmp/5k61u1362653954.ps tmp/5k61u1362653954.png",intern=TRUE)) character(0) > try(system("convert tmp/6obkc1362653954.ps tmp/6obkc1362653954.png",intern=TRUE)) character(0) > try(system("convert tmp/7isbu1362653954.ps tmp/7isbu1362653954.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.456 0.661 4.108