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(87,75,74,91,101,103,106,102,105,105,100,95,96,98,99,92,84,81,72,89,96,91,88,90,98,87,100,100,104,107,105,102,98,106,97,101,100,93,94,96,96,98,102,95,85,84,82,87,77,90,90,94,97,96,93,93,93,97,100,95,97,103,102,93,99,100,97,104,102,103,100,90,90) > 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,] 87 96 98 100 77 97 90 [2,] 75 98 87 93 90 103 NA [3,] 74 99 100 94 90 102 NA [4,] 91 92 100 96 94 93 NA [5,] 101 84 104 96 97 99 NA [6,] 103 81 107 98 96 100 NA [7,] 106 72 105 102 93 97 NA [8,] 102 89 102 95 93 104 NA [9,] 105 96 98 85 93 102 NA [10,] 105 91 106 84 97 103 NA [11,] 100 88 97 82 100 100 NA [12,] 95 90 101 87 95 90 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/1i3kn1197025980.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/2u3o21197025980.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/3bskp1197025980.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/48kmc1197025980.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,] 77.0 75.0 90.0 91.0 96 96 93.0 89.0 85 84 82.0 87.0 [2,] 88.5 87.0 90.0 92.0 96 96 93.0 93.0 93 91 88.0 90.0 [3,] 96.0 91.5 96.5 93.5 98 99 99.5 98.5 97 100 98.5 92.5 [4,] 97.5 98.0 100.0 96.0 101 103 105.0 102.0 102 105 100.0 95.0 [5,] 100.0 103.0 102.0 100.0 104 107 106.0 104.0 105 106 100.0 101.0 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 90.62535 84.40464 90.04968 90.91987 94.77484 94.48477 91.75961 [2,] 101.37465 98.59536 102.95032 96.08013 101.22516 103.51523 107.24039 [,8] [,9] [,10] [,11] [,12] [1,] 92.69471 91.19471 90.96955 90.75961 89.27484 [2,] 104.30529 102.80529 109.03045 106.24039 95.72516 $out [1] 74 84 81 72 $group [1] 3 5 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(77, 88.5, 96, 97.5, 100, 75, 87, 91.5, 98, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5lzz21197025980.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,] 74.0 72.0 97.0 82.0 90.0 90.0 90 [2,] 89.0 86.0 98.0 86.0 91.5 97.0 90 [3,] 100.5 90.5 100.5 94.5 93.5 100.0 90 [4,] 104.0 96.0 104.5 97.0 96.5 102.5 90 [5,] 106.0 99.0 107.0 102.0 100.0 104.0 90 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 93.6584 85.93893 97.5353 89.48283 91.21947 97.49141 90 [2,] 107.3416 95.06107 103.4647 99.51717 95.78053 102.50859 90 $out [1] 87 77 $group [1] 3 5 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(74, 89, 100.5, 104, 106, 72, 86, 90.5, 96, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6n9ec1197025980.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,] 91.00000 91.50 92.2500 [2,] 93.08333 94.75 93.4375 [3,] 95.16667 97.50 96.3750 [4,] 97.16667 98.75 98.4375 [5,] 97.66667 100.00 99.3750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 93.30423 95.67557 94.09447 [2,] 97.02910 99.32443 98.65553 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(91, 93.0833333333333, 95.1666666666667, 97.1666666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1i3kn1197025980.ps tmp/1i3kn1197025980.png") > system("convert tmp/2u3o21197025980.ps tmp/2u3o21197025980.png") > system("convert tmp/3bskp1197025980.ps tmp/3bskp1197025980.png") > system("convert tmp/48kmc1197025980.ps tmp/48kmc1197025980.png") > system("convert tmp/5lzz21197025980.ps tmp/5lzz21197025980.png") > system("convert tmp/6n9ec1197025980.ps tmp/6n9ec1197025980.png") > > > proc.time() user system elapsed 1.338 0.831 1.800