R version 2.6.0 (2007-10-03) 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(145.9,158.5,152.2,153.7,157.9,154.4,150.7,151.2,147.3,146.6,145.2,139.3,145.7,163.3,181.8,188.1,222.9,206.3,184.9,183.6,186.6,176.5,173.9,184.9,182.5,183.6,172.4,168.9,163.3,152.4,145.8,148.6,143.4,141.2,144.6,144.5,140.8,133.3,127.3,119.6,120.2,121.9,112.4,111,107.8,110.5,118.3,123,112.1,104.2,102.4,100.3,102.6,101.5,103.4,99.4,97.9,98,90.2,87.1,91.8,94.8,91.8,89.3,91.7,86.2,82.8,82.3,79.8,79.4,85.3,87.5,88.3,88.6,94.9,94.7,92.6,91.8,96.4,96.4,107.1,111.9,107.8,109.2,115.3,119.2,107.8,106.8,104.2,94.8,97.5,98.3,100.6,94.9,93.6,98,104.3,103.9,105.3,102.6,103.3,107.9,107.8,109.8,110.6,110.8,119.3,128.1,127.6,137.9,151.4,143.6,143.4,141.9,135.2,133.1,129.6,134.1,136.8,143.5,162.5,163.1,157.2,158.8,155.4,148.5,154.2,153.3,149.4,147.9,156,163,159.1,159.5,157.3,156.4,156.6,162.4,166.8,162.6,168.1) > 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] 141 > (np <- floor(n / par1)) [1] 11 > 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] 12 12 12 12 12 12 12 12 12 11 11 11 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 145.9 145.7 182.5 140.8 112.1 91.8 88.3 115.3 104.3 127.6 162.5 159.1 [2,] 158.5 163.3 183.6 133.3 104.2 94.8 88.6 119.2 103.9 137.9 163.1 159.5 [3,] 152.2 181.8 172.4 127.3 102.4 91.8 94.9 107.8 105.3 151.4 157.2 157.3 [4,] 153.7 188.1 168.9 119.6 100.3 89.3 94.7 106.8 102.6 143.6 158.8 156.4 [5,] 157.9 222.9 163.3 120.2 102.6 91.7 92.6 104.2 103.3 143.4 155.4 156.6 [6,] 154.4 206.3 152.4 121.9 101.5 86.2 91.8 94.8 107.9 141.9 148.5 162.4 [7,] 150.7 184.9 145.8 112.4 103.4 82.8 96.4 97.5 107.8 135.2 154.2 166.8 [8,] 151.2 183.6 148.6 111.0 99.4 82.3 96.4 98.3 109.8 133.1 153.3 162.6 [9,] 147.3 186.6 143.4 107.8 97.9 79.8 107.1 100.6 110.6 129.6 149.4 168.1 [10,] 146.6 176.5 141.2 110.5 98.0 79.4 111.9 94.9 110.8 134.1 147.9 NA [11,] 145.2 173.9 144.6 118.3 90.2 85.3 107.8 93.6 119.3 136.8 156.0 NA [12,] 139.3 184.9 144.5 123.0 87.1 87.5 109.2 98.0 128.1 143.5 163.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/145de1196417264.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/2libz1196417264.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/321e01196417264.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/4lyr91196417264.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] [1,] 88.3 88.60 91.80 89.30 91.70 86.20 82.80 82.30 79.80 79.40 85.3 [2,] 108.2 104.05 103.85 101.45 102.95 98.15 100.45 98.85 103.85 104.25 100.7 [3,] 134.2 135.60 139.35 131.60 131.80 131.90 123.80 122.05 120.10 111.90 119.3 [4,] 152.5 161.30 157.25 157.60 157.25 153.40 152.45 152.25 148.35 143.90 144.9 [5,] 182.5 183.60 181.80 188.10 222.90 206.30 184.90 183.60 186.60 176.50 173.9 [,12] [1,] 87.1 [2,] 103.6 [3,] 128.1 [4,] 144.0 [5,] 184.9 $n [1] 12 12 12 12 12 12 12 12 12 11 11 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 113.9945 109.4879 114.9939 105.9896 107.0334 106.7001 100.0825 97.6939 [2,] 154.4055 161.7121 163.7061 157.2104 156.5666 157.0999 147.5175 146.4061 [,9] [,10] [,11] [,12] [1,] 99.80325 93.01122 98.24365 108.8539 [2,] 140.39675 130.78878 140.35635 147.3461 $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(88.3, 108.2, 134.2, 152.5, 182.5, 88.6, 104.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5efc01196417264.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] [,8] [,9] [,10] [1,] 139.30 163.30 141.20 107.80 97.90 79.40 88.30 93.60 102.60 127.60 [2,] 146.25 175.20 144.55 111.70 97.95 82.55 92.20 96.20 104.10 133.60 [3,] 150.95 184.25 150.50 119.90 100.90 86.85 95.65 99.45 107.85 137.35 [4,] 154.05 187.35 170.65 125.15 103.00 91.75 107.45 107.30 110.70 143.45 [5,] 158.50 188.10 183.60 140.80 104.20 94.80 111.90 119.20 119.30 151.40 [,11] [,12] [1,] 147.90 156.4 [2,] 151.35 157.3 [3,] 155.70 159.5 [4,] 160.65 162.6 [5,] 163.10 168.1 $n [1] 12 12 12 12 12 12 12 12 12 12 12 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 147.3924 178.7083 138.5956 113.7654 98.59666 82.65382 88.69437 94.38722 [2,] 154.5076 189.7917 162.4044 126.0346 103.20334 91.04618 102.60563 104.51278 [,9] [,10] [,11] [,12] [1,] 104.8397 132.8573 151.4582 156.7087 [2,] 110.8603 141.8427 159.9418 162.2913 $out [1] 145.7 222.9 206.3 112.1 90.2 87.1 128.1 $group [1] 2 2 2 5 5 5 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" NA Warning message: In bxp(list(stats = c(139.3, 146.25, 150.95, 154.05, 158.5, 163.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6x3q31196417264.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,] 122.8909 111.900 122.8000 [2,] 127.4083 121.075 124.7500 [3,] 129.4958 129.850 126.7000 [4,] 132.6917 133.050 129.8500 [5,] 134.5083 139.350 132.2625 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 127.0861 124.3881 124.3739 [2,] 131.9056 135.3119 129.0261 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(122.890909090909, 127.408333333333, 129.495833333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/145de1196417264.ps tmp/145de1196417264.png") > system("convert tmp/2libz1196417264.ps tmp/2libz1196417264.png") > system("convert tmp/321e01196417264.ps tmp/321e01196417264.png") > system("convert tmp/4lyr91196417264.ps tmp/4lyr91196417264.png") > system("convert tmp/5efc01196417264.ps tmp/5efc01196417264.png") > system("convert tmp/6x3q31196417264.ps tmp/6x3q31196417264.png") > > > proc.time() user system elapsed 1.357 0.857 1.650