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(109.20,88.60,94.30,98.30,86.40,80.60,104.10,108.20,93.40,71.90,94.10,94.90,96.40,91.10,84.40,86.40,88.00,75.10,109.70,103.00,82.10,68.00,96.40,94.30,90.00,88.00,76.10,82.50,81.40,66.50,97.20,94.10,80.70,70.50,87.80,89.50,99.60,84.20,75.10,92.00,80.80,73.10,99.80,90.00,83.10,72.40,78.80,87.30,91.00,80.10,73.60,86.40,74.50,71.20,92.40,81.50,85.30,69.90,84.20,90.70,100.30) > par1 = '36' > x <- x[x>quantile(x,0.05) & x #'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] 53 > (np <- floor(n / par1)) [1] 1 > 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] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > arr [,1] [,2] [1,] 88.6 90.0 [2,] 94.3 83.1 [3,] 98.3 72.4 [4,] 86.4 78.8 [5,] 80.6 87.3 [6,] 93.4 91.0 [7,] 71.9 80.1 [8,] 94.1 73.6 [9,] 94.9 86.4 [10,] 96.4 74.5 [11,] 91.1 71.2 [12,] 84.4 92.4 [13,] 86.4 81.5 [14,] 88.0 85.3 [15,] 75.1 84.2 [16,] 103.0 90.7 [17,] 82.1 100.3 [18,] 96.4 NA [19,] 94.3 NA [20,] 90.0 NA [21,] 88.0 NA [22,] 76.1 NA [23,] 82.5 NA [24,] 81.4 NA [25,] 97.2 NA [26,] 94.1 NA [27,] 80.7 NA [28,] 87.8 NA [29,] 89.5 NA [30,] 99.6 NA [31,] 84.2 NA [32,] 75.1 NA [33,] 92.0 NA [34,] 80.8 NA [35,] 73.1 NA [36,] 99.8 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/1f15j1225381020.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/2ptkn1225381020.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/34ozj1225381020.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/4dpdk1225381020.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] [,13] [1,] 88.6 83.1 72.40 78.8 80.60 91.0 71.9 73.60 86.40 74.50 71.20 84.4 81.50 [2,] 88.6 83.1 72.40 78.8 80.60 91.0 71.9 73.60 86.40 74.50 71.20 84.4 81.50 [3,] 89.3 88.7 85.35 82.6 83.95 92.2 76.0 83.85 90.65 85.45 81.15 88.4 83.95 [4,] 90.0 94.3 98.30 86.4 87.30 93.4 80.1 94.10 94.90 96.40 91.10 92.4 86.40 [5,] 90.0 94.3 98.30 86.4 87.30 93.4 80.1 94.10 94.90 96.40 91.10 92.4 86.40 [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [1,] 85.30 75.10 90.70 82.1 96.4 94.3 90 88 76.1 82.5 81.4 97.2 [2,] 85.30 75.10 90.70 82.1 96.4 94.3 90 88 76.1 82.5 81.4 97.2 [3,] 86.65 79.65 96.85 91.2 96.4 94.3 90 88 76.1 82.5 81.4 97.2 [4,] 88.00 84.20 103.00 100.3 96.4 94.3 90 88 76.1 82.5 81.4 97.2 [5,] 88.00 84.20 103.00 100.3 96.4 94.3 90 88 76.1 82.5 81.4 97.2 [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [1,] 94.1 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 [2,] 94.1 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 [3,] 94.1 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 [4,] 94.1 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 [5,] 94.1 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 $n [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 87.73588 76.18704 56.41378 74.10906 76.46457 89.51865 66.83872 60.94681 [2,] 90.86412 101.21296 114.28622 91.09094 91.43543 94.88135 85.16128 106.75319 [,9] [,10] [,11] [,12] [,13] [,14] [,15] [1,] 81.15356 60.98269 58.91715 79.46217 78.47558 83.63348 69.48322 [2,] 100.14644 109.91731 103.38285 97.33783 89.42442 89.66652 89.81678 [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 83.10809 70.86644 96.4 94.3 90 88 76.1 82.5 81.4 97.2 94.1 [2,] 110.59191 111.53356 96.4 94.3 90 88 76.1 82.5 81.4 97.2 94.1 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [1,] 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 [2,] 80.7 87.8 89.5 99.6 84.2 75.1 92 80.8 73.1 99.8 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" [31] "31" "32" "33" "34" "35" "36" Warning message: In bxp(list(stats = c(88.6, 88.6, 89.3, 90, 90, 83.1, 83.1, 88.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/51lmi1225381020.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] [1,] 71.90 71.2 [2,] 81.75 78.8 [3,] 88.30 84.2 [4,] 94.30 90.0 [5,] 103.00 100.3 $n [1] 36 17 $conf [,1] [,2] [1,] 84.99517 79.90809 [2,] 91.60483 88.49191 $out numeric(0) $group numeric(0) $names [1] "1" NA > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6fol71225381020.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,] 73.100 73.100 73.100 [2,] 81.950 81.950 81.950 [3,] 87.225 87.225 87.225 [4,] 91.600 91.600 91.600 [5,] 99.800 99.800 99.800 $n [1] 36 36 36 $conf [,1] [,2] [,3] [1,] 84.68383 84.68383 84.68383 [2,] 89.76617 89.76617 89.76617 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/1f15j1225381020.ps tmp/1f15j1225381020.png") > system("convert tmp/2ptkn1225381020.ps tmp/2ptkn1225381020.png") > system("convert tmp/34ozj1225381020.ps tmp/34ozj1225381020.png") > system("convert tmp/4dpdk1225381020.ps tmp/4dpdk1225381020.png") > system("convert tmp/51lmi1225381020.ps tmp/51lmi1225381020.png") > system("convert tmp/6fol71225381020.ps tmp/6fol71225381020.png") > > > proc.time() user system elapsed 1.308 0.815 1.671