R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" 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(227.81,227.81,227.01,227.26,227.1,227.59,227.59,227.7,227.75,226.33,225.95,226.33,226.33,226.22,224.84,221.88,222.37,221.8,221.8,221.8,221.9,220.2,219.95,220.05,220.05,220.05,220.62,221.53,221.61,221.5,221.5,221.87,222.27,220.86,221.49,221.67,221.67,221.72,221.67,220.29,220.75,219.59,219.59,219.59,219.82,221.59,220.9,221.01,221.01,219.69,221,219.82,218.04,217.97,217.97,217.53,217,217.18,217.68,217.71,217.71,218.5,218.8,218.94,220,219.89,219.89,220.08,220.16,221,222.16,221.5) > 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,] 227.81 226.33 220.05 221.67 221.01 217.71 NA [2,] 227.81 226.22 220.05 221.72 219.69 218.50 NA [3,] 227.01 224.84 220.62 221.67 221.00 218.80 NA [4,] 227.26 221.88 221.53 220.29 219.82 218.94 NA [5,] 227.10 222.37 221.61 220.75 218.04 220.00 NA [6,] 227.59 221.80 221.50 219.59 217.97 219.89 NA [7,] 227.59 221.80 221.50 219.59 217.97 219.89 NA [8,] 227.70 221.80 221.87 219.59 217.53 220.08 NA [9,] 227.75 221.90 222.27 219.82 217.00 220.16 NA [10,] 226.33 220.20 220.86 221.59 217.18 221.00 NA [11,] 225.95 219.95 221.49 220.90 217.68 222.16 NA [12,] 226.33 220.05 221.67 221.01 217.71 221.50 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.00 -0.11 0.00 0.05 -1.32 0.79 NA [2,] -0.80 -1.38 0.57 -0.05 1.31 0.30 NA [3,] 0.25 -2.96 0.91 -1.38 -1.18 0.14 NA [4,] -0.16 0.49 0.08 0.46 -1.78 1.06 NA [5,] 0.49 -0.57 -0.11 -1.16 -0.07 -0.11 NA [6,] 0.00 0.00 0.00 0.00 0.00 0.00 NA [7,] 0.11 0.00 0.37 0.00 -0.44 0.19 NA [8,] 0.05 0.10 0.40 0.23 -0.53 0.08 NA [9,] -1.42 -1.70 -1.41 1.77 0.18 0.84 NA [10,] -0.38 -0.25 0.63 -0.69 0.50 1.16 NA [11,] 0.38 0.10 0.18 0.11 0.03 -0.66 NA [12,] 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/18nxc1351778757.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/2murc1351778757.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/3h1pq1351778757.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/4z1z61351778757.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,] 217.71 218.500 218.800 218.94 218.04 217.970 217.970 217.53 217.00 220.20 [2,] 220.05 219.690 220.620 219.82 220.00 219.590 219.590 219.59 219.82 220.20 [3,] 221.34 220.885 221.335 220.91 221.18 220.695 220.695 220.94 221.03 220.93 [4,] 226.33 226.220 224.840 221.88 222.37 221.800 221.800 221.87 222.27 221.59 [5,] 227.81 227.810 227.010 221.88 222.37 221.800 221.800 221.87 222.27 221.59 [,11] [,12] [1,] 217.680 217.710 [2,] 219.950 220.050 [3,] 221.195 221.255 [4,] 222.160 221.670 [5,] 222.160 221.670 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 217.2892 216.6729 218.613 219.5812 219.6513 219.2695 219.2695 219.4693 [2,] 225.3908 225.0971 224.057 222.2388 222.7087 222.1205 222.1205 222.4107 [,9] [,10] [,11] [,12] [1,] 219.4497 220.0334 219.7695 220.21 [2,] 222.6103 221.8266 222.6205 222.30 $out [1] 227.26 227.10 227.59 227.59 227.70 227.75 226.33 217.18 225.95 226.33 $group [1] 4 5 6 7 8 9 10 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(217.71, 220.05, 221.34, 226.33, 227.81, 218.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ukjs1351778757.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.11 -1.380 -2.96 -0.16 -1.16 0 0.000 0.05 -1.700 -0.690 0.030 0 [2,] -0.11 -0.800 -1.38 -0.16 -0.57 0 0.000 0.05 -1.420 -0.380 0.030 0 [3,] 0.00 0.125 -0.52 0.27 -0.11 0 0.055 0.09 -0.615 0.125 0.105 0 [4,] 0.05 0.570 0.25 0.49 -0.07 0 0.190 0.23 0.840 0.630 0.180 0 [5,] 0.05 1.310 0.91 1.06 0.49 0 0.370 0.40 1.770 1.160 0.380 0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.1032052 -0.7586942 -1.5714026 -0.149271 -0.4325161 0 -0.06755614 [2,] 0.1032052 1.0086942 0.5314026 0.689271 0.2125161 0 0.17755614 [,8] [,9] [,10] [,11] [,12] [1,] -0.02610581 -2.072773 -0.5264826 0.008245155 0 [2,] 0.20610581 0.842773 0.7764826 0.201754845 0 $out [1] -1.32 0.79 -1.78 -0.44 -0.53 -0.66 $group [1] 1 1 4 7 8 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.110000000000014, -0.110000000000014, 0, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6v3gc1351778757.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,] 225.950 219.950 220.05 219.590 217.000 217.710 NA [2,] 226.670 221.000 220.74 219.705 217.605 218.870 NA [3,] 227.425 221.840 221.50 220.825 217.970 219.945 NA [4,] 227.725 223.605 221.64 221.630 219.755 220.580 NA [5,] 227.810 226.330 222.27 221.720 221.010 222.160 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 226.9438 220.6518 221.0895 219.947 216.9894 219.1651 NA [2,] 227.9062 223.0282 221.9105 221.703 218.9506 220.7249 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(225.95, 226.67, 227.425, 227.725, 227.81, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7rcte1351778757.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,] 221.1933 220.6950 220.6950 [2,] 221.3842 220.8975 220.8238 [3,] 221.4558 220.9850 221.0000 [4,] 221.9842 221.2250 221.7825 [5,] 222.4300 221.3400 222.7275 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 221.1822 220.8356 220.5627 [2,] 221.7295 221.1344 221.4373 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(221.193333333333, 221.384166666667, 221.455833333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/18nxc1351778757.ps tmp/18nxc1351778757.png",intern=TRUE)) character(0) > try(system("convert tmp/2murc1351778757.ps tmp/2murc1351778757.png",intern=TRUE)) character(0) > try(system("convert tmp/3h1pq1351778757.ps tmp/3h1pq1351778757.png",intern=TRUE)) character(0) > try(system("convert tmp/4z1z61351778757.ps tmp/4z1z61351778757.png",intern=TRUE)) character(0) > try(system("convert tmp/5ukjs1351778757.ps tmp/5ukjs1351778757.png",intern=TRUE)) character(0) > try(system("convert tmp/6v3gc1351778757.ps tmp/6v3gc1351778757.png",intern=TRUE)) character(0) > try(system("convert tmp/7rcte1351778757.ps tmp/7rcte1351778757.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.048 0.643 4.710