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(99.42,99.42,99.42,99.42,99.42,109.26,110,110,109.26,100.07,100.07,100.05,100.05,100.05,100.05,100.05,100.05,108.77,111.32,111.6,108.52,103.13,102.87,102.75,102.75,102.75,102.75,102.75,102.75,115.22,115.53,115.4,111.99,107.93,107.43,106.98,106.98,106.98,106.98,106.98,106.98,113.71,118.77,118.54,116.16,110.52,110.06,109.9,109.9,110.72,110.09,110.07,112.45,113.06,119.83,119.84,113.73,110.5,110.12,109.86,110.36,110.36,110.59,112.52,112.1,115.9,122.96,121.26,114.55,111.57,110.65,109.77,112.38,112.35,112.2,114.46,116.26,119.57,127.77,126.59,120.45,116.38,116.3,115.05) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 99.42 100.05 102.75 106.98 109.90 110.36 112.38 NA [2,] 99.42 100.05 102.75 106.98 110.72 110.36 112.35 NA [3,] 99.42 100.05 102.75 106.98 110.09 110.59 112.20 NA [4,] 99.42 100.05 102.75 106.98 110.07 112.52 114.46 NA [5,] 99.42 100.05 102.75 106.98 112.45 112.10 116.26 NA [6,] 109.26 108.77 115.22 113.71 113.06 115.90 119.57 NA [7,] 110.00 111.32 115.53 118.77 119.83 122.96 127.77 NA [8,] 110.00 111.60 115.40 118.54 119.84 121.26 126.59 NA [9,] 109.26 108.52 111.99 116.16 113.73 114.55 120.45 NA [10,] 100.07 103.13 107.93 110.52 110.50 111.57 116.38 NA [11,] 100.07 102.87 107.43 110.06 110.12 110.65 116.30 NA [12,] 100.05 102.75 106.98 109.90 109.86 109.77 115.05 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.00 0.00 0.00 0.00 0.82 0.00 -0.03 NA [2,] 0.00 0.00 0.00 0.00 -0.63 0.23 -0.15 NA [3,] 0.00 0.00 0.00 0.00 -0.02 1.93 2.26 NA [4,] 0.00 0.00 0.00 0.00 2.38 -0.42 1.80 NA [5,] 9.84 8.72 12.47 6.73 0.61 3.80 3.31 NA [6,] 0.74 2.55 0.31 5.06 6.77 7.06 8.20 NA [7,] 0.00 0.28 -0.13 -0.23 0.01 -1.70 -1.18 NA [8,] -0.74 -3.08 -3.41 -2.38 -6.11 -6.71 -6.14 NA [9,] -9.19 -5.39 -4.06 -5.64 -3.23 -2.98 -4.07 NA [10,] 0.00 -0.26 -0.50 -0.46 -0.38 -0.92 -0.08 NA [11,] -0.02 -0.12 -0.45 -0.16 -0.26 -0.88 -1.25 NA [12,] 0.00 0.00 0.00 0.00 0.50 2.61 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/1g8a21384773976.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/2vr1i1384773976.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/3ctiy1384773976.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/4c4nn1384773976.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,] 99.42 99.42 99.42 99.420 99.420 108.77 110.000 110.00 108.520 100.070 [2,] 101.40 101.40 101.40 101.400 101.400 111.16 113.425 113.50 110.625 105.530 [3,] 106.98 106.98 106.98 106.980 106.980 113.71 118.770 118.54 113.730 110.500 [4,] 110.13 110.54 110.34 111.295 112.275 115.56 121.395 120.55 115.355 111.045 [5,] 112.38 112.35 112.20 114.460 116.260 119.57 127.770 126.59 120.450 116.380 [,11] [,12] [1,] 100.070 100.050 [2,] 105.150 104.865 [3,] 110.060 109.770 [4,] 110.385 109.880 [5,] 116.300 115.050 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 101.7666 101.5217 101.6412 101.0709 100.4856 111.0824 114.0104 114.3299 [2,] 112.1934 112.4383 112.3188 112.8891 113.4744 116.3376 123.5296 122.7501 [,9] [,10] [,11] [,12] [1,] 110.9053 107.2065 106.9337 106.7751 [2,] 116.5547 113.7935 113.1863 112.7649 $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(99.42, 101.4, 106.98, 110.13, 112.38, 99.42, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5gaw11384773976.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] [1,] 0 -0.150 -0.020 -0.42 0.610 0.310 -1.700 -6.710 -5.640 -0.92 -1.250 [2,] 0 -0.075 0.000 0.00 3.555 1.645 -0.705 -6.125 -5.515 -0.48 -0.665 [3,] 0 0.000 0.000 0.00 6.730 5.060 -0.130 -3.410 -4.070 -0.38 -0.260 [4,] 0 0.000 0.965 0.90 9.280 6.915 0.005 -2.730 -3.645 -0.17 -0.140 [5,] 0 0.000 2.260 1.80 12.470 8.200 0.280 -0.740 -2.980 0.00 -0.020 [,12] [1,] 0.0 [2,] 0.0 [3,] 0.0 [4,] 0.5 [5,] 0.5 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0 -0.04478879 -0.5762824 -0.5374655 3.311122 1.912841 -0.5540005 [2,] 0 0.04478879 0.5762824 0.5374655 10.148878 8.207159 0.2940005 [,8] [,9] [,10] [,11] [,12] [1,] -5.437439 -5.186734 -0.565127 -0.57352153 -0.3225161 [2,] -1.382561 -2.953266 -0.194873 0.05352153 0.3225161 $out [1] 0.82 -0.03 -0.63 0.23 2.38 -9.19 2.61 $group [1] 1 1 2 2 4 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0, 0, 0, 0, -0.149999999999991, -0.0749999999999957, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6lgj31384773976.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] [1,] 99.42 100.050 102.750 106.980 109.860 109.770 112.20 NA [2,] 99.42 100.050 102.750 106.980 110.080 110.475 113.42 NA [3,] 100.06 102.810 107.205 109.980 110.610 111.835 116.28 NA [4,] 109.26 108.645 113.605 114.935 113.395 115.225 120.01 NA [5,] 110.00 111.600 115.530 118.770 113.730 121.260 127.77 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 95.57191 98.88976 102.254 106.3517 109.098 109.6685 113.2743 NA [2,] 104.54809 106.73024 112.156 113.6083 112.122 114.0015 119.2857 NA $out [1] 119.83 119.84 122.96 $group [1] 5 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(99.42, 99.42, 100.06, 109.26, 110, 100.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7zc9t1384773976.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,] 105.9771 106.980 105.7650 [2,] 106.3486 106.980 106.1587 [3,] 107.9900 109.915 107.5700 [4,] 113.5821 113.720 113.1750 [5,] 118.0257 118.770 117.4100 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 104.6907 106.8408 104.3698 [2,] 111.2893 112.9892 110.7702 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(105.977142857143, 106.348571428571, 107.99, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1g8a21384773976.ps tmp/1g8a21384773976.png",intern=TRUE)) character(0) > try(system("convert tmp/2vr1i1384773976.ps tmp/2vr1i1384773976.png",intern=TRUE)) character(0) > try(system("convert tmp/3ctiy1384773976.ps tmp/3ctiy1384773976.png",intern=TRUE)) character(0) > try(system("convert tmp/4c4nn1384773976.ps tmp/4c4nn1384773976.png",intern=TRUE)) character(0) > try(system("convert tmp/5gaw11384773976.ps tmp/5gaw11384773976.png",intern=TRUE)) character(0) > try(system("convert tmp/6lgj31384773976.ps tmp/6lgj31384773976.png",intern=TRUE)) character(0) > try(system("convert tmp/7zc9t1384773976.ps tmp/7zc9t1384773976.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.511 0.972 5.465