R version 2.8.0 (2008-10-20) 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(93.5,94.7,112.9,99.2,105.6,113.0,83.1,81.1,96.9,104.3,97.7,102.6,89.9,96.0,112.7,107.1,106.2,121.0,101.2,83.2,105.1,113.3,99.1,100.3,93.5,98.8,106.2,98.3,102.1,117.1,101.5,80.5,105.9,109.5,97.2,114.5,93.5,100.9,121.1,116.5,109.3,118.1,108.3,105.4,116.2,111.2,105.8,122.7,99.5,107.9,124.6,115.0,110.3,132.7,99.7,96.5,118.7,112.9,130.5,137.9,115.0,116.8,140.9,120.7,134.2,147.3,112.4,107.1,128.4,137.7,135.0,151.0,137.4,132.4,161.3,139.8,146.0,154.6,142.1,120.5) > 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] 80 > (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 7 7 7 7 7 7 7 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 93.5 89.9 93.5 93.5 99.5 115.0 137.4 [2,] 94.7 96.0 98.8 100.9 107.9 116.8 132.4 [3,] 112.9 112.7 106.2 121.1 124.6 140.9 161.3 [4,] 99.2 107.1 98.3 116.5 115.0 120.7 139.8 [5,] 105.6 106.2 102.1 109.3 110.3 134.2 146.0 [6,] 113.0 121.0 117.1 118.1 132.7 147.3 154.6 [7,] 83.1 101.2 101.5 108.3 99.7 112.4 142.1 [8,] 81.1 83.2 80.5 105.4 96.5 107.1 120.5 [9,] 96.9 105.1 105.9 116.2 118.7 128.4 NA [10,] 104.3 113.3 109.5 111.2 112.9 137.7 NA [11,] 97.7 99.1 97.2 105.8 130.5 135.0 NA [12,] 102.6 100.3 114.5 122.7 137.9 151.0 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/1pa4n1230316732.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/20jal1230316732.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/377zx1230316732.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/4mem61230316732.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,] 89.90 94.70 106.20 98.30 102.10 113.0 99.70 80.50 96.90 104.30 [2,] 93.50 97.40 112.80 103.15 105.90 117.6 100.45 82.15 105.10 109.50 [3,] 93.50 100.90 121.10 115.00 109.30 121.0 101.50 96.50 111.05 112.05 [4,] 107.25 112.35 132.75 118.60 122.25 140.0 110.35 106.25 118.70 113.30 [5,] 115.00 132.40 161.30 139.80 146.00 154.6 112.40 120.50 128.40 113.30 [,11] [,12] [1,] 97.20 100.3 [2,] 97.70 102.6 [3,] 102.45 118.6 [4,] 130.50 137.9 [5,] 135.00 151.0 $n [1] 7 7 7 7 7 7 7 7 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 85.28872 91.9721 109.1862 105.7735 99.53604 107.6231 95.58788 [2,] 101.71128 109.8279 133.0138 124.2265 119.06396 134.3769 107.41212 [,8] [,9] [,10] [,11] [,12] [1,] 82.10787 102.2776 109.5989 81.29294 95.83036 [2,] 110.89213 119.8224 114.5011 123.60706 141.36964 $out [1] 137.4 83.1 142.1 137.7 $group [1] 1 7 7 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(89.9, 93.5, 93.5, 107.25, 115, 94.7, 97.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/54kmg1230316732.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,] 81.10 83.20 93.50 93.50 96.50 107.1 120.50 [2,] 94.10 97.55 97.75 105.60 103.80 115.9 134.90 [3,] 98.45 103.15 101.80 110.25 113.95 131.3 140.95 [4,] 104.95 109.90 107.85 117.30 127.55 139.3 150.30 [5,] 113.00 121.00 117.10 122.70 137.90 151.0 161.30 $n [1] 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 93.50124 97.51708 97.19332 104.9136 103.1175 120.6271 132.3473 [2,] 103.39876 108.78292 106.40668 115.5864 124.7825 141.9729 149.5527 $out [1] 80.5 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(81.1, 94.1, 98.45, 104.95, 113, 83.2, 97.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6c8e11230316732.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,] 96.32857 93.500 94.2000 [2,] 106.84286 101.200 105.1375 [3,] 112.83333 110.175 111.3750 [4,] 118.87143 116.800 116.9563 [5,] 129.11429 121.100 128.8000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 107.3470 103.0597 105.9844 [2,] 118.3196 117.2903 116.7656 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(96.3285714285714, 106.842857142857, 112.833333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1pa4n1230316732.ps tmp/1pa4n1230316732.png") > system("convert tmp/20jal1230316732.ps tmp/20jal1230316732.png") > system("convert tmp/377zx1230316732.ps tmp/377zx1230316732.png") > system("convert tmp/4mem61230316732.ps tmp/4mem61230316732.png") > system("convert tmp/54kmg1230316732.ps tmp/54kmg1230316732.png") > system("convert tmp/6c8e11230316732.ps tmp/6c8e11230316732.png") > > > proc.time() user system elapsed 1.042 0.820 2.046