R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(-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,-23,-17,-24,-20,-19,-18,-16,-12,-7,-6,-6,-5,-4,-4,-8,-9,-6,-7,-10,-11,-11,-12,-14,-12) > 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,] -20 -15 -3 -16 -23 -4 NA [2,] -24 -15 1 -20 -17 -4 NA [3,] -24 -13 -2 -12 -24 -8 NA [4,] -22 -8 -1 -12 -20 -9 NA [5,] -19 -13 1 -10 -19 -6 NA [6,] -18 -9 -3 -10 -18 -7 NA [7,] -17 -7 -4 -13 -16 -10 NA [8,] -11 -4 -9 -16 -12 -11 NA [9,] -11 -4 -9 -14 -7 -11 NA [10,] -12 -2 -7 -17 -6 -12 NA [11,] -10 0 -14 -24 -6 -14 NA [12,] -15 -2 -12 -25 -5 -12 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -4 0 4 -4 6 0 NA [2,] 0 2 -3 8 -7 -4 NA [3,] 2 5 1 0 4 -1 NA [4,] 3 -5 2 2 1 3 NA [5,] 1 4 -4 0 1 -1 NA [6,] 1 2 -1 -3 2 -3 NA [7,] 6 3 -5 -3 4 -1 NA [8,] 0 0 0 2 5 0 NA [9,] -1 2 2 -3 1 -1 NA [10,] 2 2 -7 -7 0 -2 NA [11,] -5 -2 2 -1 1 2 NA [12,] 0 -1 -4 2 1 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/187rx1425595371.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/2ze401425595371.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/3689m1425595371.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/4xtbp1425595371.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,] -23.0 -24 -24.0 -22.0 -19.0 -18.0 -17.0 -16 -14 -17.0 -24 -25 [2,] -20.0 -20 -24.0 -20.0 -19.0 -18.0 -16.0 -12 -11 -12.0 -14 -15 [3,] -15.5 -16 -12.5 -10.5 -11.5 -9.5 -11.5 -11 -10 -9.5 -12 -12 [4,] -4.0 -4 -8.0 -8.0 -6.0 -7.0 -7.0 -9 -7 -6.0 -6 -5 [5,] -3.0 1 -2.0 -1.0 1.0 -3.0 -4.0 -9 -4 -2.0 0 -2 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -25.820517 -26.320517 -22.820517 -18.240388 -19.88542 -16.595355 [2,] -5.179483 -5.679483 -2.179483 -2.759612 -3.11458 -2.404645 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -17.305291 -12.935097 -12.580129 -13.370194 -17.160258 -18.450323 [2,] -5.694709 -9.064903 -7.419871 -5.629806 -6.839742 -5.549677 $out [1] -4 $group [1] 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-23, -20, -15.5, -4, -3, -24, -20, -16, -4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/53hm31425595371.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,] -4 -7.0 -1.0 1 -4.0 -3 -5 0 -3 -7 -5 -4 [2,] -4 -4.0 0.0 1 -1.0 -3 -3 0 -1 -7 -2 -1 [3,] 0 -1.5 1.5 2 0.5 0 1 0 0 -1 0 0 [4,] 4 2.0 4.0 3 1.0 2 4 2 2 2 2 1 [5,] 6 8.0 5.0 3 4.0 2 6 5 2 2 2 2 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -5.160258 -5.370194 -1.080129 0.7099354 -0.7900646 -3.225161 -3.515226 [2,] 5.160258 2.370194 4.080129 3.2900646 1.7900646 3.225161 5.515226 [,8] [,9] [,10] [,11] [,12] [1,] -1.290065 -1.935097 -6.805291 -2.580129 -1.413195 [2,] 1.290065 1.935097 4.805291 2.580129 1.413195 $out [1] -5 $group [1] 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4, -4, 0, 4, 6, -7, -4, -1.5, 2, 8, -1, 0, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6j7cb1425595371.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,] -24.0 -15.0 -14.0 -25.0 -24.0 -14.0 NA [2,] -21.0 -13.0 -9.0 -18.5 -19.5 -11.5 NA [3,] -17.5 -7.5 -3.5 -15.0 -16.5 -9.5 NA [4,] -11.5 -3.0 -1.5 -12.0 -6.5 -6.5 NA [5,] -10.0 0.0 1.0 -10.0 -5.0 -4.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -21.83301 -12.061067 -6.92080034 -17.96469 -22.42939 -11.780534 NA [2,] -13.16699 -2.938933 -0.07919966 -12.03531 -10.57061 -7.219466 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(-24, -21, -17.5, -11.5, -10, -15, -13, -7.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7chr41425595371.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,] -13.833333 -12.50 -15.1250 [2,] -12.583333 -12.25 -12.9375 [3,] -11.250000 -11.50 -11.6250 [4,] -10.666667 -10.25 -10.5000 [5,] -9.333333 -9.50 -9.1250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] -12.1242 -12.41221 -12.73676 [2,] -10.3758 -10.58779 -10.51324 $out [1] -15.5 -16.0 $group [1] 2 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(-13.8333333333333, -12.5833333333333, -11.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/187rx1425595371.ps tmp/187rx1425595371.png",intern=TRUE)) character(0) > try(system("convert tmp/2ze401425595371.ps tmp/2ze401425595371.png",intern=TRUE)) character(0) > try(system("convert tmp/3689m1425595371.ps tmp/3689m1425595371.png",intern=TRUE)) character(0) > try(system("convert tmp/4xtbp1425595371.ps tmp/4xtbp1425595371.png",intern=TRUE)) character(0) > try(system("convert tmp/53hm31425595371.ps tmp/53hm31425595371.png",intern=TRUE)) character(0) > try(system("convert tmp/6j7cb1425595371.ps tmp/6j7cb1425595371.png",intern=TRUE)) character(0) > try(system("convert tmp/7chr41425595371.ps tmp/7chr41425595371.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.445 0.432 2.902