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(96,86,82,92,99,101,102,100,101,100,99,97,97,97,96,92,91,87,82,89,91,90,87,89,95,85,94,94,97,99,97,96,94,100,96,98,98,94,93,94,94,97,98,95,89,89,89,90,86,92,91,95,99,98,95,96,94,98,98,98,98,102,101,92,99,101,99,102,102,101,99,98,98) > 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,] 96 97 95 98 86 98 98 [2,] 86 97 85 94 92 102 NA [3,] 82 96 94 93 91 101 NA [4,] 92 92 94 94 95 92 NA [5,] 99 91 97 94 99 99 NA [6,] 101 87 99 97 98 101 NA [7,] 102 82 97 98 95 99 NA [8,] 100 89 96 95 96 102 NA [9,] 101 91 94 89 94 102 NA [10,] 100 90 100 89 98 101 NA [11,] 99 87 96 89 98 99 NA [12,] 97 89 98 90 98 98 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/1uagj1197025822.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/2ym8r1197025822.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/3fo501197025822.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/4af1p1197025822.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,] 95.0 85 91.0 92 91 97.0 95.0 89 89 89 87 89.0 [2,] 95.5 86 91.0 92 94 97.0 95.0 95 91 90 89 90.0 [3,] 97.0 93 93.5 93 98 98.5 97.5 96 94 99 97 97.5 [4,] 98.0 97 96.0 94 99 101.0 99.0 100 101 100 99 98.0 [5,] 98.0 102 101.0 95 99 101.0 102.0 102 102 101 99 98.0 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 95.50704 85.90464 90.27484 91.70994 94.77484 95.91987 94.91987 [2,] 98.49296 100.09536 96.72516 94.29006 101.22516 101.08013 100.08013 [,8] [,9] [,10] [,11] [,12] [1,] 92.77484 87.54968 92.54968 90.54968 92.33974 [2,] 99.22516 100.45032 105.45032 103.45032 102.66026 $out [1] 86 82 87 82 $group [1] 1 3 6 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(95, 95.5, 97, 98, 98, 85, 86, 93, 97, 102, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5hyhb1197025822.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.0 82.0 94.0 89.0 86.0 98.0 98 [2,] 94.0 88.0 94.0 89.5 93.0 98.5 98 [3,] 99.0 90.5 96.0 94.0 95.5 100.0 98 [4,] 100.5 94.0 97.5 96.0 98.0 101.5 98 [5,] 102.0 97.0 100.0 98.0 99.0 102.0 98 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.0353 87.76336 94.40363 91.0353 93.21947 98.63168 98 [2,] 101.9647 93.23664 97.59637 96.9647 97.78053 101.36832 98 $out [1] 82 85 92 $group [1] 1 3 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(86, 94, 99, 100.5, 102, 82, 88, 90.5, 94, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6jzqc1197025822.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,] 92.66667 93.00 91.875 [2,] 93.91667 93.75 94.125 [3,] 95.29762 97.00 95.750 [4,] 96.33333 97.75 97.000 [5,] 97.16667 99.00 98.875 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 94.19536 95.17557 94.4387 [2,] 96.39988 98.82443 97.0613 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(92.6666666666667, 93.9166666666667, 95.297619047619, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1uagj1197025822.ps tmp/1uagj1197025822.png") > system("convert tmp/2ym8r1197025822.ps tmp/2ym8r1197025822.png") > system("convert tmp/3fo501197025822.ps tmp/3fo501197025822.png") > system("convert tmp/4af1p1197025822.ps tmp/4af1p1197025822.png") > system("convert tmp/5hyhb1197025822.ps tmp/5hyhb1197025822.png") > system("convert tmp/6jzqc1197025822.ps tmp/6jzqc1197025822.png") > > > proc.time() user system elapsed 1.306 0.843 1.606