R version 2.5.1 (2007-06-27) 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(97.3,101,113.2,101,105.7,113.9,86.4,96.5,103.3,114.9,105.8,94.2,98.4,99.4,108.8,112.6,104.4,112.2,81.1,97.1,112.6,113.8,107.8,103.2,103.3,101.2,107.7,110.4,101.9,115.9,89.9,88.6,117.2,123.9,100,103.6,94.1,98.7,119.5,112.7,104.4,124.7,89.1,97,121.6,118.8,114,111.5,97.2,102.5,113.4,109.8,104.9,126.1,80,96.8,117.2,112.3,117.3,111.1,102.2,104.3,122.9,107.6,121.3,131.5,89,104.4,128.9,135.9,133.3,121.3,120.5,120.4,137.9,126.1,133.2,146.6,103.4,117.2) > par1 = '7' > #'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] 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 11 11 11 11 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 97.3 96.5 108.8 113.8 101.9 103.6 89.1 102.5 117.2 107.6 133.3 146.6 [2,] 101.0 103.3 112.6 107.8 115.9 94.1 97.0 113.4 112.3 121.3 121.3 103.4 [3,] 113.2 114.9 104.4 103.2 89.9 98.7 121.6 109.8 117.3 131.5 120.5 117.2 [4,] 101.0 105.8 112.2 103.3 88.6 119.5 118.8 104.9 111.1 89.0 120.4 NA [5,] 105.7 94.2 81.1 101.2 117.2 112.7 114.0 126.1 102.2 104.4 137.9 NA [6,] 113.9 98.4 97.1 107.7 123.9 104.4 111.5 80.0 104.3 128.9 126.1 NA [7,] 86.4 99.4 112.6 110.4 100.0 124.7 97.2 96.8 122.9 135.9 133.2 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/12h6r1193405734.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/2yi3z1193405734.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/3aqi81193405734.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/4gz9g1193405734.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] [1,] 89.1 94.10 89.90 88.60 81.1 80.00 86.4 [2,] 99.6 102.15 103.80 102.15 101.7 101.35 98.3 [3,] 105.6 110.05 114.05 105.80 105.7 107.70 110.4 [4,] 115.5 114.65 118.90 115.50 115.6 118.90 123.8 [5,] 133.3 121.30 131.50 120.40 126.1 128.90 135.9 $n [1] 12 12 12 11 11 11 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 98.3479 104.3487 107.1628 99.44022 99.0782 99.3394 98.2521 [2,] 112.8521 115.7513 120.9372 112.15978 112.3218 116.0606 122.5479 $out [1] 146.6 137.9 $group [1] 1 5 $names [1] "1" "2" "3" "4" "5" "6" "7" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(89.1, 99.6, 105.6, 115.5, 133.3, 94.1, 102.15, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/502uv1193405734.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] [,11] [1,] 86.40 94.20 97.10 101.20 88.60 94.10 89.1 96.80 102.20 89.0 120.40 [2,] 99.15 97.45 100.75 103.25 94.95 101.15 97.1 99.65 107.70 106.0 120.90 [3,] 101.00 99.40 108.80 107.70 101.90 104.40 111.5 104.90 112.30 121.3 126.10 [4,] 109.45 104.55 112.40 109.10 116.55 116.10 116.4 111.60 117.25 130.2 133.25 [5,] 113.90 114.90 112.60 113.80 123.90 124.70 121.6 126.10 122.90 135.9 137.90 [,12] [1,] 103.4 [2,] 110.3 [3,] 117.2 [4,] 131.9 [5,] 146.6 $n [1] 7 7 7 7 7 7 7 7 7 7 7 3 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 94.849 95.16 101.8428 104.2065 89.00083 95.4721 99.97435 97.76365 [2,] 107.151 103.64 115.7572 111.1935 114.79917 113.3279 123.02565 112.03635 [,9] [,10] [,11] [,12] [1,] 106.5969 106.8482 118.7248 97.49619 [2,] 118.0031 135.7518 133.4752 136.90381 $out [1] 81.1 80.0 $group [1] 3 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" NA Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(86.4, 99.15, 101, 109.45, 113.9, 94.2, 97.45, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6615d1193405734.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.7818 105.600 107.7000 [2,] 108.6811 105.750 108.5125 [3,] 108.7909 107.700 108.8250 [4,] 110.3568 110.225 110.5875 [5,] 111.8500 114.050 111.1000 $n [1] 7 7 7 $conf [,1] [,2] [,3] [1,] 107.7902 105.0276 107.5858 [2,] 109.7916 110.3724 110.0642 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(106.781818181818, 108.681060606061, 108.790909090909, > dev.off() null device 1 > > system("convert tmp/12h6r1193405734.ps tmp/12h6r1193405734.png") > system("convert tmp/2yi3z1193405734.ps tmp/2yi3z1193405734.png") > system("convert tmp/3aqi81193405734.ps tmp/3aqi81193405734.png") > system("convert tmp/4gz9g1193405734.ps tmp/4gz9g1193405734.png") > system("convert tmp/502uv1193405734.ps tmp/502uv1193405734.png") > system("convert tmp/6615d1193405734.ps tmp/6615d1193405734.png") > > > proc.time() user system elapsed 1.394 0.854 1.588