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(47.43,47.43,47.51,47.96,47.99,48.05,48.05,48.01,48,48.06,48.23,48.4,48.4,48.5,48.41,48.35,48.53,48.52,48.52,48.49,48.45,48.65,48.74,48.74,48.74,48.79,48.82,48.82,49.2,49.3,49.3,49.34,49.47,49.65,49.7,49.75,49.75,49.7,50.09,50.19,50.53,50.55,50.55,50.55,50.58,50.61,50.94,51.01,51.01,51.04,51.15,51.31,51.31,51.34,51.34,51.34,51.47,51.95,51.97,51.92,51.92,51.91,51.97,52.14,52.33,52.4,52.4,52.41,52.71,53.17,53.33,53.32,53.32,53.3,53.31,53.72,53.87,53.91,53.91,53.96,54.02,54.33,54.48,54.54) > 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,] 47.43 48.40 48.74 49.75 51.01 51.92 53.32 NA [2,] 47.43 48.50 48.79 49.70 51.04 51.91 53.30 NA [3,] 47.51 48.41 48.82 50.09 51.15 51.97 53.31 NA [4,] 47.96 48.35 48.82 50.19 51.31 52.14 53.72 NA [5,] 47.99 48.53 49.20 50.53 51.31 52.33 53.87 NA [6,] 48.05 48.52 49.30 50.55 51.34 52.40 53.91 NA [7,] 48.05 48.52 49.30 50.55 51.34 52.40 53.91 NA [8,] 48.01 48.49 49.34 50.55 51.34 52.41 53.96 NA [9,] 48.00 48.45 49.47 50.58 51.47 52.71 54.02 NA [10,] 48.06 48.65 49.65 50.61 51.95 53.17 54.33 NA [11,] 48.23 48.74 49.70 50.94 51.97 53.33 54.48 NA [12,] 48.40 48.74 49.75 51.01 51.92 53.32 54.54 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.00 0.10 0.05 -0.05 0.03 -0.01 -0.02 NA [2,] 0.08 -0.09 0.03 0.39 0.11 0.06 0.01 NA [3,] 0.45 -0.06 0.00 0.10 0.16 0.17 0.41 NA [4,] 0.03 0.18 0.38 0.34 0.00 0.19 0.15 NA [5,] 0.06 -0.01 0.10 0.02 0.03 0.07 0.04 NA [6,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 NA [7,] -0.04 -0.03 0.04 0.00 0.00 0.01 0.05 NA [8,] -0.01 -0.04 0.13 0.03 0.13 0.30 0.06 NA [9,] 0.06 0.20 0.18 0.03 0.48 0.46 0.31 NA [10,] 0.17 0.09 0.05 0.33 0.02 0.16 0.15 NA [11,] 0.17 0.00 0.05 0.07 -0.05 -0.01 0.06 NA [12,] 0.00 0.00 0.00 0.00 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/1rnd01381746294.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/2jm2u1381746294.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/35xcb1381746294.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/47d171381746294.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,] 47.430 47.430 47.510 47.960 47.990 48.05 48.05 48.010 48.00 48.06 48.23 [2,] 48.570 48.645 48.615 48.585 48.865 48.91 48.91 48.915 48.96 49.15 49.22 [3,] 49.750 49.700 50.090 50.190 50.530 50.55 50.55 50.550 50.58 50.61 50.94 [4,] 51.465 51.475 51.560 51.725 51.820 51.87 51.87 51.875 52.09 52.56 52.65 [5,] 53.320 53.300 53.310 53.720 53.870 53.91 53.91 53.960 54.02 54.33 54.48 [,12] [1,] 48.400 [2,] 49.245 [3,] 51.010 [4,] 52.620 [5,] 54.540 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 48.02115 48.00997 48.33129 48.31484 48.76532 48.78234 48.78234 48.78234 [2,] 51.47885 51.39003 51.84871 52.06516 52.29468 52.31766 52.31766 52.31766 [,9] [,10] [,11] [,12] [1,] 48.71081 48.5736 48.89166 48.9945 [2,] 52.44919 52.6464 52.98834 53.0255 $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(47.43, 48.57, 49.75, 51.465, 53.32, 47.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/50v8y1381746294.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.050 -0.090 -0.06 0.000 -0.010 0 -0.040 -0.04 0.030 0.020 -0.050 [2,] -0.015 0.020 0.05 0.090 0.025 0 -0.015 0.01 0.120 0.070 -0.005 [3,] 0.000 0.060 0.16 0.180 0.040 0 0.000 0.06 0.200 0.150 0.050 [4,] 0.040 0.095 0.29 0.265 0.065 0 0.025 0.13 0.385 0.165 0.065 [5,] 0.100 0.110 0.45 0.380 0.100 0 0.050 0.30 0.480 0.170 0.170 [,12] [1,] 0 [2,] 0 [3,] 0 [4,] 0 [5,] 0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.03284511 0.01521121 0.01667587 0.07549282 0.01611265 0 -0.02388735 [2,] 0.03284511 0.10478879 0.30332413 0.28450718 0.06388735 0 0.02388735 [,8] [,9] [,10] [,11] [,12] [1,] -0.01166206 0.04174628 0.09326753 0.008197129 0 [2,] 0.13166206 0.35825372 0.20673247 0.091802871 0 $out [1] 0.39 0.33 $group [1] 2 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0499999999999972, -0.0150000000000041, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6r2491381746294.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,] 47.430 48.35 48.74 49.700 51.010 51.910 53.300 NA [2,] 47.735 48.43 48.82 50.140 51.230 52.055 53.520 NA [3,] 48.005 48.51 49.30 50.550 51.340 52.400 53.910 NA [4,] 48.055 48.59 49.56 50.595 51.695 52.940 54.175 NA [5,] 48.400 48.74 49.75 51.010 51.970 53.330 54.540 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 47.85905 48.43702 48.96248 50.34247 51.12791 51.99635 53.61125 NA [2,] 48.15095 48.58298 49.63752 50.75753 51.55209 52.80365 54.20875 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(47.43, 47.735, 48.005, 48.055, 48.4, 48.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/71pxz1381746294.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,] 50.08143 49.700 50.01750 [2,] 50.26786 50.140 50.12125 [3,] 50.58143 50.550 50.39000 [4,] 50.79429 50.595 50.69000 [5,] 51.09714 51.010 50.93500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 50.34132 50.34247 50.13059 [2,] 50.82154 50.75753 50.64941 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(50.0814285714286, 50.2678571428571, 50.5814285714286, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1rnd01381746294.ps tmp/1rnd01381746294.png",intern=TRUE)) character(0) > try(system("convert tmp/2jm2u1381746294.ps tmp/2jm2u1381746294.png",intern=TRUE)) character(0) > try(system("convert tmp/35xcb1381746294.ps tmp/35xcb1381746294.png",intern=TRUE)) character(0) > try(system("convert tmp/47d171381746294.ps tmp/47d171381746294.png",intern=TRUE)) character(0) > try(system("convert tmp/50v8y1381746294.ps tmp/50v8y1381746294.png",intern=TRUE)) character(0) > try(system("convert tmp/6r2491381746294.ps tmp/6r2491381746294.png",intern=TRUE)) character(0) > try(system("convert tmp/71pxz1381746294.ps tmp/71pxz1381746294.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.480 0.759 4.227