R version 2.7.2 (2008-08-25) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Mean Plot (v1.0.1) 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 > #Technical description: Write here your technical program description > par1 <- as.numeric(par1) > (n <- length(x)) [1] 60 > (np <- floor(n / par1)) [1] 5 > arr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + if (j == par1) j = 0 + } > ari [1] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 29.08 49.14 59.15 60.03 81.71 NA [2,] 28.76 44.61 56.12 59.44 92.60 NA [3,] 29.59 40.22 57.42 62.50 90.60 NA [4,] 30.70 44.23 63.52 55.04 92.23 NA [5,] 30.52 45.85 61.71 58.34 94.09 NA [6,] 32.67 53.38 63.01 61.92 102.79 NA [7,] 33.19 53.26 68.18 67.65 109.65 NA [8,] 37.13 51.80 72.03 67.68 124.05 NA [9,] 35.54 55.30 69.75 70.30 132.69 NA [10,] 37.75 57.81 74.41 75.26 135.81 NA [11,] 41.84 63.96 74.33 71.44 116.07 NA [12,] 42.94 63.77 64.24 76.36 101.42 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/html/rcomp/tmp/1q12a1225549247.ps",horizontal=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/html/rcomp/tmp/2qvbg1225549247.ps",horizontal=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/html/rcomp/tmp/3g1dw1225549247.ps",horizontal=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/html/rcomp/tmp/4yfzn1225549247.ps",horizontal=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,] 49.14 28.76 29.59 30.70 30.52 53.38 33.19 37.13 35.54 37.75 63.96 63.77 [2,] 49.14 44.61 40.22 44.23 45.85 53.38 53.26 51.80 55.30 57.81 63.96 63.77 [3,] 59.15 56.12 57.42 55.04 58.34 61.92 67.65 67.68 69.75 74.41 71.44 64.24 [4,] 60.03 59.44 62.50 63.52 61.71 63.01 68.18 72.03 70.30 75.26 74.33 76.36 [5,] 60.03 59.44 90.60 92.23 61.71 63.01 68.18 72.03 70.30 75.26 74.33 76.36 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 51.45515 45.64116 41.67701 41.40973 47.13336 55.11547 57.10757 53.38553 [2,] 66.84485 66.59884 73.16299 68.67027 69.54664 68.72453 78.19243 81.97447 [,9] [,10] [,11] [,12] [1,] 59.15104 62.07987 64.11258 55.34394 [2,] 80.34896 86.74013 78.76742 73.13606 $out [1] 29.08 81.71 92.60 94.09 32.67 102.79 109.65 124.05 132.69 135.81 [11] 41.84 116.07 42.94 101.42 $group [1] 1 1 2 5 6 6 7 8 9 10 11 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(49.14, 49.14, 59.15, 60.03, 60.03, 28.76, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5hmub1225549247.ps",horizontal=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] [1,] 28.760 40.220 56.12 55.040 81.710 NA [2,] 30.055 45.230 60.43 59.735 92.415 NA [3,] 32.930 52.530 63.88 65.075 102.105 NA [4,] 37.440 56.555 70.89 70.870 120.060 NA [5,] 42.940 63.960 74.41 76.360 135.810 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 29.56165 47.36459 59.10912 59.99625 89.49593 NA [2,] 36.29835 57.69541 68.65088 70.15375 114.71407 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(28.76, 30.055, 32.93, 37.44, 42.94, 40.22, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6dchi1225549247.ps",horizontal=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,] 55.822 55.040 51.3600 [2,] 56.725 57.880 53.8275 [3,] 64.570 63.080 59.4575 [4,] 71.627 68.715 64.6675 [5,] 76.208 74.410 70.0650 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 57.7731 58.13808 54.5133 [2,] 71.3669 68.02192 64.4017 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/1q12a1225549247.ps tmp/1q12a1225549247.png") > system("convert tmp/2qvbg1225549247.ps tmp/2qvbg1225549247.png") > system("convert tmp/3g1dw1225549247.ps tmp/3g1dw1225549247.png") > system("convert tmp/4yfzn1225549247.ps tmp/4yfzn1225549247.png") > system("convert tmp/5hmub1225549247.ps tmp/5hmub1225549247.png") > system("convert tmp/6dchi1225549247.ps tmp/6dchi1225549247.png") > > > proc.time() user system elapsed 1.341 0.834 1.882