R version 2.8.0 (2008-10-20) 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(96.5,97.3,122.0,91.0,107.9,114.6,98.0,95.5,98.7,115.9,110.4,109.5,92.3,102.1,112.8,110.2,98.9,119.0,104.3,98.8,109.4,170.3,118.0,116.9,111.7,116.8,116.1,114.8,110.8,122.8,104.7,86.0,127.2,126.1,114.6,127.8,105.2,113.1,161.0,126.9,117.7,144.9,119.4,107.1,142.8,126.2,126.9,179.2,105.3,114.8,125.4,113.2,134.4,150.0,100.9,101.8,137.7,138.7,135.4,153.8,119.5,123.3,166.4,137.5,142.2,167.0,112.3,120.6,154.9,153.4,156.2,175.8,131.7,130.1,161.1,128.2,140.3,168.2,110.2,126.2) > 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] 80 > (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 7 7 7 7 7 7 7 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.5 92.3 111.7 105.2 105.3 119.5 131.7 [2,] 97.3 102.1 116.8 113.1 114.8 123.3 130.1 [3,] 122.0 112.8 116.1 161.0 125.4 166.4 161.1 [4,] 91.0 110.2 114.8 126.9 113.2 137.5 128.2 [5,] 107.9 98.9 110.8 117.7 134.4 142.2 140.3 [6,] 114.6 119.0 122.8 144.9 150.0 167.0 168.2 [7,] 98.0 104.3 104.7 119.4 100.9 112.3 110.2 [8,] 95.5 98.8 86.0 107.1 101.8 120.6 126.2 [9,] 98.7 109.4 127.2 142.8 137.7 154.9 NA [10,] 115.9 170.3 126.1 126.2 138.7 153.4 NA [11,] 110.4 118.0 114.6 126.9 135.4 156.2 NA [12,] 109.5 116.9 127.8 179.2 153.8 175.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/1r2du1230317748.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/2wnw11230317748.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/39jin1230317748.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/4bj911230317748.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,] 92.30 97.30 112.80 91.00 98.90 114.6 98.00 86.00 98.70 115.90 [2,] 100.85 107.60 119.05 111.70 109.35 120.9 102.60 97.15 109.40 126.10 [3,] 105.30 114.80 125.40 114.80 117.70 144.9 104.70 101.80 132.45 132.45 [4,] 115.60 120.05 161.05 127.55 137.35 158.5 111.25 113.85 142.80 153.40 [5,] 131.70 130.10 166.40 137.50 142.20 168.2 119.40 126.20 154.90 170.30 [,11] [,12] [1,] 110.40 109.5 [2,] 114.60 116.9 [3,] 122.45 140.8 [4,] 135.40 175.8 [5,] 156.20 179.2 $n [1] 7 7 7 7 7 7 7 7 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 96.49154 107.3651 100.3183 105.3346 100.9789 122.4459 99.53436 91.82703 [2,] 114.10846 122.2349 150.4817 124.2654 134.4211 167.3541 109.86564 111.77297 [,9] [,10] [,11] [,12] [1,] 110.9059 114.8406 109.0333 102.8076 [2,] 153.9941 150.0594 135.8667 178.7924 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(92.3, 100.85, 105.3, 115.6, 131.7, 97.3, 107.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5m3571230317748.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,] 91.0 92.30 104.70 105.20 100.90 112.30 110.2 [2,] 96.9 100.50 111.25 115.40 109.25 121.95 127.2 [3,] 103.3 109.80 115.45 126.55 129.90 147.80 130.9 [4,] 112.5 117.45 124.45 143.85 138.20 161.30 150.7 [5,] 122.0 119.00 127.80 179.20 153.80 175.80 168.2 $n [1] 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.18474 102.069 109.4294 113.5738 116.6957 129.8522 117.7726 [2,] 110.41526 117.531 121.4706 139.5262 143.1043 165.7478 144.0274 $out [1] 170.3 86.0 $group [1] 2 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(91, 96.9, 103.3, 112.5, 122, 92.3, 100.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6a82c1230317748.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,] 105.1429 101.800 105.5000 [2,] 111.4071 110.050 111.0250 [3,] 124.3298 120.075 123.8563 [4,] 138.1310 132.450 138.8125 [5,] 143.8333 144.900 144.9625 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 112.1409 109.8582 111.1822 [2,] 136.5187 130.2918 136.5303 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(105.142857142857, 111.407142857143, 124.329761904762, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1r2du1230317748.ps tmp/1r2du1230317748.png") > system("convert tmp/2wnw11230317748.ps tmp/2wnw11230317748.png") > system("convert tmp/39jin1230317748.ps tmp/39jin1230317748.png") > system("convert tmp/4bj911230317748.ps tmp/4bj911230317748.png") > system("convert tmp/5m3571230317748.ps tmp/5m3571230317748.png") > system("convert tmp/6a82c1230317748.ps tmp/6a82c1230317748.png") > > > proc.time() user system elapsed 1.058 0.805 1.377