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(106.60,106.80,107.00,107.10,107.30,107.40,107.60,107.70,107.90,108.20,108.30,108.50,108.92,109.23,109.41,109.65,109.91,110.01,110.20,110.49,110.57,110.72,110.94,111.09,111.28,111.41,111.62,111.76,111.89,112.04,112.12,112.30,112.47,112.59,112.78,112.73,112.99,113.10,113.33,113.38,113.68,113.65,113.81,113.88,114.02,114.25,114.28,114.38,114.73,114.97,115.05,115.29,115.37,115.54,115.76,115.92,116.02,116.21,116.26,116.51) > 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,] 106.6 108.92 111.28 112.99 114.73 NA [2,] 106.8 109.23 111.41 113.10 114.97 NA [3,] 107.0 109.41 111.62 113.33 115.05 NA [4,] 107.1 109.65 111.76 113.38 115.29 NA [5,] 107.3 109.91 111.89 113.68 115.37 NA [6,] 107.4 110.01 112.04 113.65 115.54 NA [7,] 107.6 110.20 112.12 113.81 115.76 NA [8,] 107.7 110.49 112.30 113.88 115.92 NA [9,] 107.9 110.57 112.47 114.02 116.02 NA [10,] 108.2 110.72 112.59 114.25 116.21 NA [11,] 108.3 110.94 112.78 114.28 116.26 NA [12,] 108.5 111.09 112.73 114.38 116.51 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/12c8s1225305897.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/296ob1225305897.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/3zmb91225305897.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/4pyja1225305897.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] [1,] 106.60 106.80 107.00 107.10 107.30 107.40 107.60 107.70 107.90 108.20 [2,] 108.92 109.23 109.41 109.65 109.91 110.01 110.20 110.49 110.57 110.72 [3,] 111.28 111.41 111.62 111.76 111.89 112.04 112.12 112.30 112.47 112.59 [4,] 112.99 113.10 113.33 113.38 113.68 113.65 113.81 113.88 114.02 114.25 [5,] 114.73 114.97 115.05 115.29 115.37 115.54 115.76 115.92 116.02 116.21 [,11] [,12] [1,] 108.30 108.50 [2,] 110.94 111.09 [3,] 112.78 112.73 [4,] 114.28 114.38 [5,] 116.26 116.51 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 108.4041 108.6755 108.8501 109.1244 109.2261 109.4680 109.5692 109.9046 [2,] 114.1559 114.1445 114.3899 114.3956 114.5539 114.6120 114.6708 114.6954 [,9] [,10] [,11] [,12] [1,] 110.0322 110.0957 110.4200 110.4053 [2,] 114.9078 115.0843 115.1400 115.0547 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(106.6, 108.92, 111.28, 112.99, 114.73, 106.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/5ynr11225305897.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,] 106.60 108.920 111.28 112.990 114.730 NA [2,] 107.05 109.530 111.69 113.355 115.170 NA [3,] 107.50 110.105 112.08 113.745 115.650 NA [4,] 108.05 110.645 112.53 114.135 116.115 NA [5,] 108.50 111.090 112.78 114.380 116.510 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 107.0439 109.5964 111.6969 113.3892 115.2190 NA [2,] 107.9561 110.6136 112.4631 114.1008 116.0810 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(106.6, 107.05, 107.5, 108.05, 108.5, 108.92, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/62glx1225305897.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,] 110.904 111.28 110.9550 [2,] 111.359 111.69 111.4425 [3,] 111.813 112.08 111.9175 [4,] 112.295 112.53 112.3900 [5,] 112.642 112.78 112.7350 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 111.3861 111.6969 111.4853 [2,] 112.2399 112.4631 112.3497 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/12c8s1225305897.ps tmp/12c8s1225305897.png") > system("convert tmp/296ob1225305897.ps tmp/296ob1225305897.png") > system("convert tmp/3zmb91225305897.ps tmp/3zmb91225305897.png") > system("convert tmp/4pyja1225305897.ps tmp/4pyja1225305897.png") > system("convert tmp/5ynr11225305897.ps tmp/5ynr11225305897.png") > system("convert tmp/62glx1225305897.ps tmp/62glx1225305897.png") > > > proc.time() user system elapsed 1.891 1.237 2.094