R version 2.7.2 (2008-08-25) 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(91.2,99.2,108.2,101.5,106.9,104.4,77.9,60,99.5,95,105.6,102.5,93.3,97.3,127,111.7,96.4,133,72.2,95.8,124.1,127.6,110.7,104.6,112.7,115.3,139.4,119,97.4,154,81.5,88.8,127.7,105.1,114.9,106.4,104.5,121.6,141.4,99,126.7,134.1,81.3,88.6,132.7,132.9,134.4,103.7,119.7,115,132.9,108.5,113.9,142,97.7,92.2,128.8,134.9,128.2,114.8) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 91.2 93.3 112.7 104.5 119.7 NA [2,] 99.2 97.3 115.3 121.6 115.0 NA [3,] 108.2 127.0 139.4 141.4 132.9 NA [4,] 101.5 111.7 119.0 99.0 108.5 NA [5,] 106.9 96.4 97.4 126.7 113.9 NA [6,] 104.4 133.0 154.0 134.1 142.0 NA [7,] 77.9 72.2 81.5 81.3 97.7 NA [8,] 60.0 95.8 88.8 88.6 92.2 NA [9,] 99.5 124.1 127.7 132.7 128.8 NA [10,] 95.0 127.6 105.1 132.9 134.9 NA [11,] 105.6 110.7 114.9 134.4 128.2 NA [12,] 102.5 104.6 106.4 103.7 114.8 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/1078y1225741430.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/26bdd1225741430.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/3wnja1225741430.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/4e76f1225741430.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,] 91.2 97.3 127.0 99.0 96.4 133.0 77.9 88.6 124.1 95.0 105.6 102.5 [2,] 93.3 99.2 127.0 101.5 97.4 133.0 77.9 88.6 124.1 105.1 110.7 103.7 [3,] 104.5 115.0 132.9 108.5 106.9 134.1 81.3 88.8 127.7 127.6 114.9 104.6 [4,] 112.7 115.3 139.4 111.7 113.9 142.0 81.5 92.2 128.8 132.9 128.2 106.4 [5,] 119.7 121.6 141.4 119.0 126.7 154.0 81.5 95.8 132.7 134.9 134.4 106.4 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 90.792 103.6238 124.1382 101.2927 95.24114 127.7406 78.75625 86.25625 [2,] 118.208 126.3762 141.6618 115.7073 118.55886 140.4594 83.84375 91.34375 [,9] [,10] [,11] [,12] [1,] 124.379 107.9566 102.5345 102.6922 [2,] 131.021 147.2434 127.2655 106.5078 $out [1] 108.2 104.4 72.2 97.7 60.0 99.5 114.8 $group [1] 3 6 7 7 8 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(91.2, 93.3, 104.5, 112.7, 119.7, 97.3, 99.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5se9h1225741430.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] [1,] 77.9 72.20 81.50 81.30 92.20 NA [2,] 93.1 96.10 101.25 101.35 111.20 NA [3,] 100.5 107.65 113.80 124.15 117.35 NA [4,] 105.0 125.55 123.35 133.50 130.85 NA [5,] 108.2 133.00 154.00 141.40 142.00 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 95.07233 94.21766 103.7200 109.4862 108.3875 NA [2,] 105.92767 121.08234 123.8800 138.8138 126.3125 NA $out [1] 60 $group [1] 1 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(77.9, 93.1, 100.5, 105, 108.2, 72.2, 96.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6rfxa1225741430.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,] 82.12 81.30 79.700 [2,] 105.34 104.55 104.025 [3,] 108.97 111.70 106.925 [4,] 120.83 127.65 122.950 [5,] 133.50 134.10 137.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 101.9049 101.1639 98.29318 [2,] 116.0351 122.2361 115.55682 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(82.12, 105.34, 108.97, 120.83, 133.5, 81.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1078y1225741430.ps tmp/1078y1225741430.png") > system("convert tmp/26bdd1225741430.ps tmp/26bdd1225741430.png") > system("convert tmp/3wnja1225741430.ps tmp/3wnja1225741430.png") > system("convert tmp/4e76f1225741430.ps tmp/4e76f1225741430.png") > system("convert tmp/5se9h1225741430.ps tmp/5se9h1225741430.png") > system("convert tmp/6rfxa1225741430.ps tmp/6rfxa1225741430.png") > > > proc.time() user system elapsed 1.264 0.808 1.523