R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(6.91,6.87,6.91,6.89,6.88,6.9,6.91,6.85,6.86,6.82,6.8,6.83,6.84,6.89,7.14,7.21,7.25,7.31,7.3,7.48,7.49,7.4,7.44,7.42,7.14,7.24,7.33,7.61,7.66,7.69,7.7,7.68,7.71,7.71,7.72,7.68,7.72,7.74,7.76,7.9,7.97,7.96,7.95,7.97,7.93,7.99,7.96,7.92,7.97,7.98,8,8.04,8.17,8.29,8.26,8.3,8.32,8.28,8.27,8.32,8.31,8.34,8.32,8.36,8.33,8.35,8.34,8.37,8.31,8.33,8.34,8.25,8.27,8.31,8.25,8.3,8.3,8.35,8.78,8.9,8.9,8.9,9,9.05) > 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,] 6.91 6.84 7.14 7.72 7.97 8.31 8.27 NA [2,] 6.87 6.89 7.24 7.74 7.98 8.34 8.31 NA [3,] 6.91 7.14 7.33 7.76 8.00 8.32 8.25 NA [4,] 6.89 7.21 7.61 7.90 8.04 8.36 8.30 NA [5,] 6.88 7.25 7.66 7.97 8.17 8.33 8.30 NA [6,] 6.90 7.31 7.69 7.96 8.29 8.35 8.35 NA [7,] 6.91 7.30 7.70 7.95 8.26 8.34 8.78 NA [8,] 6.85 7.48 7.68 7.97 8.30 8.37 8.90 NA [9,] 6.86 7.49 7.71 7.93 8.32 8.31 8.90 NA [10,] 6.82 7.40 7.71 7.99 8.28 8.33 8.90 NA [11,] 6.80 7.44 7.72 7.96 8.27 8.34 9.00 NA [12,] 6.83 7.42 7.68 7.92 8.32 8.25 9.05 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -0.04 0.05 0.10 0.02 0.01 0.03 0.04 NA [2,] 0.04 0.25 0.09 0.02 0.02 -0.02 -0.06 NA [3,] -0.02 0.07 0.28 0.14 0.04 0.04 0.05 NA [4,] -0.01 0.04 0.05 0.07 0.13 -0.03 0.00 NA [5,] 0.02 0.06 0.03 -0.01 0.12 0.02 0.05 NA [6,] 0.01 -0.01 0.01 -0.01 -0.03 -0.01 0.43 NA [7,] -0.06 0.18 -0.02 0.02 0.04 0.03 0.12 NA [8,] 0.01 0.01 0.03 -0.04 0.02 -0.06 0.00 NA [9,] -0.04 -0.09 0.00 0.06 -0.04 0.02 0.00 NA [10,] -0.02 0.04 0.01 -0.03 -0.01 0.01 0.10 NA [11,] 0.03 -0.02 -0.04 -0.04 0.05 -0.09 0.05 NA [12,] 0.01 -0.28 0.04 0.05 -0.01 0.02 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/17ttc1338205594.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/2gtg71338205594.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/3y08w1338205594.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/4jzuj1338205594.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,] 6.840 6.870 6.910 6.89 6.880 6.90 6.91 6.850 6.860 6.820 6.800 6.830 [2,] 7.025 7.065 7.235 7.41 7.455 7.50 7.50 7.580 7.600 7.555 7.580 7.550 [3,] 7.720 7.740 7.760 7.90 7.970 7.96 7.95 7.970 7.930 7.990 7.960 7.920 [4,] 8.120 8.145 8.125 8.17 8.235 8.32 8.30 8.335 8.315 8.305 8.305 8.285 [5,] 8.310 8.340 8.320 8.36 8.330 8.35 8.78 8.900 8.900 8.900 9.000 9.050 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 7.066084 7.095041 7.228506 7.44614 7.504197 7.470309 7.472253 7.519126 [2,] 8.373916 8.384959 8.291494 8.35386 8.435803 8.449691 8.427747 8.420874 [,9] [,10] [,11] [,12] [1,] 7.503014 7.542112 7.527042 7.48107 [2,] 8.356986 8.437888 8.392958 8.35893 $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(6.84, 7.025, 7.72, 8.12, 8.31, 6.87, 7.065, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5w2hz1338205594.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] [1,] 0.010 -0.060 -0.020 -0.030 -0.010 -0.03 -6.000000e-02 -0.060 -0.09 -0.030 [2,] 0.015 0.000 0.040 -0.005 0.020 -0.01 -4.440892e-16 -0.020 -0.04 -0.015 [3,] 0.030 0.020 0.050 0.040 0.030 -0.01 3.000000e-02 0.010 0.00 0.010 [4,] 0.045 0.065 0.105 0.060 0.055 0.01 8.000000e-02 0.015 0.01 0.025 [5,] 0.050 0.090 0.140 0.130 0.060 0.01 1.800000e-01 0.030 0.06 0.040 [,11] [,12] [1,] -0.09 -0.010 [2,] -0.04 -0.010 [3,] -0.02 0.015 [4,] 0.04 0.040 [5,] 0.05 0.050 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.01208448 -0.01881695 0.01118305 0.001183049 0.009098565 -0.021943677 [2,] 0.04791552 0.05881695 0.08881695 0.078816951 0.050901435 0.001943677 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.01777471 -0.01090144 -0.02985919 -0.01388735 -0.06777471 -0.01725161 [2,] 0.07777471 0.03090144 0.02985919 0.03388735 0.02777471 0.04725161 $out [1] -0.04 0.10 0.25 0.28 0.12 0.43 0.10 -0.28 $group [1] 1 1 2 3 5 6 10 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.0100000000000007, 0.0150000000000006, 0.0299999999999994, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6gt4z1338205594.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,] 6.800 6.840 7.140 7.720 7.970 8.310 8.250 NA [2,] 6.840 7.175 7.470 7.830 8.020 8.315 8.300 NA [3,] 6.875 7.305 7.680 7.940 8.265 8.335 8.565 NA [4,] 6.905 7.430 7.705 7.965 8.295 8.345 8.900 NA [5,] 6.910 7.490 7.720 7.990 8.320 8.370 9.050 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6.845353 7.188693 7.572815 7.878426 8.139571 8.321317 8.291336 NA [2,] 6.904647 7.421307 7.787185 8.001574 8.390429 8.348683 8.838664 NA $out [1] 8.25 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(6.8, 6.84, 6.875, 6.905, 6.91, 6.84, 7.175, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7pjtw1338205594.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,] 7.594286 7.720 7.57250 [2,] 7.715714 7.830 7.73500 [3,] 7.863571 7.940 7.90500 [4,] 7.927857 7.965 7.93625 [5,] 7.935714 7.990 7.95750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 7.766812 7.878426 7.813209 [2,] 7.960331 8.001574 7.996791 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(7.59428571428571, 7.71571428571429, 7.86357142857143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17ttc1338205594.ps tmp/17ttc1338205594.png",intern=TRUE)) character(0) > try(system("convert tmp/2gtg71338205594.ps tmp/2gtg71338205594.png",intern=TRUE)) character(0) > try(system("convert tmp/3y08w1338205594.ps tmp/3y08w1338205594.png",intern=TRUE)) character(0) > try(system("convert tmp/4jzuj1338205594.ps tmp/4jzuj1338205594.png",intern=TRUE)) character(0) > try(system("convert tmp/5w2hz1338205594.ps tmp/5w2hz1338205594.png",intern=TRUE)) character(0) > try(system("convert tmp/6gt4z1338205594.ps tmp/6gt4z1338205594.png",intern=TRUE)) character(0) > try(system("convert tmp/7pjtw1338205594.ps tmp/7pjtw1338205594.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.692 0.524 2.272