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(1.38,1.96,1.36,1.24,1.35,1.23,1.09,1.08,1.33,1.35,1.38,1.5,1.47,2.09,1.52,1.29,1.52,1.27,1.35,1.29,1.41,1.39,1.45,1.53,1.45,2.11,1.53,1.38,1.54,1.35,1.29,1.33,1.47,1.47,1.54,1.59,1.5,2,1.51,1.4,1.62,1.44,1.29,1.28,1.4,1.39,1.46,1.49,1.45,2.05,1.59,1.42,1.73,1.39,1.23,1.37,1.51,1.47,1.5,1.54,1.54,2.15,1.62,1.4,1.65,1.49,1.45,1.45,1.51,1.48,1.56,1.57,1.57,2.28,1.7,1.56,1.8,1.56,1.51,1.46,1.51,1.55,1.57,1.64) > 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,] 1.38 1.47 1.45 1.50 1.45 1.54 1.57 NA [2,] 1.96 2.09 2.11 2.00 2.05 2.15 2.28 NA [3,] 1.36 1.52 1.53 1.51 1.59 1.62 1.70 NA [4,] 1.24 1.29 1.38 1.40 1.42 1.40 1.56 NA [5,] 1.35 1.52 1.54 1.62 1.73 1.65 1.80 NA [6,] 1.23 1.27 1.35 1.44 1.39 1.49 1.56 NA [7,] 1.09 1.35 1.29 1.29 1.23 1.45 1.51 NA [8,] 1.08 1.29 1.33 1.28 1.37 1.45 1.46 NA [9,] 1.33 1.41 1.47 1.40 1.51 1.51 1.51 NA [10,] 1.35 1.39 1.47 1.39 1.47 1.48 1.55 NA [11,] 1.38 1.45 1.54 1.46 1.50 1.56 1.57 NA [12,] 1.50 1.53 1.59 1.49 1.54 1.57 1.64 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.58 0.62 0.66 0.50 0.60 0.61 0.71 NA [2,] -0.60 -0.57 -0.58 -0.49 -0.46 -0.53 -0.58 NA [3,] -0.12 -0.23 -0.15 -0.11 -0.17 -0.22 -0.14 NA [4,] 0.11 0.23 0.16 0.22 0.31 0.25 0.24 NA [5,] -0.12 -0.25 -0.19 -0.18 -0.34 -0.16 -0.24 NA [6,] -0.14 0.08 -0.06 -0.15 -0.16 -0.04 -0.05 NA [7,] -0.01 -0.06 0.04 -0.01 0.14 0.00 -0.05 NA [8,] 0.25 0.12 0.14 0.12 0.14 0.06 0.05 NA [9,] 0.02 -0.02 0.00 -0.01 -0.04 -0.03 0.04 NA [10,] 0.03 0.06 0.07 0.07 0.03 0.08 0.02 NA [11,] 0.12 0.08 0.05 0.03 0.04 0.01 0.07 NA [12,] -0.03 -0.08 -0.09 -0.04 0.00 0.00 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/1i8px1381745781.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/2hli41381745781.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/3790b1381745781.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/4g8ce1381745781.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,] 1.38 1.960 1.510 1.240 1.35 1.230 1.09 1.280 1.330 1.350 1.380 1.490 [2,] 1.45 2.025 1.515 1.335 1.53 1.310 1.26 1.285 1.405 1.390 1.455 1.515 [3,] 1.47 2.090 1.530 1.400 1.62 1.390 1.29 1.330 1.470 1.470 1.500 1.540 [4,] 1.52 2.130 1.605 1.410 1.69 1.465 1.40 1.410 1.510 1.475 1.550 1.580 [5,] 1.57 2.280 1.700 1.420 1.80 1.560 1.51 1.460 1.510 1.550 1.570 1.640 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.428197 2.027296 1.476253 1.355211 1.524451 1.297437 1.206394 1.255352 [2,] 1.511803 2.152704 1.583747 1.444789 1.715549 1.482563 1.373606 1.404648 [,9] [,10] [,11] [,12] [1,] 1.407296 1.419239 1.443268 1.501183 [2,] 1.532704 1.520761 1.556732 1.578817 $out [1] 1.36 1.56 1.08 $group [1] 3 4 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1.38, 1.45, 1.47, 1.52, 1.57, 1.96, 2.025, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5cqn71381745781.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.58 -0.60 -0.230 0.110 -0.340 -0.160 -0.06 0.05 -0.040 0.02 0.010 -0.090 [2,] 0.59 -0.58 -0.195 0.190 -0.245 -0.145 -0.03 0.09 -0.025 0.03 0.035 -0.080 [3,] 0.61 -0.57 -0.150 0.230 -0.190 -0.060 -0.01 0.12 -0.010 0.06 0.050 -0.035 [4,] 0.64 -0.51 -0.130 0.245 -0.170 -0.045 0.02 0.14 0.010 0.07 0.075 0.000 [5,] 0.71 -0.46 -0.110 0.310 -0.120 0.080 0.04 0.14 0.040 0.08 0.120 0.000 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.5801408 -0.6118029 -0.188817 0.1971549 -0.2347888 -0.1197183867 [2,] 0.6398592 -0.5281971 -0.111183 0.2628451 -0.1452112 -0.0002816133 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.03985919 0.09014081 -0.03090144 0.03611265 0.02611265 -0.08660258 [2,] 0.01985919 0.14985919 0.01090144 0.08388735 0.07388735 0.01660258 $out [1] 0.50 0.14 0.25 $group [1] 1 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.58, 0.59, 0.61, 0.64, 0.71, -0.6, -0.58, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6gtkt1381745781.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,] 1.080 1.27 1.290 1.280 1.230 1.400 1.460 NA [2,] 1.235 1.32 1.365 1.395 1.405 1.465 1.530 NA [3,] 1.350 1.43 1.470 1.450 1.485 1.525 1.565 NA [4,] 1.380 1.52 1.540 1.505 1.565 1.595 1.670 NA [5,] 1.500 1.53 1.590 1.620 1.730 1.650 1.800 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.283865 1.338779 1.390181 1.399828 1.412023 1.465706 1.501145 NA [2,] 1.416135 1.521221 1.549819 1.500172 1.557977 1.584294 1.628855 NA $out [1] 1.96 2.09 2.11 2.00 2.05 2.15 2.28 $group [1] 1 2 3 4 5 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(1.08, 1.235, 1.35, 1.38, 1.5, 1.27, 1.32, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7ahoj1381745781.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,] 1.315714 1.290 1.33000 [2,] 1.387143 1.395 1.38000 [3,] 1.464286 1.470 1.47125 [4,] 1.549286 1.535 1.55375 [5,] 1.601429 1.620 1.61000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.390331 1.406145 1.392001 [2,] 1.538240 1.533855 1.550499 $out [1] 2.091429 2.090000 2.077500 $group [1] 1 2 3 $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1i8px1381745781.ps tmp/1i8px1381745781.png",intern=TRUE)) character(0) > try(system("convert tmp/2hli41381745781.ps tmp/2hli41381745781.png",intern=TRUE)) character(0) > try(system("convert tmp/3790b1381745781.ps tmp/3790b1381745781.png",intern=TRUE)) character(0) > try(system("convert tmp/4g8ce1381745781.ps tmp/4g8ce1381745781.png",intern=TRUE)) character(0) > try(system("convert tmp/5cqn71381745781.ps tmp/5cqn71381745781.png",intern=TRUE)) character(0) > try(system("convert tmp/6gtkt1381745781.ps tmp/6gtkt1381745781.png",intern=TRUE)) character(0) > try(system("convert tmp/7ahoj1381745781.ps tmp/7ahoj1381745781.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.805 0.838 4.638