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(92.1,95.6,102.3,98.6,98.2,104.5,84,73.8,103.9,106,97.2,102.6,89,93.8,116.7,106.8,98.5,118.7,90,91.9,113.3,113.1,104.1,108.7,96.7,101,116.9,105.8,99,129.4,83,88.9,115.9,104.2,113.4,112.2,100.8,107.3,126.6,102.9,117.9,128.8,87.5,93.8,122.7,126.2,124.6,116.7,115.2,111.1,129.9,113.3,118.5,137.9,103.6,101.7,127.4,137,129.1,120.6) > 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,] 92.1 89.0 96.7 100.8 115.2 NA [2,] 95.6 93.8 101.0 107.3 111.1 NA [3,] 102.3 116.7 116.9 126.6 129.9 NA [4,] 98.6 106.8 105.8 102.9 113.3 NA [5,] 98.2 98.5 99.0 117.9 118.5 NA [6,] 104.5 118.7 129.4 128.8 137.9 NA [7,] 84.0 90.0 83.0 87.5 103.6 NA [8,] 73.8 91.9 88.9 93.8 101.7 NA [9,] 103.9 113.3 115.9 122.7 127.4 NA [10,] 106.0 113.1 104.2 126.2 137.0 NA [11,] 97.2 104.1 113.4 124.6 129.1 NA [12,] 102.6 108.7 112.2 116.7 120.6 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/189151225740045.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/2ab4r1225740045.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/3tdu31225740045.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/48urv1225740045.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,] 89.0 93.8 102.3 98.6 98.2 104.5 83.0 88.9 103.9 104.2 97.2 102.6 [2,] 92.1 95.6 116.7 102.9 98.5 118.7 84.0 88.9 113.3 106.0 104.1 108.7 [3,] 96.7 101.0 116.9 105.8 99.0 128.8 87.5 91.9 115.9 113.1 113.4 112.2 [4,] 100.8 107.3 126.6 106.8 117.9 129.4 90.0 93.8 122.7 126.2 124.6 116.7 [5,] 100.8 111.1 129.9 106.8 118.5 137.9 90.0 93.8 127.4 137.0 129.1 120.6 $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.5526 92.73281 109.9047 103.0443 85.29201 121.2394 83.26042 88.43767 [2,] 102.8474 109.26719 123.8953 108.5557 112.70799 136.3606 91.73958 95.36233 [,9] [,10] [,11] [,12] [1,] 109.2580 98.82673 98.91475 106.5472 [2,] 122.5420 127.37327 127.88525 117.8528 $out [1] 115.2 113.3 103.6 73.8 101.7 $group [1] 1 4 7 8 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(89, 92.1, 96.7, 100.8, 100.8, 93.8, 95.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5gsyx1225740045.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,] 84.00 89.00 83.00 87.50 101.70 NA [2,] 93.85 92.85 97.85 101.85 112.20 NA [3,] 98.40 105.45 105.00 117.30 119.55 NA [4,] 103.25 113.20 114.65 125.40 129.50 NA [5,] 106.00 118.70 129.40 128.80 137.90 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 94.1126 96.16823 97.3374 106.5587 111.6594 NA [2,] 102.6874 114.73177 112.6626 128.0413 127.4406 NA $out [1] 73.8 $group [1] 1 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(84, 93.85, 98.4, 103.25, 106, 89, 92.85, 105.45, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/68l9n1225740045.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,] 89.62 87.50 87.00 [2,] 100.26 97.85 98.95 [3,] 109.29 109.00 110.45 [4,] 116.97 114.65 117.05 [5,] 123.86 128.80 124.05 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 101.6685 101.3374 102.1945 [2,] 116.9115 116.6626 118.7055 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(89.62, 100.26, 109.29, 116.97, 123.86, 87.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/189151225740045.ps tmp/189151225740045.png") > system("convert tmp/2ab4r1225740045.ps tmp/2ab4r1225740045.png") > system("convert tmp/3tdu31225740045.ps tmp/3tdu31225740045.png") > system("convert tmp/48urv1225740045.ps tmp/48urv1225740045.png") > system("convert tmp/5gsyx1225740045.ps tmp/5gsyx1225740045.png") > system("convert tmp/68l9n1225740045.ps tmp/68l9n1225740045.png") > > > proc.time() user system elapsed 2.869 1.904 3.150