R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(115.43,115.55,117.14,119.09,119.55,119.8,121.32,121.48,119.63,118.61,118.82,119.93,118.7,119.99,116.67,116.84,115.17,114.21,114.77,115.59,116.64,118.79,125.63,127.42,131.17,137.68,144.41,146.09,151.26,156.56,158.38,154.21,158.06,154.83,150.89,149.22,148.34,143.88,134.48,133.73,130.08,123.11,122.08,126.83,123.17,123.82,125.6,126.32,129.15,130.09,133.81,136.83,138.34,138.67,137.86,138.56,141.65,142.42,143.12,146.17,147.8,151.87,157.12,158.97,161.4,165.81,165.1,164.64,167.88,167.14,169.83,169.71) > 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,] 115.43 118.70 131.17 148.34 129.15 147.80 NA [2,] 115.55 119.99 137.68 143.88 130.09 151.87 NA [3,] 117.14 116.67 144.41 134.48 133.81 157.12 NA [4,] 119.09 116.84 146.09 133.73 136.83 158.97 NA [5,] 119.55 115.17 151.26 130.08 138.34 161.40 NA [6,] 119.80 114.21 156.56 123.11 138.67 165.81 NA [7,] 121.32 114.77 158.38 122.08 137.86 165.10 NA [8,] 121.48 115.59 154.21 126.83 138.56 164.64 NA [9,] 119.63 116.64 158.06 123.17 141.65 167.88 NA [10,] 118.61 118.79 154.83 123.82 142.42 167.14 NA [11,] 118.82 125.63 150.89 125.60 143.12 169.83 NA [12,] 119.93 127.42 149.22 126.32 146.17 169.71 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.12 1.29 6.51 -4.46 0.94 4.07 NA [2,] 1.59 -3.32 6.73 -9.40 3.72 5.25 NA [3,] 1.95 0.17 1.68 -0.75 3.02 1.85 NA [4,] 0.46 -1.67 5.17 -3.65 1.51 2.43 NA [5,] 0.25 -0.96 5.30 -6.97 0.33 4.41 NA [6,] 1.52 0.56 1.82 -1.03 -0.81 -0.71 NA [7,] 0.16 0.82 -4.17 4.75 0.70 -0.46 NA [8,] -1.85 1.05 3.85 -3.66 3.09 3.24 NA [9,] -1.02 2.15 -3.23 0.65 0.77 -0.74 NA [10,] 0.21 6.84 -3.94 1.78 0.70 2.69 NA [11,] 1.11 1.79 -1.67 0.72 3.05 -0.12 NA [12,] -1.23 3.75 -0.88 2.83 1.63 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/www/rcomp/tmp/1zd1o1338235671.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/www/rcomp/tmp/2dux81338235671.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/www/rcomp/tmp/3myzt1338235671.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/www/rcomp/tmp/4cyjz1338235671.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,] 115.43 115.550 116.670 116.84 115.17 114.21 114.77 115.590 116.64 118.61 [2,] 118.70 119.990 117.140 119.09 119.55 119.80 121.32 121.480 119.63 118.79 [3,] 130.16 133.885 134.145 135.28 134.21 130.89 129.97 132.695 132.41 133.12 [4,] 147.80 143.880 144.410 146.09 151.26 156.56 158.38 154.210 158.06 154.83 [5,] 148.34 151.870 157.120 158.97 161.40 165.81 165.10 164.640 167.88 167.14 [,11] [,12] [1,] 118.820 119.930 [2,] 125.600 126.320 [3,] 134.375 136.795 [4,] 150.890 149.220 [5,] 169.830 169.710 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 111.3896 118.4752 116.5550 117.8641 113.7560 107.1786 106.0651 111.5831 [2,] 148.9304 149.2948 151.7350 152.6959 154.6640 154.6014 153.8749 153.8069 [,9] [,10] [,11] [,12] [1,] 107.6214 109.8730 118.0621 122.0238 [2,] 157.1986 156.3670 150.6879 151.5662 $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(115.43, 118.7, 130.16, 147.8, 148.34, 115.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5ebq81338235671.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,] -4.460 -9.400 -0.750 -3.650 -6.97 -1.030 -0.46 -3.66 -3.230 0.21 -1.670 [2,] 0.120 -3.320 0.170 -1.670 -0.96 -0.810 -0.46 -1.85 -1.020 0.21 -0.120 [3,] 1.115 2.655 1.765 0.985 0.29 -0.075 0.43 2.07 -0.045 1.24 0.915 [4,] 4.070 5.250 1.950 2.430 4.41 1.520 0.82 3.24 0.770 2.69 1.790 [5,] 6.510 6.730 3.020 5.170 5.30 1.820 0.82 3.85 2.150 2.69 3.050 [,12] [1,] -1.23 [2,] -0.88 [3,] 1.63 [4,] 2.83 [5,] 3.75 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -1.432878 -2.872927 0.6168425 -1.659632 -3.173823 -1.577925 -0.3956413 [2,] 3.662878 8.182927 2.9131575 3.629632 3.753823 1.427925 1.2556413 [,8] [,9] [,10] [,11] [,12] [1,] -1.213214 -1.199608 -0.3596801 -0.3170117 -0.9914767 [2,] 5.353214 1.109608 2.8396801 2.1470117 4.2514767 $out [1] -4.17 4.75 6.84 -3.94 $group [1] 7 7 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4.46000000000001, 0.119999999999990, 1.11499999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6pjbj1338235671.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,] 115.430 114.210 131.170 122.080 129.150 147.800 NA [2,] 117.875 115.380 145.250 123.495 135.320 158.045 NA [3,] 119.320 116.755 151.075 126.575 138.450 164.870 NA [4,] 119.865 119.390 155.695 134.105 142.035 167.510 NA [5,] 121.480 119.990 158.380 148.340 146.170 169.830 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 118.4123 114.9260 146.3110 121.7357 135.3872 160.5529 NA [2,] 120.2277 118.5840 155.8390 131.4143 141.5128 169.1871 NA $out [1] 125.63 127.42 $group [1] 2 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(115.43, 117.875, 119.32, 119.865, 121.48, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/79pm51338235671.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,] 131.7650 129.9700 131.6175 [2,] 134.5983 131.6500 132.8700 [3,] 136.4725 133.5025 136.1225 [4,] 137.7200 134.2925 137.2569 [5,] 139.7950 136.7950 137.5263 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 135.0487 132.2972 134.1216 [2,] 137.8963 134.7078 138.1234 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(131.765, 134.598333333333, 136.4725, 137.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zd1o1338235671.ps tmp/1zd1o1338235671.png",intern=TRUE)) character(0) > try(system("convert tmp/2dux81338235671.ps tmp/2dux81338235671.png",intern=TRUE)) character(0) > try(system("convert tmp/3myzt1338235671.ps tmp/3myzt1338235671.png",intern=TRUE)) character(0) > try(system("convert tmp/4cyjz1338235671.ps tmp/4cyjz1338235671.png",intern=TRUE)) character(0) > try(system("convert tmp/5ebq81338235671.ps tmp/5ebq81338235671.png",intern=TRUE)) character(0) > try(system("convert tmp/6pjbj1338235671.ps tmp/6pjbj1338235671.png",intern=TRUE)) character(0) > try(system("convert tmp/79pm51338235671.ps tmp/79pm51338235671.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.520 1.120 2.581