R version 2.5.1 (2007-06-27) 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(99.90,99.80,99.80,100.30,99.90,99.90,100.00,100.10,100.10,100.20,100.30,100.60,100.00,100.10,100.20,100.00,100.10,100.10,100.10,100.50,100.50,100.50,96.30,96.30,96.80,96.80,96.90,96.80,96.80,96.80,96.80,97.00,97.00,97.00,96.80,96.90,97.20,97.30,97.30,97.20,97.30,97.30,97.30,97.30,97.30,97.30,98.10,96.80,96.80,96.80,96.80,96.80,96.80,96.80,96.80,96.80,96.80,96.80,96.90,97.10,97.10) > 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] 61 > (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] 6 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.9 100.0 96.8 97.2 96.8 97.1 [2,] 99.8 100.1 96.8 97.3 96.8 NA [3,] 99.8 100.2 96.9 97.3 96.8 NA [4,] 100.3 100.0 96.8 97.2 96.8 NA [5,] 99.9 100.1 96.8 97.3 96.8 NA [6,] 99.9 100.1 96.8 97.3 96.8 NA [7,] 100.0 100.1 96.8 97.3 96.8 NA [8,] 100.1 100.5 97.0 97.3 96.8 NA [9,] 100.1 100.5 97.0 97.3 96.8 NA [10,] 100.2 100.5 97.0 97.3 96.8 NA [11,] 100.3 96.3 96.8 98.1 96.9 NA [12,] 100.6 96.3 96.9 96.8 97.1 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/1vdch1193400966.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/2acex1193400966.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/30p8l1193400966.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/4f0u61193400966.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,] 96.80 96.8 96.8 96.8 96.8 96.8 96.8 96.8 96.8 96.8 96.3 96.8 [2,] 96.80 96.8 96.9 96.8 96.8 96.8 96.8 97.0 97.0 97.0 96.8 96.8 [3,] 97.15 97.3 97.3 97.2 97.3 97.3 97.3 97.3 97.3 97.3 96.9 96.9 [4,] 99.90 99.8 99.8 100.0 99.9 99.9 100.0 100.1 100.1 100.2 98.1 97.1 [5,] 100.00 100.1 100.2 100.3 100.1 100.1 100.1 100.5 100.5 100.5 98.1 97.1 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 95.1504 95.1802 95.25087 94.93889 95.10955 95.10955 95.03889 95.10955 [2,] 99.1496 99.4198 99.34913 99.46111 99.49045 99.49045 99.56111 99.49045 [,9] [,10] [,11] [,12] [1,] 95.10955 95.03889 95.98142 96.68802 [2,] 99.49045 99.56111 97.81858 97.11198 $out [1] 100.3 100.6 96.3 $group [1] 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(96.8, 96.8, 97.15, 99.9, 100, 96.8, 96.8, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/56wo81193400966.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,] 99.80 100.00 96.80 97.20 96.8 97.1 [2,] 99.90 100.00 96.80 97.25 96.8 97.1 [3,] 100.05 100.10 96.80 97.30 96.8 97.1 [4,] 100.25 100.35 96.95 97.30 96.8 97.1 [5,] 100.60 100.50 97.00 97.30 96.8 97.1 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.89036 99.94036 96.73158 97.2772 96.8 97.1 [2,] 100.20964 100.25964 96.86842 97.3228 96.8 97.1 $out [1] 96.3 96.3 98.1 96.8 96.9 97.1 $group [1] 2 2 4 4 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(99.8, 99.9, 100.05, 100.25, 100.6, 100, 100, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6kp571193400966.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,] 97.96667 97.150 98.050 [2,] 98.06333 97.175 98.175 [3,] 98.19000 97.300 98.350 [4,] 98.28000 97.300 98.475 [5,] 98.36000 97.300 98.600 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 98.09118 97.24299 98.21317 [2,] 98.28882 97.35701 98.48683 $out [1] 97.68 97.54 96.90 96.90 97.45 96.95 $group [1] 1 1 2 2 3 3 $names [1] "mean" "median" "midrange" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(97.9666666666667, 98.0633333333333, 98.19, > dev.off() null device 1 > > system("convert tmp/1vdch1193400966.ps tmp/1vdch1193400966.png") > system("convert tmp/2acex1193400966.ps tmp/2acex1193400966.png") > system("convert tmp/30p8l1193400966.ps tmp/30p8l1193400966.png") > system("convert tmp/4f0u61193400966.ps tmp/4f0u61193400966.png") > system("convert tmp/56wo81193400966.ps tmp/56wo81193400966.png") > system("convert tmp/6kp571193400966.ps tmp/6kp571193400966.png") > > > proc.time() user system elapsed 1.375 0.837 1.580