R version 2.7.0 (2008-04-22) 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(110.4,112.9,109.4,111.9,108.9,113.8,114.5,113.2,111,114.6,113.1,113.2,115.1,117.6,117.8,115.7,115.7,118.3,117.9,117.3,119.4,117.1,119,120,118.9,116,115.6,119.7,119.7,120.8,120,120.2,121.7,116.9,122.4,122.6,123.7,120.9,124.2,122.6,125.7,123.1,122.2,126.2,124.4,127.8,124.2,126.7,126.1,128.2,130.4,130.2,129.2,129.7,131,129.2,131.1,132.9,135.2,132.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] 60 > (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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 110.4 115.1 118.9 123.7 126.1 NA [2,] 112.9 117.6 116.0 120.9 128.2 NA [3,] 109.4 117.8 115.6 124.2 130.4 NA [4,] 111.9 115.7 119.7 122.6 130.2 NA [5,] 108.9 115.7 119.7 125.7 129.2 NA [6,] 113.8 118.3 120.8 123.1 129.7 NA [7,] 114.5 117.9 120.0 122.2 131.0 NA [8,] 113.2 117.3 120.2 126.2 129.2 NA [9,] 111.0 119.4 121.7 124.4 131.1 NA [10,] 114.6 117.1 116.9 127.8 132.9 NA [11,] 113.1 119.0 122.4 124.2 135.2 NA [12,] 113.2 120.0 122.6 126.7 132.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/1ww4i1225741998.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/2ji8i1225741998.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/3c8fh1225741998.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/4kp3q1225741998.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,] 110.4 112.9 109.4 111.9 108.9 113.8 114.5 113.2 119.4 114.6 113.1 113.2 [2,] 115.1 116.0 115.6 115.7 115.7 118.3 117.9 117.3 119.4 116.9 119.0 120.0 [3,] 118.9 117.6 117.8 119.7 119.7 120.8 120.0 120.2 121.7 117.1 122.4 122.6 [4,] 123.7 120.9 124.2 122.6 125.7 123.1 122.2 126.2 124.4 127.8 124.2 126.7 [5,] 126.1 128.2 130.4 130.2 129.2 129.7 122.2 129.2 131.1 132.9 124.2 132.3 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 112.8233 114.1377 111.7233 114.8245 112.6340 117.4083 116.9616 113.9113 [2,] 124.9767 121.0623 123.8767 124.5755 126.7660 124.1917 123.0384 126.4887 [,9] [,10] [,11] [,12] [1,] 118.1670 109.3981 118.7257 117.8658 [2,] 125.2330 124.8019 126.0743 127.3342 $out [1] 131.0 111.0 135.2 $group [1] 7 9 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(110.4, 115.1, 118.9, 123.7, 126.1, 112.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5mudo1225741998.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,] 108.9 115.10 115.60 120.90 126.1 NA [2,] 110.7 116.40 117.90 122.85 129.2 NA [3,] 113.0 117.70 119.85 124.20 130.3 NA [4,] 113.5 118.65 121.25 125.95 131.7 NA [5,] 114.6 120.00 122.60 127.80 135.2 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 111.7229 116.6738 118.3220 122.7861 129.1597 NA [2,] 114.2771 118.7262 121.3780 125.6139 131.4403 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(108.9, 110.7, 113, 113.5, 114.6, 115.1, 116.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6nkdg1225741998.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,] 118.84 117.10 118.450 [2,] 119.66 118.35 119.650 [3,] 121.13 119.85 120.700 [4,] 121.69 121.25 121.825 [5,] 122.96 122.60 123.350 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 120.2041 118.5273 119.7080 [2,] 122.0559 121.1727 121.6920 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(118.84, 119.66, 121.13, 121.69, 122.96, 117.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1ww4i1225741998.ps tmp/1ww4i1225741998.png") > system("convert tmp/2ji8i1225741998.ps tmp/2ji8i1225741998.png") > system("convert tmp/3c8fh1225741998.ps tmp/3c8fh1225741998.png") > system("convert tmp/4kp3q1225741998.ps tmp/4kp3q1225741998.png") > system("convert tmp/5mudo1225741998.ps tmp/5mudo1225741998.png") > system("convert tmp/6nkdg1225741998.ps tmp/6nkdg1225741998.png") > > > proc.time() user system elapsed 4.097 2.311 5.184