R version 2.6.0 (2007-10-03) 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(105.3,103,103.8,103.4,105.8,101.4,97,94.3,96.6,97.1,95.7,96.9,97.4,95.3,93.6,91.5,93.1,91.7,94.3,93.9,90.9,88.3,91.3,91.7,92.4,92,95.6,95.8,96.4,99,107,109.7,116.2,115.9,113.8,112.6,113.7,115.9,110.3,111.3,113.4,108.2,104.8,106,110.9,115,118.4,121.4,128.8,131.7,141.7,142.9,139.4,134.7,125,113.6,111.5,108.5,112.3,116.6,115.5,120.1,132.9,128.1,129.3,132.5,131,124.9,120.8,122,122.1,127.4,135.2,137.3,135,136,138.4,134.7,138.4,133.9,133.6,141.2,151.8,155.4,156.6,161.6,160.7,156,159.5,168.7,169.9,169.9,185.9) > 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] 93 > (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 8 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 105.3 97.4 92.4 113.7 128.8 115.5 135.2 156.6 [2,] 103.0 95.3 92.0 115.9 131.7 120.1 137.3 161.6 [3,] 103.8 93.6 95.6 110.3 141.7 132.9 135.0 160.7 [4,] 103.4 91.5 95.8 111.3 142.9 128.1 136.0 156.0 [5,] 105.8 93.1 96.4 113.4 139.4 129.3 138.4 159.5 [6,] 101.4 91.7 99.0 108.2 134.7 132.5 134.7 168.7 [7,] 97.0 94.3 107.0 104.8 125.0 131.0 138.4 169.9 [8,] 94.3 93.9 109.7 106.0 113.6 124.9 133.9 169.9 [9,] 96.6 90.9 116.2 110.9 111.5 120.8 133.6 185.9 [10,] 97.1 88.3 115.9 115.0 108.5 122.0 141.2 NA [11,] 95.7 91.3 113.8 118.4 112.3 122.1 151.8 NA [12,] 96.9 91.7 112.6 121.4 116.6 127.4 155.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/10tuf1197033920.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/2awxx1197033920.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/3b69i1197033920.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/43bfa1197033920.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.40 92.00 93.60 91.50 93.10 91.70 94.3 93.90 90.90 88.30 [2,] 101.35 99.15 99.70 99.60 101.10 100.20 100.9 100.15 103.75 102.80 [3,] 114.60 118.00 121.60 119.70 121.35 120.35 116.0 111.65 113.85 115.00 [4,] 132.00 134.50 138.35 139.45 138.90 134.70 134.7 129.40 127.20 118.95 [5,] 156.60 161.60 160.70 156.00 159.50 168.70 169.9 169.90 133.60 141.20 [,11] [,12] [1,] 91.30 91.70 [2,] 104.00 104.75 [3,] 113.80 116.60 [4,] 120.25 124.40 [5,] 122.10 127.40 $n [1] 8 8 8 8 8 8 8 8 8 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 97.47847 98.25298 100.0096 97.43922 100.2344 101.0778 97.11883 [2,] 131.72153 137.74702 143.1904 141.96078 142.4656 139.6222 134.88117 [,8] [,9] [,10] [,11] [,12] [1,] 95.31053 100.7505 105.3555 104.0958 104.8653 [2,] 127.98947 126.9495 124.6445 123.5042 128.3347 $out [1] 185.9 151.8 155.4 $group [1] 9 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(92.4, 101.35, 114.6, 132, 156.6, 92, 99.15, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5oofa1197033920.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,] 94.30 88.3 92.0 104.80 108.50 115.50 133.60 156.0 [2,] 96.75 91.4 95.7 109.25 112.95 121.40 134.85 159.5 [3,] 99.25 92.4 103.0 112.35 126.90 126.15 136.65 161.6 [4,] 103.60 94.1 113.2 115.45 137.05 130.15 139.80 169.9 [5,] 105.80 97.4 116.2 121.40 142.90 132.90 141.20 169.9 $n [1] 12 12 12 12 12 12 12 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 96.12567 91.16851 95.01813 109.5221 115.9078 122.1591 134.3923 156.1227 [2,] 102.37433 93.63149 110.98187 115.1779 137.8922 130.1409 138.9077 167.0773 $out [1] 151.8 155.4 185.9 $group [1] 7 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(94.3, 96.75, 99.25, 103.6, 105.8, 88.3, 91.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6hqd61197033921.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,] 115.0571 111.650 110.8750 [2,] 117.7705 114.225 114.8438 [3,] 120.1188 116.300 116.9750 [4,] 121.1437 120.025 118.5312 [5,] 121.9125 121.600 121.0500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 118.5802 113.6546 115.2931 [2,] 121.6573 118.9454 118.6569 $out [1] 112.5714 $group [1] 1 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(115.057142857143, 117.770535714286, 120.11875, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/10tuf1197033920.ps tmp/10tuf1197033920.png") > system("convert tmp/2awxx1197033920.ps tmp/2awxx1197033920.png") > system("convert tmp/3b69i1197033920.ps tmp/3b69i1197033920.png") > system("convert tmp/43bfa1197033920.ps tmp/43bfa1197033920.png") > system("convert tmp/5oofa1197033920.ps tmp/5oofa1197033920.png") > system("convert tmp/6hqd61197033921.ps tmp/6hqd61197033921.png") > > > proc.time() user system elapsed 1.331 0.856 1.607