R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(85,82,92.4,100.3,105.2,104.5,105.1,105,106.5,106,99.4,107.4,89.6,85.3,96.3,107.7,112.7,110.1,110.4,111.6,113.3,109,106.5,113,95.6,93.8,106.4,116.6,119.1,120.9,117.3,117.6,115.3,112.3,107.7,113.4,94.3,97.8,106.6,113,122.4,114.6,115,118.7,110.4,111.6,105.1,107.5,92.9,91,100.2,112.2,116.5,111.2,113.3,112.2,102.2,105.3,96,101.3,86.2,84.4,93.4,104.8,106.2,101.9,105.5,106.4,103.9,108.6,96.4,102.2,90.3,88.5,100.2,111.6,111.5,112.9,110.7,105.5,110.7,108.9,101.3,109.6,94.4,91.4,105.8,112.9,116.1,113.7,112.9,110.7,114.3,109.7,105.7,114) > 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] 96 > (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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 85.0 89.6 95.6 94.3 92.9 86.2 90.3 94.4 NA [2,] 82.0 85.3 93.8 97.8 91.0 84.4 88.5 91.4 NA [3,] 92.4 96.3 106.4 106.6 100.2 93.4 100.2 105.8 NA [4,] 100.3 107.7 116.6 113.0 112.2 104.8 111.6 112.9 NA [5,] 105.2 112.7 119.1 122.4 116.5 106.2 111.5 116.1 NA [6,] 104.5 110.1 120.9 114.6 111.2 101.9 112.9 113.7 NA [7,] 105.1 110.4 117.3 115.0 113.3 105.5 110.7 112.9 NA [8,] 105.0 111.6 117.6 118.7 112.2 106.4 105.5 110.7 NA [9,] 106.5 113.3 115.3 110.4 102.2 103.9 110.7 114.3 NA [10,] 106.0 109.0 112.3 111.6 105.3 108.6 108.9 109.7 NA [11,] 99.4 106.5 107.7 105.1 96.0 96.4 101.3 105.7 NA [12,] 107.4 113.0 113.4 107.5 101.3 102.2 109.6 114.0 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -3.0 -4.3 -1.8 3.5 -1.9 -1.8 -1.8 -3.0 NA [2,] 10.4 11.0 12.6 8.8 9.2 9.0 11.7 14.4 NA [3,] 7.9 11.4 10.2 6.4 12.0 11.4 11.4 7.1 NA [4,] 4.9 5.0 2.5 9.4 4.3 1.4 -0.1 3.2 NA [5,] -0.7 -2.6 1.8 -7.8 -5.3 -4.3 1.4 -2.4 NA [6,] 0.6 0.3 -3.6 0.4 2.1 3.6 -2.2 -0.8 NA [7,] -0.1 1.2 0.3 3.7 -1.1 0.9 -5.2 -2.2 NA [8,] 1.5 1.7 -2.3 -8.3 -10.0 -2.5 5.2 3.6 NA [9,] -0.5 -4.3 -3.0 1.2 3.1 4.7 -1.8 -4.6 NA [10,] -6.6 -2.5 -4.6 -6.5 -9.3 -12.2 -7.6 -4.0 NA [11,] 8.0 6.5 5.7 2.4 5.3 5.8 8.3 8.3 NA [12,] -17.8 -17.4 -19.1 -14.6 -15.1 -11.9 -15.2 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/154uw1393506173.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/2pbq41393506173.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/3bqt71393506173.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/46usn1393506173.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,] 85.00 82.00 92.40 100.30 105.20 101.90 105.10 105.00 102.20 105.30 96.0 [2,] 87.90 84.85 94.85 106.25 108.85 107.30 107.95 105.95 105.20 107.30 97.9 [3,] 91.60 89.75 100.20 111.90 114.40 112.05 111.80 111.15 110.55 108.95 103.2 [4,] 94.35 92.60 106.10 112.95 117.80 114.15 114.15 114.90 113.80 110.65 106.1 [5,] 95.60 97.80 106.60 116.60 122.40 120.90 117.30 118.70 115.30 112.30 107.7 [,12] [1,] 101.30 [2,] 104.80 [3,] 108.55 [4,] 113.20 [5,] 114.00 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 87.99694 85.42074 93.91559 108.1573 109.4004 108.2235 108.3366 106.1504 [2,] 95.20306 94.07926 106.48441 115.6427 119.3996 115.8765 115.2634 116.1496 [,9] [,10] [,11] [,12] [1,] 105.7459 107.0786 98.61936 103.8576 [2,] 115.3541 110.8214 107.78064 113.2424 $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(85, 87.9, 91.6, 94.35, 95.6, 82, 84.85, 89.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/51qe91393506173.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.30 8.80 6.4 -0.10 -7.80 -3.60 -5.20 -10.00 -4.60 -12.20 2.40 -19.10 [2,] -3.00 9.10 7.5 1.95 -4.80 -1.50 -1.65 -5.40 -3.65 -8.45 5.50 -17.60 [3,] -1.85 10.70 10.8 3.75 -2.50 0.35 0.10 -0.40 -1.15 -6.55 6.15 -15.20 [4,] -1.80 12.15 11.4 4.95 0.35 1.35 1.05 2.65 2.15 -4.30 8.15 -14.85 [5,] -1.80 14.40 12.0 9.40 1.80 3.60 3.70 5.20 4.70 -2.50 8.30 -11.90 $n [1] 8 8 8 8 8 8 8 8 8 8 8 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -2.520337 8.996226 8.621404 2.074157 -5.3768639 -1.242051 -1.408259 [2,] -1.179663 12.403774 12.978596 5.425843 0.3768639 1.942051 1.608259 [,8] [,9] [,10] [,11] [,12] [1,] -4.896846 -4.389963 -8.86825 4.669672 -16.84226 [2,] 4.096846 2.089963 -4.23175 7.630328 -13.55774 $out [1] 3.5 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4.3, -3, -1.85, -1.8, -1.8, 8.8, 9.1, 10.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ymoy1393506173.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,] 82.00 85.30 93.80 94.30 91.00 84.40 88.50 94.40 NA [2,] 95.90 101.40 107.05 105.85 98.10 94.90 100.75 105.75 NA [3,] 104.75 109.55 114.35 111.00 103.75 103.05 109.25 111.80 NA [4,] 105.60 112.15 117.45 114.80 112.20 105.85 111.10 113.85 NA [5,] 107.40 113.30 120.90 122.40 116.50 108.60 112.90 116.10 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 100.3258 104.6469 109.6065 106.9178 97.3189 98.05563 104.5293 108.1055 [2,] 109.1742 114.4531 119.0935 115.0822 110.1811 108.04437 113.9707 115.4945 [,9] [1,] NA [2,] NA $out [1] 91.4 $group [1] 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(82, 95.9, 104.75, 105.6, 107.4, 85.3, 101.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/74uo41393506173.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,] 89.2750 89.75 88.5375 [2,] 101.2125 101.70 101.5187 [3,] 109.2500 109.75 109.6500 [4,] 111.0938 111.85 110.6313 [5,] 113.7125 114.40 113.6625 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 104.7431 105.1205 105.4937 [2,] 113.7569 114.3795 113.8063 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(89.275, 101.2125, 109.25, 111.09375, 113.7125, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/154uw1393506173.ps tmp/154uw1393506173.png",intern=TRUE)) character(0) > try(system("convert tmp/2pbq41393506173.ps tmp/2pbq41393506173.png",intern=TRUE)) character(0) > try(system("convert tmp/3bqt71393506173.ps tmp/3bqt71393506173.png",intern=TRUE)) character(0) > try(system("convert tmp/46usn1393506173.ps tmp/46usn1393506173.png",intern=TRUE)) character(0) > try(system("convert tmp/51qe91393506173.ps tmp/51qe91393506173.png",intern=TRUE)) character(0) > try(system("convert tmp/6ymoy1393506173.ps tmp/6ymoy1393506173.png",intern=TRUE)) character(0) > try(system("convert tmp/74uo41393506173.ps tmp/74uo41393506173.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.878 0.936 5.831