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(19,14,15,7,12,12,14,9,8,4,7,3,5,0,-2,6,11,9,17,21,21,41,57,65,68,73,71,71,70,69,65,57,57,57,55,65,65,64,60,43,47,40,31,27,24,23,17,16,15,8,5,6,5,12,8,17,22,24,36,31,34,47,33,35,31,35,39,46,40,50,62,57,62,57) > 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] 74 > (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 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 19 5 68 65 15 34 62 [2,] 14 0 73 64 8 47 57 [3,] 15 -2 71 60 5 33 NA [4,] 7 6 71 43 6 35 NA [5,] 12 11 70 47 5 31 NA [6,] 12 9 69 40 12 35 NA [7,] 14 17 65 31 8 39 NA [8,] 9 21 57 27 17 46 NA [9,] 8 21 57 24 22 40 NA [10,] 4 41 57 23 24 50 NA [11,] 7 57 55 17 36 62 NA [12,] 3 65 65 16 31 57 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -5 -5 5 -1 -7 13 -5 [2,] 1 -2 -2 -4 -3 -14 NA [3,] -8 8 0 -17 1 2 NA [4,] 5 5 -1 4 -1 -4 NA [5,] 0 -2 -1 -7 7 4 NA [6,] 2 8 -4 -9 -4 4 NA [7,] -5 4 -8 -4 9 7 NA [8,] -1 0 0 -3 5 -6 NA [9,] -4 20 0 -1 2 10 NA [10,] 3 16 -2 -6 12 12 NA [11,] -4 8 10 -1 -5 -5 NA [12,] 2 3 0 -1 3 5 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/1qqka1369218726.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/276cv1369218726.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/3dmoc1369218726.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/4ek311369218726.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.0 0.0 -2 6 5.0 9.0 8 9 8 4.0 7.0 3 [2,] 17.0 11.0 5 6 11.0 12.0 14 17 21 23.0 17.0 16 [3,] 34.0 47.0 24 21 21.5 23.5 24 24 23 32.5 45.5 44 [4,] 63.5 60.5 60 43 47.0 40.0 39 46 40 50.0 57.0 65 [5,] 68.0 73.0 71 71 70.0 69.0 65 57 57 57.0 62.0 65 $n [1] 7 7 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6.23095 17.4394 -11.47678 -2.866195 -1.721163 5.439096 7.874193 [2,] 61.76905 76.5606 59.47678 44.866195 44.721163 41.560904 40.125807 [,8] [,9] [,10] [,11] [,12] [1,] 5.294063 10.74439 15.08413 19.69871 12.39342 [2,] 42.705937 35.25561 49.91587 71.30129 75.60658 $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, 17, 34, 63.5, 68, 0, 11, 47, 60.5, 73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56djo1369218726.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,] -7 -4.0 -17.0 -4.0 -7.0 -9 -8 -6.0 -4 -6.0 -5.0 -1.0 [2,] -5 -4.0 -8.0 -1.0 -2.0 -4 -5 -3.0 -1 -2.0 -5.0 0.0 [3,] -5 -2.5 0.5 1.5 -0.5 -1 0 -0.5 1 7.5 -2.5 2.5 [4,] 2 -2.0 2.0 5.0 4.0 4 7 0.0 10 12.0 8.0 3.0 [5,] 5 1.0 8.0 5.0 7.0 8 9 0.0 20 16.0 10.0 5.0 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -9.1802871 -3.790065 -5.950323 -2.370194 -4.370194 -6.160258 -7.740388 [2,] -0.8197129 -1.209935 6.950323 5.370194 3.370194 4.160258 7.740388 [,8] [,9] [,10] [,11] [,12] [1,] -2.435097 -6.095355 -1.530452 -10.88542 0.5649031 [2,] 1.435097 8.095355 16.530452 5.88542 4.4350969 $out [1] 13 -14 5 $group [1] 1 2 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-7, -5, -5, 2, 5, -4, -4, -2.5, -2, 1, -17, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6865d1369218726.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,] 3.0 -2.0 55.0 16.0 5.0 31.0 57.0 [2,] 7.0 5.5 57.0 23.5 7.0 34.5 57.0 [3,] 10.5 14.0 66.5 35.5 13.5 39.5 59.5 [4,] 14.0 31.0 70.5 53.5 23.0 48.5 62.0 [5,] 19.0 65.0 73.0 65.0 36.0 62.0 62.0 $n [1] 12 12 12 12 12 12 2 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 7.307253 2.369279 60.34256 21.8168 6.202293 33.11451 53.91386 [2,] 13.692747 25.630721 72.65744 49.1832 20.797707 45.88549 65.08614 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(3, 7, 10.5, 14, 19, -2, 5.5, 14, 31, 65, 55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7kxaw1369218726.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,] 28.00000 21.00 23.6250 [2,] 29.16667 23.25 26.5000 [3,] 29.91667 24.00 30.0000 [4,] 37.92857 39.00 37.4375 [5,] 39.50000 47.00 41.3750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 25.92030 16.81632 25.01133 [2,] 33.91303 31.18368 34.98867 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(28, 29.1666666666667, 29.9166666666667, 37.9285714285714, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qqka1369218726.ps tmp/1qqka1369218726.png",intern=TRUE)) character(0) > try(system("convert tmp/276cv1369218726.ps tmp/276cv1369218726.png",intern=TRUE)) character(0) > try(system("convert tmp/3dmoc1369218726.ps tmp/3dmoc1369218726.png",intern=TRUE)) character(0) > try(system("convert tmp/4ek311369218726.ps tmp/4ek311369218726.png",intern=TRUE)) character(0) > try(system("convert tmp/56djo1369218726.ps tmp/56djo1369218726.png",intern=TRUE)) character(0) > try(system("convert tmp/6865d1369218726.ps tmp/6865d1369218726.png",intern=TRUE)) character(0) > try(system("convert tmp/7kxaw1369218726.ps tmp/7kxaw1369218726.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.562 0.955 5.571