R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 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(-1,-2,-5,-4,-6,-2,-2,-2,-2,2,1,-8,-1,1,-1,2,2,1,-1,-2,-2,-1,-8,-4,-6,-3,-3,-7,-9,-11,-13,-11,-9,-17,-22,-25,-20,-24,-24,-22,-19,-18,-17,-11,-11,-12,-10,-15,-15,-15,-13,-8,-13,-9,-7,-4,-4,-2,0,-2,-3,1,-2,-1,1,-3,-4,-9,-9,-7,-14,-12,-16,-20,-12,-12,-10,-10,-13,-16,-14,-17,-24,-25) > par1 = '10' > par1 <- '10' > #'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] 8 > 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] 9 9 9 9 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -1 1 -2 -13 -19 -13 -3 -14 -14 [2,] -2 -8 -1 -11 -18 -8 1 -12 -17 [3,] -5 -1 -8 -9 -17 -13 -2 -16 -24 [4,] -4 1 -4 -17 -11 -9 -1 -20 -25 [5,] -6 -1 -6 -22 -11 -7 1 -12 NA [6,] -2 2 -3 -25 -12 -4 -3 -12 NA [7,] -2 2 -3 -20 -10 -4 -4 -10 NA [8,] -2 1 -7 -24 -15 -2 -9 -10 NA [9,] -2 -1 -9 -24 -15 0 -9 -13 NA [10,] 2 -2 -11 -22 -15 -2 -7 -16 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -1 -9 1 2 1 5 4 2 -3 [2,] -3 7 -7 2 1 -5 -3 -4 -7 [3,] 1 2 4 -8 6 4 1 -4 -1 [4,] -2 -2 -2 -5 0 2 2 8 NA [5,] 4 3 3 -3 -1 3 -4 0 NA [6,] 0 0 0 5 2 0 -1 2 NA [7,] 0 -1 -4 -4 -5 2 -5 0 NA [8,] 0 -2 -2 0 0 2 0 -3 NA [9,] 4 -1 -2 2 0 -2 2 -3 NA [10,] -1 0 -2 3 2 -1 -7 2 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/1wr6o1363110555.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/2snhl1363110555.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/3cera1363110555.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/4x3dd1363110555.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] [1,] -19 -18 -24 -25 -22.0 -25.0 -20.0 -24.0 -24.0 -22.0 [2,] -14 -12 -16 -17 -11.5 -12.0 -10.0 -12.5 -14.0 -15.5 [3,] -13 -8 -9 -9 -6.5 -3.5 -4.0 -8.0 -9.0 -9.0 [4,] -2 -2 -5 -4 -3.5 -2.5 -2.5 -2.0 -1.5 -2.0 [5,] 1 1 -1 1 1.0 2.0 2.0 1.0 0.0 2.0 $n [1] 9 9 9 9 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -19.32 -13.266667 -14.793333 -15.846667 -10.968915 -8.806836 -8.1896077 [2,] -6.68 -2.733333 -3.206667 -2.153333 -2.031085 1.806836 0.1896077 [,8] [,9] [,10] [1,] -13.865451 -15.982679 -16.541294 [2,] -2.134549 -2.017321 -1.458706 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" Warning message: In bxp(list(stats = c(-19, -14, -13, -2, 1, -18, -12, -8, -2, 1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5cvvu1363110555.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] [1,] -3 -7 -8 -5 -4.0 -1 -5.0 -3 -3.0 -2.0 [2,] -1 -5 -1 -2 -2.0 0 -4.5 -2 -2.0 -1.5 [3,] 1 -3 1 -1 1.5 0 -2.5 0 -0.5 -0.5 [4,] 2 1 4 2 3.0 2 0.0 0 2.0 2.0 [5,] 5 7 6 8 4.0 5 2.0 2 4.0 3.0 $n [1] 9 9 9 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -0.58 -6.16 -1.633333 -3.234457 -1.293072 -1.117229 -5.01376461 -1.117229 [2,] 2.58 0.16 3.633333 1.234457 4.293072 1.117229 0.01376461 1.117229 [,9] [,10] [1,] -2.734457 -2.45515 [2,] 1.734457 1.45515 $out [1] -9 -7 $group [1] 1 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" Warning message: In bxp(list(stats = c(-3, -1, 1, 2, 5, -7, -5, -3, 1, 7, -8, -1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/61zov1363110555.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] [,9] [1,] -6 -2 -11 -25 -19 -13.0 -9 -20.0 -25.0 [2,] -4 -1 -8 -24 -17 -9.0 -7 -16.0 -24.5 [3,] -2 0 -5 -21 -15 -5.5 -3 -12.5 -20.5 [4,] -2 1 -3 -13 -11 -2.0 -1 -12.0 -15.5 [5,] -1 2 -1 -9 -10 0.0 1 -10.0 -14.0 $n [1] 10 10 10 10 10 10 10 10 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.99928 -0.9992797 -7.498199 -26.49604 -17.99784 -8.997479 -5.997839222 [2,] -1.00072 0.9992797 -2.501801 -15.50396 -12.00216 -2.002521 -0.002160778 [,8] [,9] [1,] -14.49856 -27.61 [2,] -10.50144 -13.39 $out [1] 2 -8 $group [1] 1 2 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(-6, -4, -2, -2, -1, -2, -1, 0, 1, 2, -11, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7f9yk1363110555.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,] -10.555556 -9.0 -10.5000 [2,] -9.125000 -9.0 -8.6250 [3,] -8.583333 -8.5 -7.8125 [4,] -8.000000 -6.5 -7.0000 [5,] -6.375000 -3.5 -6.3750 $n [1] 10 10 10 $conf [,1] [,2] [,3] [1,] -9.145428 -9.7491 -8.624415 [2,] -8.021238 -7.2509 -7.000585 $out [1] -13 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(-10.5555555555556, -9.125, -8.58333333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1wr6o1363110555.ps tmp/1wr6o1363110555.png",intern=TRUE)) character(0) > try(system("convert tmp/2snhl1363110555.ps tmp/2snhl1363110555.png",intern=TRUE)) character(0) > try(system("convert tmp/3cera1363110555.ps tmp/3cera1363110555.png",intern=TRUE)) character(0) > try(system("convert tmp/4x3dd1363110555.ps tmp/4x3dd1363110555.png",intern=TRUE)) character(0) > try(system("convert tmp/5cvvu1363110555.ps tmp/5cvvu1363110555.png",intern=TRUE)) character(0) > try(system("convert tmp/61zov1363110555.ps tmp/61zov1363110555.png",intern=TRUE)) character(0) > try(system("convert tmp/7f9yk1363110555.ps tmp/7f9yk1363110555.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.338 0.544 3.873