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(23.9,24.06,24.33,24.39,24.39,24.49,24.83,25.08,25.11,25.13,25.17,25.11,25.35,25.36,25.35,25.34,25.39,25.58,25.71,25.66,25.74,25.73,25.72,25.55,25.71,25.92,25.93,26,26.02,26.08,26.17,26.18,26.21,26.28,26.34,26.17,26.38,26.36,26.27,26.26,26.49,26.99,27.14,27.1,27.01,26.93,26.97,26.35,26.93,26.92,27.05,27.01,26.9,26.93,26.95,26.89,26.7,26.55,26.48,25.71,26.17,26.31,26.58,26.49,26.57,26.6,26.69,26.59,26.75,26.79,26.8,26.62) > 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,] 23.90 25.35 25.71 26.38 26.93 26.17 NA [2,] 24.06 25.36 25.92 26.36 26.92 26.31 NA [3,] 24.33 25.35 25.93 26.27 27.05 26.58 NA [4,] 24.39 25.34 26.00 26.26 27.01 26.49 NA [5,] 24.39 25.39 26.02 26.49 26.90 26.57 NA [6,] 24.49 25.58 26.08 26.99 26.93 26.60 NA [7,] 24.83 25.71 26.17 27.14 26.95 26.69 NA [8,] 25.08 25.66 26.18 27.10 26.89 26.59 NA [9,] 25.11 25.74 26.21 27.01 26.70 26.75 NA [10,] 25.13 25.73 26.28 26.93 26.55 26.79 NA [11,] 25.17 25.72 26.34 26.97 26.48 26.80 NA [12,] 25.11 25.55 26.17 26.35 25.71 26.62 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.16 0.01 0.21 -0.02 -0.01 0.14 NA [2,] 0.27 -0.01 0.01 -0.09 0.13 0.27 NA [3,] 0.06 -0.01 0.07 -0.01 -0.04 -0.09 NA [4,] 0.00 0.05 0.02 0.23 -0.11 0.08 NA [5,] 0.10 0.19 0.06 0.50 0.03 0.03 NA [6,] 0.34 0.13 0.09 0.15 0.02 0.09 NA [7,] 0.25 -0.05 0.01 -0.04 -0.06 -0.10 NA [8,] 0.03 0.08 0.03 -0.09 -0.19 0.16 NA [9,] 0.02 -0.01 0.07 -0.08 -0.15 0.04 NA [10,] 0.04 -0.01 0.06 0.04 -0.07 0.01 NA [11,] -0.06 -0.17 -0.17 -0.62 -0.77 -0.18 NA [12,] 0.24 0.16 0.21 0.58 0.46 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/1qtmj1354817370.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/23mgg1354817370.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/3rlwk1354817370.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/4fhrz1354817370.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,] 23.90 24.060 24.33 24.39 24.390 24.49 24.83 25.080 25.110 25.130 25.17 [2,] 25.35 25.360 25.35 25.34 25.390 25.58 25.71 25.660 25.740 25.730 25.72 [3,] 25.94 26.115 26.10 26.13 26.255 26.34 26.43 26.385 26.455 26.415 26.41 [4,] 26.38 26.360 26.58 26.49 26.570 26.93 26.95 26.890 26.750 26.790 26.80 [5,] 26.93 26.920 27.05 27.01 26.900 26.99 27.14 27.100 27.010 26.930 26.97 [,12] [1,] 25.11 [2,] 25.55 [3,] 25.94 [4,] 26.35 [5,] 26.62 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 25.27562 25.46997 25.30661 25.38821 25.49386 25.46921 25.63016 25.59161 [2,] 26.60438 26.76003 26.89339 26.87179 27.01614 27.21079 27.22984 27.17839 [,9] [,10] [,11] [,12] [1,] 25.80352 25.73127 25.71337 25.42397 [2,] 27.10648 27.09873 27.10663 26.45603 $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(23.9, 25.35, 25.94, 26.38, 26.93, 24.06, 25.36, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5sisk1354817370.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.020 -0.09 -0.09 -0.110 0.03 0.02 -0.100 -0.19 -0.150 -0.070 -0.770 [2,] -0.010 -0.01 -0.04 0.000 0.03 0.09 -0.060 -0.09 -0.080 -0.010 -0.620 [3,] 0.075 0.07 -0.01 0.035 0.08 0.11 -0.045 0.03 0.005 0.025 -0.175 [4,] 0.160 0.27 0.06 0.080 0.19 0.15 0.010 0.08 0.040 0.040 -0.170 [5,] 0.210 0.27 0.07 0.080 0.19 0.15 0.010 0.16 0.070 0.060 -0.060 [,12] [1,] 0.16 [2,] 0.21 [3,] 0.24 [4,] 0.46 [5,] 0.58 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.03465549 -0.110609 -0.07450323 -0.01660258 -0.02320517 0.07129806 [2,] 0.18465549 0.250609 0.05450323 0.08660258 0.18320517 0.14870194 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.0901522609 -0.07965549 -0.07240388 -0.007251615 -0.4652645 0.06335063 [2,] 0.0001522609 0.13965549 0.08240388 0.057251615 0.1152645 0.41664937 $out [1] 0.23 0.50 0.34 0.25 $group [1] 4 5 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0199999999999996, -0.00999999999999801, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6odj21354817370.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,] 23.90 25.340 25.710 26.260 26.480 26.310 NA [2,] 24.36 25.355 25.965 26.355 26.625 26.530 NA [3,] 24.66 25.565 26.125 26.710 26.910 26.595 NA [4,] 25.11 25.715 26.195 27.000 26.940 26.720 NA [5,] 25.17 25.740 26.340 27.140 27.050 26.800 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 24.31792 25.4008 26.0201 26.41581 26.76633 26.50834 NA [2,] 25.00208 25.7292 26.2299 27.00419 27.05367 26.68166 NA $out [1] 25.71 26.17 $group [1] 5 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(23.9, 24.36, 24.66, 25.11, 25.17, 25.34, 25.355, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7nefd1354817370.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,] 25.74000 25.9400 25.88375 [2,] 25.91667 26.1075 25.95813 [3,] 26.03583 26.2975 26.16250 [4,] 26.24750 26.4125 26.29812 [5,] 26.25333 26.4550 26.35500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 25.88494 26.15839 26.00742 [2,] 26.18673 26.43661 26.31758 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(25.74, 25.9166666666667, 26.0358333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1qtmj1354817370.ps tmp/1qtmj1354817370.png",intern=TRUE)) character(0) > try(system("convert tmp/23mgg1354817370.ps tmp/23mgg1354817370.png",intern=TRUE)) character(0) > try(system("convert tmp/3rlwk1354817370.ps tmp/3rlwk1354817370.png",intern=TRUE)) character(0) > try(system("convert tmp/4fhrz1354817370.ps tmp/4fhrz1354817370.png",intern=TRUE)) character(0) > try(system("convert tmp/5sisk1354817370.ps tmp/5sisk1354817370.png",intern=TRUE)) character(0) > try(system("convert tmp/6odj21354817370.ps tmp/6odj21354817370.png",intern=TRUE)) character(0) > try(system("convert tmp/7nefd1354817370.ps tmp/7nefd1354817370.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.515 0.571 4.073