R version 2.7.0 (2008-04-22) 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(98.6,98,106.8,96.6,100.1,107.7,91.5,97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.4) > 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] 92 > (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 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 98.6 99.5 110.6 100.6 108.7 111.0 115.7 117.7 [2,] 98.0 98.0 104.0 104.3 105.5 112.4 113.6 117.5 [3,] 106.8 104.3 112.6 120.4 119.8 130.6 129.7 120.6 [4,] 96.6 100.6 107.3 107.5 111.3 109.1 112.0 127.5 [5,] 100.1 101.1 98.9 102.9 110.6 118.8 116.8 112.3 [6,] 107.7 103.9 109.8 125.6 120.1 123.9 127.0 124.5 [7,] 91.5 96.9 104.9 107.5 97.5 101.6 112.1 115.2 [8,] 97.8 95.5 102.2 108.8 107.7 112.8 114.2 105.4 [9,] 107.4 108.4 123.9 128.4 127.3 128.0 121.1 NA [10,] 117.5 117.0 124.9 121.1 117.2 129.6 131.6 NA [11,] 105.6 103.8 112.7 119.5 119.8 125.8 125.0 NA [12,] 97.4 100.8 121.9 128.7 116.2 119.5 120.4 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/1u4xt1225964403.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/2c8an1225964403.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/36tv31225964403.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/4nonk1225964403.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,] 98.60 98.0 104.30 96.60 98.90 103.90 91.50 95.50 107.40 117.00 [2,] 100.05 101.0 109.70 103.95 100.60 108.75 97.20 100.00 114.75 117.35 [3,] 109.65 104.9 120.10 108.30 106.75 122.00 103.25 106.55 123.90 121.10 [4,] 113.35 113.0 125.15 111.65 114.55 125.05 109.80 110.80 127.65 127.25 [5,] 117.70 117.5 130.60 112.00 118.80 127.00 115.20 114.20 128.40 131.60 [,11] [,12] [1,] 103.80 97.40 [2,] 109.15 108.50 [3,] 119.50 119.50 [4,] 122.40 121.15 [5,] 125.80 128.70 $n [1] 8 8 8 8 8 8 8 8 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 102.2204 98.19663 111.4694 103.9987 98.95733 112.8946 96.21146 100.5170 [2,] 117.0796 111.60337 128.7306 112.6013 114.54267 131.1054 110.28854 112.5830 [,9] [,10] [,11] [,12] [1,] 116.1963 115.1879 111.5873 111.9456 [2,] 131.6037 127.0121 127.4127 127.0544 $out [1] 127.5 $group [1] 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(98.6, 100.05, 109.65, 113.35, 117.7, 98, 101, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5hblj1225964403.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,] 91.50 95.50 98.90 100.60 97.50 101.60 112.0 105.40 [2,] 97.60 98.75 104.45 105.90 108.20 111.70 113.9 113.75 [3,] 99.35 100.95 110.20 114.15 113.75 119.15 118.6 117.60 [4,] 107.10 104.10 117.30 123.35 119.80 126.90 126.0 122.55 [5,] 117.50 108.40 124.90 128.70 127.30 130.60 131.6 127.50 $n [1] 12 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 95.01699 98.50983 104.3390 106.1909 108.4592 112.2172 113.0811 112.6842 [2,] 103.68301 103.39017 116.0610 122.1091 119.0408 126.0828 124.1189 122.5158 $out [1] 117 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(91.5, 97.6, 99.35, 107.1, 117.5, 95.5, 98.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6vt7c1225964403.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,] 103.4000 103.250 103.0000 [2,] 107.1750 106.650 106.6937 [3,] 111.9866 114.575 111.6875 [4,] 117.9562 120.600 117.0187 [5,] 122.7000 123.900 122.3000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 107.0692 108.2123 106.9782 [2,] 116.9040 120.9377 116.3968 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(103.4, 107.175, 111.986607142857, 117.95625, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1u4xt1225964403.ps tmp/1u4xt1225964403.png") > system("convert tmp/2c8an1225964403.ps tmp/2c8an1225964403.png") > system("convert tmp/36tv31225964403.ps tmp/36tv31225964403.png") > system("convert tmp/4nonk1225964403.ps tmp/4nonk1225964403.png") > system("convert tmp/5hblj1225964403.ps tmp/5hblj1225964403.png") > system("convert tmp/6vt7c1225964403.ps tmp/6vt7c1225964403.png") > > > proc.time() user system elapsed 2.321 1.348 2.524