R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(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,190.8,195.8,211.9,227.1,251.3,256.7,251.9,251.2,270.3,267.2,243,229.9,187.2,178.2,175.2,192.4,187,184,194.1,212.7,217.5,200.5,205.9,196.5,206.3) > 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] 61 > (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] 6 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 108.5 122.0 141.2 190.8 187.2 206.3 [2,] 112.3 122.1 151.8 195.8 178.2 NA [3,] 116.6 127.4 155.4 211.9 175.2 NA [4,] 115.5 135.2 156.6 227.1 192.4 NA [5,] 120.1 137.3 161.6 251.3 187.0 NA [6,] 132.9 135.0 160.7 256.7 184.0 NA [7,] 128.1 136.0 156.0 251.9 194.1 NA [8,] 129.3 138.4 159.5 251.2 212.7 NA [9,] 132.5 134.7 168.7 270.3 217.5 NA [10,] 131.0 138.4 169.9 267.2 200.5 NA [11,] 124.9 133.9 169.9 243.0 205.9 NA [12,] 120.8 133.6 185.9 229.9 196.5 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/145wo1260462303.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/2395f1260462303.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/3k6oo1260462303.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/4s3mr1260462303.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,] 108.5 112.3 116.6 115.5 120.1 132.9 128.1 129.3 132.5 131.0 124.9 120.8 [2,] 122.0 122.1 127.4 135.2 137.3 135.0 136.0 138.4 134.7 138.4 133.9 133.6 [3,] 164.2 151.8 155.4 156.6 161.6 160.7 156.0 159.5 168.7 169.9 169.9 185.9 [4,] 190.8 178.2 175.2 192.4 187.0 184.0 194.1 212.7 217.5 200.5 205.9 196.5 [5,] 206.3 195.8 211.9 227.1 251.3 256.7 251.9 251.2 270.3 267.2 243.0 229.9 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 119.8218 112.1599 121.6246 116.1826 126.4821 126.0767 114.9467 106.9998 [2,] 208.5782 191.4401 189.1754 197.0174 196.7179 195.3233 197.0533 212.0002 [,9] [,10] [,11] [,12] [1,] 110.1937 126.0203 119.0250 141.4550 [2,] 227.2063 213.7797 220.7750 230.3450 $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(108.5, 122, 164.2, 190.8, 206.3, 112.3, 122.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/523n41260462303.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,] 108.50 122.00 141.2 190.8 175.20 206.3 [2,] 116.05 130.50 155.7 219.5 185.50 206.3 [3,] 122.85 134.85 160.1 247.1 193.25 206.3 [4,] 130.15 136.65 169.3 254.3 203.20 206.3 [5,] 132.90 138.40 185.9 270.3 217.50 206.3 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 116.4189 132.0449 153.8969 231.2275 185.1769 206.3 [2,] 129.2811 137.6551 166.3031 262.9725 201.3231 206.3 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(108.5, 116.05, 122.85, 130.15, 132.9, 122, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6r0yn1260462303.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,] 152.0400 151.80 150.150 [2,] 162.3467 156.30 158.925 [3,] 173.2800 161.15 164.425 [4,] 176.8700 169.30 169.675 [5,] 184.7400 185.90 176.100 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 166.6558 155.2206 159.5219 [2,] 179.9042 167.0794 169.3281 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(152.04, 162.346666666667, 173.28, 176.87, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/145wo1260462303.ps tmp/145wo1260462303.png") > system("convert tmp/2395f1260462303.ps tmp/2395f1260462303.png") > system("convert tmp/3k6oo1260462303.ps tmp/3k6oo1260462303.png") > system("convert tmp/4s3mr1260462303.ps tmp/4s3mr1260462303.png") > system("convert tmp/523n41260462303.ps tmp/523n41260462303.png") > system("convert tmp/6r0yn1260462303.ps tmp/6r0yn1260462303.png") > > > proc.time() user system elapsed 1.081 0.839 1.360