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(134.4,145,151.1,136.3,133.2,128.8,136.3,131.3,128.6,139.3,120.8,126.7,128.6,137.5,140.8,132.3,130.5,117.1,131.4,129.4,119.2,133.6,113.2,122.1,130.9,131.7,126.7,132.3,124.8,111.1,131.3,118.6,119.4,124,108.7,115.9,130.5,125.4,126,130.4,119.3,117.4,127.9,112.5,115.1,124.3,107.6,110.7,117.9,115.2,130.4,121.2,113.5,117.8,117.6,106,112.5,110.1,107.4,110.1,113.3) > 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,] 134.4 128.6 130.9 130.5 117.9 113.3 [2,] 145.0 137.5 131.7 125.4 115.2 NA [3,] 151.1 140.8 126.7 126.0 130.4 NA [4,] 136.3 132.3 132.3 130.4 121.2 NA [5,] 133.2 130.5 124.8 119.3 113.5 NA [6,] 128.8 117.1 111.1 117.4 117.8 NA [7,] 136.3 131.4 131.3 127.9 117.6 NA [8,] 131.3 129.4 118.6 112.5 106.0 NA [9,] 128.6 119.2 119.4 115.1 112.5 NA [10,] 139.3 133.6 124.0 124.3 110.1 NA [11,] 120.8 113.2 108.7 107.6 107.4 NA [12,] 126.7 122.1 115.9 110.7 110.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/freestat/rcomp/tmp/1lb001225980828.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/freestat/rcomp/tmp/2lbhk1225980828.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/freestat/rcomp/tmp/3ltxb1225980829.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/freestat/rcomp/tmp/4ebcb1225980829.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,] 113.30 115.2 126.0 130.4 113.5 117.1 127.9 106.0 112.5 110.1 107.4 110.1 [2,] 117.90 125.4 126.7 130.4 119.3 117.1 127.9 112.5 115.1 124.0 107.6 110.7 [3,] 129.55 131.7 130.4 132.3 124.8 117.4 131.3 118.6 119.2 124.3 108.7 115.9 [4,] 130.90 137.5 140.8 132.3 130.5 117.8 131.4 129.4 119.4 133.6 113.2 122.1 [5,] 134.40 145.0 151.1 132.3 133.2 117.8 136.3 131.3 119.4 139.3 120.8 126.7 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 121.1646 123.1502 120.4370 130.9575 116.8861 116.9054 128.8269 106.6585 [2,] 137.9354 140.2498 140.3630 133.6425 132.7139 117.8946 133.7731 130.5415 [,9] [,10] [,11] [,12] [1,] 116.1616 117.5167 104.7431 107.8448 [2,] 122.2384 131.0833 112.6569 123.9552 $out [1] 136.3 121.2 128.8 111.1 117.6 128.6 $group [1] 4 4 6 6 7 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(113.3, 117.9, 129.55, 130.9, 134.4, 115.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/5p01j1225980829.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,] 120.8 113.20 108.70 107.60 106.00 113.3 [2,] 128.7 120.65 117.25 113.80 110.10 113.3 [3,] 133.8 129.95 124.40 121.80 114.35 113.3 [4,] 137.8 132.95 131.10 126.95 117.85 113.3 [5,] 151.1 140.80 132.30 130.50 121.20 113.3 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 129.6494 124.3399 118.0829 115.8022 110.8152 113.3 [2,] 137.9506 135.5601 130.7171 127.7978 117.8848 113.3 $out [1] 130.4 $group [1] 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(120.8, 128.7, 133.8, 137.8, 151.1, 113.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/62i6p1225980829.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,] 111.5400 108.70 110.4000 [2,] 118.7000 118.00 117.3500 [3,] 125.0967 124.55 125.2938 [4,] 129.7000 130.85 130.5000 [5,] 135.0000 132.30 133.7500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 120.0795 118.6890 119.2959 [2,] 130.1138 130.4110 131.2916 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(111.54, 118.7, 125.096666666667, 129.7, 135, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > system("convert tmp/1lb001225980828.ps tmp/1lb001225980828.png") > system("convert tmp/2lbhk1225980828.ps tmp/2lbhk1225980828.png") > system("convert tmp/3ltxb1225980829.ps tmp/3ltxb1225980829.png") > system("convert tmp/4ebcb1225980829.ps tmp/4ebcb1225980829.png") > system("convert tmp/5p01j1225980829.ps tmp/5p01j1225980829.png") > system("convert tmp/62i6p1225980829.ps tmp/62i6p1225980829.png") > > > proc.time() user system elapsed 1.982 1.314 2.504