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(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] 93 > (np <- floor(n / par1)) [1] 7 > 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] 8 8 8 8 8 8 8 8 8 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 112.1 91.8 88.3 115.3 104.3 127.6 162.5 159.1 [2,] 104.2 94.8 88.6 119.2 103.9 137.9 163.1 159.5 [3,] 102.4 91.8 94.9 107.8 105.3 151.4 157.2 157.3 [4,] 100.3 89.3 94.7 106.8 102.6 143.6 158.8 156.4 [5,] 102.6 91.7 92.6 104.2 103.3 143.4 155.4 156.6 [6,] 101.5 86.2 91.8 94.8 107.9 141.9 148.5 162.4 [7,] 103.4 82.8 96.4 97.5 107.8 135.2 154.2 166.8 [8,] 99.4 82.3 96.4 98.3 109.8 133.1 153.3 162.6 [9,] 97.9 79.8 107.1 100.6 110.6 129.6 149.4 168.1 [10,] 98.0 79.4 111.9 94.9 110.8 134.1 147.9 NA [11,] 90.2 85.3 107.8 93.6 119.3 136.8 156.0 NA [12,] 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/1kqai1194621058.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/2jcz31194621058.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/3a5691194621058.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/4xfqv1194621058.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.30 88.60 91.80 89.3 91.70 86.2 82.80 82.30 79.80 79.40 85.30 [2,] 98.05 99.35 98.65 97.5 97.60 93.3 96.95 97.35 99.25 96.45 91.90 [3,] 113.70 111.70 106.55 104.7 103.75 104.7 105.60 104.60 108.85 110.80 107.80 [4,] 143.35 148.70 154.30 150.0 149.40 145.2 144.70 143.20 139.50 123.00 128.05 [5,] 162.50 163.10 157.30 158.8 156.60 162.4 166.80 162.60 168.10 147.90 156.00 [,12] [1,] 87.10 [2,] 92.75 [3,] 109.20 [4,] 135.80 [5,] 163.00 $n [1] 8 8 8 8 8 8 8 8 8 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 88.39477 84.13238 75.46311 75.37275 74.81378 75.70791 78.92616 [2,] 139.00523 139.26762 137.63689 134.02725 132.68622 133.69209 132.27384 [,8] [,9] [,10] [,11] [,12] [1,] 78.98753 86.36577 94.94477 86.2118 83.49123 [2,] 130.21247 131.33423 126.65523 129.3882 134.90877 $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, 98.05, 113.7, 143.35, 162.5, 88.6, 99.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5rcq51194621058.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] [1,] 97.90 79.40 88.30 93.60 102.60 127.60 147.90 156.4 [2,] 97.95 82.55 92.20 96.20 104.10 133.60 151.35 157.3 [3,] 100.90 86.85 95.65 99.45 107.85 137.35 155.70 159.5 [4,] 103.00 91.75 107.45 107.30 110.70 143.45 160.65 162.6 [5,] 104.20 94.80 111.90 119.20 119.30 151.40 163.10 168.1 $n [1] 12 12 12 12 12 12 12 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 98.59666 82.65382 88.69437 94.38722 104.8397 132.8573 151.4582 156.7087 [2,] 103.20334 91.04618 102.60563 104.51278 110.8603 141.8427 159.9418 162.2913 $out [1] 112.1 90.2 87.1 128.1 $group [1] 1 1 1 5 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(97.9, 97.95, 100.9, 103, 104.2, 79.4, 82.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6c76l1194621058.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,] 112.7143 103.750 109.7250 [2,] 116.7518 104.700 115.7562 [3,] 117.9500 107.175 118.4562 [4,] 119.5938 110.000 122.6562 [5,] 121.4000 113.700 126.6875 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 116.6538 104.7576 115.3091 [2,] 119.2462 109.5924 121.6034 $out [1] 111 $group [1] 1 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(112.714285714286, 116.751785714286, 117.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1kqai1194621058.ps tmp/1kqai1194621058.png") > system("convert tmp/2jcz31194621058.ps tmp/2jcz31194621058.png") > system("convert tmp/3a5691194621058.ps tmp/3a5691194621058.png") > system("convert tmp/4xfqv1194621058.ps tmp/4xfqv1194621058.png") > system("convert tmp/5rcq51194621058.ps tmp/5rcq51194621058.png") > system("convert tmp/6c76l1194621058.ps tmp/6c76l1194621058.png") > > > proc.time() user system elapsed 1.327 0.837 1.549