R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(97.3,101,113.2,101,105.7,113.9,86.4,96.5,103.3,114.9,105.8,94.2,98.4,99.4,108.8,112.6,104.4,112.2,81.1,97.1,112.6,113.8,107.8,103.2,103.3,101.2,107.7,110.4,101.9,115.9,89.9,88.6,117.2,123.9,100,103.6,94.1,98.7,119.5,112.7,104.4,124.7,89.1,97,121.6,118.8,114,111.5,97.2,102.5,113.4,109.8,104.9,126.1,80,96.8,117.2,112.3,117.3,111.1,102.2,104.3,122.9,107.6,121.3,131.5,89,104.4,128.9,135.9,133.3,121.3,120.5) > 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] 73 > (np <- floor(n / par1)) [1] 6 > 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] 7 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 97.3 98.4 103.3 94.1 97.2 102.2 120.5 [2,] 101.0 99.4 101.2 98.7 102.5 104.3 NA [3,] 113.2 108.8 107.7 119.5 113.4 122.9 NA [4,] 101.0 112.6 110.4 112.7 109.8 107.6 NA [5,] 105.7 104.4 101.9 104.4 104.9 121.3 NA [6,] 113.9 112.2 115.9 124.7 126.1 131.5 NA [7,] 86.4 81.1 89.9 89.1 80.0 89.0 NA [8,] 96.5 97.1 88.6 97.0 96.8 104.4 NA [9,] 103.3 112.6 117.2 121.6 117.2 128.9 NA [10,] 114.9 113.8 123.9 118.8 112.3 135.9 NA [11,] 105.8 107.8 100.0 114.0 117.3 133.3 NA [12,] 94.2 103.2 103.6 111.5 111.1 121.3 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/1tr7t1195548658.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/2c6np1195548658.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/3egk61195548658.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/4es5z1195548658.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,] 94.10 98.7 107.7 101.0 104.40 112.2 80.0 96.5 103.3 112.30 100.0 94.20 [2,] 97.25 99.4 108.8 107.6 104.40 113.9 81.1 96.5 112.6 113.80 105.8 103.20 [3,] 98.40 101.1 113.3 110.1 104.65 120.3 87.7 96.9 117.2 116.85 110.9 107.35 [4,] 102.75 102.5 119.5 112.6 105.70 126.1 89.1 97.1 121.6 123.90 117.3 111.50 [5,] 103.30 104.3 122.9 112.7 105.70 131.5 89.9 97.1 128.9 135.90 133.3 121.30 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 95.11549 99.1004 106.3982 106.8748 103.8115 112.4306 82.53974 96.51298 [2,] 101.68451 103.0996 120.2018 113.3252 105.4885 128.1694 92.86026 97.28702 [,9] [,10] [,11] [,12] [1,] 111.3947 110.3352 103.4821 101.9962 [2,] 123.0053 123.3648 118.3179 112.7038 $out [1] 120.5 101.9 121.3 88.6 104.4 $group [1] 1 5 5 8 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(94.1, 97.25, 98.4, 102.75, 103.3, 98.7, 99.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5amyq1195548658.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] [,7] [1,] 86.40 81.1 88.60 89.10 80.00 89.00 120.5 [2,] 96.90 98.9 100.60 97.85 99.85 104.35 120.5 [3,] 102.15 106.1 103.45 112.10 110.45 121.30 120.5 [4,] 109.50 112.4 113.15 119.15 115.30 130.20 120.5 [5,] 114.90 113.8 123.90 124.70 126.10 135.90 120.5 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.40306 99.94256 97.72586 102.3849 103.4032 109.5096 120.5 [2,] 107.89694 112.25744 109.17414 121.8151 117.4968 133.0904 120.5 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(86.4, 96.9, 102.15, 109.5, 114.9, 81.1, 98.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6udhs1195548658.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,] 85.91667 87.700 85.7500 [2,] 101.52024 99.750 100.4938 [3,] 108.25000 108.725 108.7250 [4,] 115.52500 115.075 115.5312 [5,] 120.71667 120.300 120.0750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 101.8623 101.7352 101.8663 [2,] 114.6377 115.7148 115.5837 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(85.9166666666667, 101.520238095238, 108.25, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1tr7t1195548658.ps tmp/1tr7t1195548658.png") > system("convert tmp/2c6np1195548658.ps tmp/2c6np1195548658.png") > system("convert tmp/3egk61195548658.ps tmp/3egk61195548658.png") > system("convert tmp/4es5z1195548658.ps tmp/4es5z1195548658.png") > system("convert tmp/5amyq1195548658.ps tmp/5amyq1195548658.png") > system("convert tmp/6udhs1195548658.ps tmp/6udhs1195548658.png") > > > proc.time() user system elapsed 1.309 0.844 1.622