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(140,132,117,114,113,110,107,103,98,98,137,148,147,139,130,128,127,123,118,114,108,111,151,159,158,148,138,137,136,133,126,120,114,116,153,162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124) > 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] 73 > (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 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 140 147 158 161 157 149 124 [2,] 132 139 148 149 147 134 NA [3,] 117 130 138 139 137 123 NA [4,] 114 128 137 135 132 116 NA [5,] 113 127 136 130 125 117 NA [6,] 110 123 133 127 123 111 NA [7,] 107 118 126 122 117 105 NA [8,] 103 114 120 117 114 102 NA [9,] 98 108 114 112 111 95 NA [10,] 98 111 116 113 112 93 NA [11,] 137 151 153 149 144 124 NA [12,] 148 159 162 157 150 130 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/1pf8t1194894890.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/2crmr1194894890.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/3dsgz1194894890.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/4w6df1194894890.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,] 124.0 132 117.0 114 113 110 105.0 102 95.0 93.0 124.0 148.0 [2,] 143.5 134 123.0 116 117 111 107.0 103 98.0 98.0 137.0 148.0 [3,] 149.0 143 133.5 130 126 123 117.5 114 109.5 111.5 146.5 153.5 [4,] 157.5 148 138.0 135 130 127 122.0 117 112.0 113.0 151.0 159.0 [5,] 161.0 149 139.0 137 136 133 126.0 120 114.0 116.0 153.0 162.0 $n [1] 7 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 140.6394 133.9695 123.8245 117.7444 117.6146 112.6795 107.8245 104.9695 [2,] 157.3606 152.0305 143.1755 142.2556 134.3854 133.3205 127.1755 123.0305 [,9] [,10] [,11] [,12] [1,] 100.4695 101.8245 137.4695 146.4046 [2,] 118.5305 121.1755 155.5305 160.5954 $out [1] 130 $group [1] 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(124, 143.5, 149, 157.5, 161, 132, 134, 143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5imrg1194894890.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,] 98.0 108.0 114.0 112.0 111.0 93.0 124 [2,] 105.0 116.0 123.0 119.5 115.5 103.5 124 [3,] 113.5 127.5 136.5 132.5 128.5 116.5 124 [4,] 134.5 143.0 150.5 149.0 145.5 127.0 124 [5,] 148.0 159.0 162.0 161.0 157.0 149.0 124 $n [1] 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 100.0449 115.1851 123.9571 119.0449 114.8168 105.7815 124 [2,] 126.9551 139.8149 149.0429 145.9551 142.1832 127.2185 124 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(98, 105, 113.5, 134.5, 148, 108, 116, 127.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6aiij1194894890.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,] 106.3333 109.50 106.1250 [2,] 113.7500 115.75 113.1250 [3,] 125.8333 128.00 125.3750 [4,] 142.2500 144.75 143.0625 [5,] 151.0000 153.50 153.5000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 112.8343 114.7729 111.7203 [2,] 138.8324 141.2271 139.0297 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(106.333333333333, 113.75, 125.833333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1pf8t1194894890.ps tmp/1pf8t1194894890.png") > system("convert tmp/2crmr1194894890.ps tmp/2crmr1194894890.png") > system("convert tmp/3dsgz1194894890.ps tmp/3dsgz1194894890.png") > system("convert tmp/4w6df1194894890.ps tmp/4w6df1194894890.png") > system("convert tmp/5imrg1194894890.ps tmp/5imrg1194894890.png") > system("convert tmp/6aiij1194894890.ps tmp/6aiij1194894890.png") > > > proc.time() user system elapsed 1.339 0.866 1.619