R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 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(46.56,46.72,47.01,47.26,47.49,47.51,47.52,47.66,47.71,47.87,48,48,48.05,48.25,48.72,48.94,49.16,49.18,49.25,49.34,49.49,49.57,49.63,49.67,49.7,49.8,50.09,50.49,50.73,51.12,51.15,51.41,51.61,52.06,52.17,52.18,52.19,52.74,53.05,53.38,53.78,53.82,53.88,53.96,54.14,54.2,54.35,54.36,54.39,54.77,54.91,55.06,55.38,55.41,55.47,55.58,55.67,55.97,56.03,56.06,56.08,56.43,56.65,56.96,57.37,57.51,57.61,57.7,57.91,58.12,58.18,58.16) > 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,] 46.56 48.05 49.70 52.19 54.39 56.08 NA [2,] 46.72 48.25 49.80 52.74 54.77 56.43 NA [3,] 47.01 48.72 50.09 53.05 54.91 56.65 NA [4,] 47.26 48.94 50.49 53.38 55.06 56.96 NA [5,] 47.49 49.16 50.73 53.78 55.38 57.37 NA [6,] 47.51 49.18 51.12 53.82 55.41 57.51 NA [7,] 47.52 49.25 51.15 53.88 55.47 57.61 NA [8,] 47.66 49.34 51.41 53.96 55.58 57.70 NA [9,] 47.71 49.49 51.61 54.14 55.67 57.91 NA [10,] 47.87 49.57 52.06 54.20 55.97 58.12 NA [11,] 48.00 49.63 52.17 54.35 56.03 58.18 NA [12,] 48.00 49.67 52.18 54.36 56.06 58.16 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.16 0.20 0.10 0.55 0.38 0.35 NA [2,] 0.29 0.47 0.29 0.31 0.14 0.22 NA [3,] 0.25 0.22 0.40 0.33 0.15 0.31 NA [4,] 0.23 0.22 0.24 0.40 0.32 0.41 NA [5,] 0.02 0.02 0.39 0.04 0.03 0.14 NA [6,] 0.01 0.07 0.03 0.06 0.06 0.10 NA [7,] 0.14 0.09 0.26 0.08 0.11 0.09 NA [8,] 0.05 0.15 0.20 0.18 0.09 0.21 NA [9,] 0.16 0.08 0.45 0.06 0.30 0.21 NA [10,] 0.13 0.06 0.11 0.15 0.06 0.06 NA [11,] 0.00 0.04 0.01 0.01 0.03 -0.02 NA [12,] 0.05 0.03 0.01 0.03 0.02 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/1c1bu1356529478.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/296t41356529478.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/3a41y1356529478.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/4s2lk1356529478.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,] 46.560 46.72 47.01 47.260 47.490 47.51 47.520 47.660 47.710 47.87 48.00 [2,] 48.050 48.25 48.72 48.940 49.160 49.18 49.250 49.340 49.490 49.57 49.63 [3,] 50.945 51.27 51.57 51.935 52.255 52.47 52.515 52.685 52.875 53.13 53.26 [4,] 54.390 54.77 54.91 55.060 55.380 55.41 55.470 55.580 55.670 55.97 56.03 [5,] 56.080 56.43 56.65 56.960 57.370 57.51 57.610 57.700 57.910 58.12 58.18 [,12] [1,] 48.00 [2,] 49.67 [3,] 53.27 [4,] 56.06 [5,] 58.16 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 46.8555 47.06439 47.57725 47.9874 48.2429 48.45145 48.5029 48.66 48.8887 [2,] 55.0345 55.47561 55.56275 55.8826 56.2671 56.48855 56.5271 56.71 56.8613 [,10] [,11] [,12] [1,] 49.00179 49.13179 49.14824 [2,] 57.25821 57.38821 57.39176 $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(46.56, 48.05, 50.945, 54.39, 56.08, 46.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56pql1356529478.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,] 0.100 0.14 0.15 0.22 0.020 0.01 0.08 0.050 0.060 0.060 -0.02 0.01 [2,] 0.160 0.22 0.22 0.23 0.020 0.03 0.09 0.090 0.080 0.060 0.00 0.02 [3,] 0.275 0.29 0.28 0.28 0.035 0.06 0.10 0.165 0.185 0.085 0.01 0.03 [4,] 0.380 0.31 0.33 0.40 0.140 0.07 0.14 0.200 0.300 0.130 0.03 0.03 [5,] 0.550 0.31 0.40 0.41 0.140 0.10 0.14 0.210 0.450 0.150 0.04 0.03 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.1330929 0.2319471 0.2090464 0.1703445 -0.04240388 0.03419871 0.06774839 [2,] 0.4169071 0.3480529 0.3509536 0.3896555 0.11240388 0.08580129 0.13225161 [,8] [,9] [,10] [,11] [,12] [1,] 0.09404645 0.04309289 0.03984774 -0.009350969 0.02293403 [2,] 0.23595355 0.32690711 0.13015226 0.029350969 0.03706597 $out [1] 0.47 0.39 0.26 0.05 $group [1] 2 5 7 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.0999999999999943, 0.159999999999997, 0.275000000000002, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6cym11356529478.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,] 46.560 48.050 49.700 52.190 54.390 56.080 NA [2,] 47.135 48.830 50.290 53.215 54.985 56.805 NA [3,] 47.515 49.215 51.135 53.850 55.440 57.560 NA [4,] 47.790 49.530 51.835 54.170 55.820 58.015 NA [5,] 48.000 49.670 52.180 54.360 56.060 58.180 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 47.21625 48.89573 50.43032 53.41442 55.05915 57.00811 NA [2,] 47.81375 49.53427 51.83968 54.28558 55.82085 58.11189 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(46.56, 47.135, 47.515, 47.79, 48, 48.05, 48.83, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7ikeg1356529478.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,] 51.16167 50.9450 51.15125 [2,] 51.87667 51.7525 51.86875 [3,] 52.45250 52.4925 52.36875 [4,] 52.86000 53.0025 52.75687 [5,] 53.07167 53.2700 52.96625 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 52.004 51.92237 51.96367 [2,] 52.901 53.06263 52.77383 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(51.1616666666667, 51.8766666666667, 52.4525, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1c1bu1356529478.ps tmp/1c1bu1356529478.png",intern=TRUE)) character(0) > try(system("convert tmp/296t41356529478.ps tmp/296t41356529478.png",intern=TRUE)) character(0) > try(system("convert tmp/3a41y1356529478.ps tmp/3a41y1356529478.png",intern=TRUE)) character(0) > try(system("convert tmp/4s2lk1356529478.ps tmp/4s2lk1356529478.png",intern=TRUE)) character(0) > try(system("convert tmp/56pql1356529478.ps tmp/56pql1356529478.png",intern=TRUE)) character(0) > try(system("convert tmp/6cym11356529478.ps tmp/6cym11356529478.png",intern=TRUE)) character(0) > try(system("convert tmp/7ikeg1356529478.ps tmp/7ikeg1356529478.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.492 0.565 4.251