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. Natural language support but running in an English locale 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(99,115.4,106.9,107.1,99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,110,96.1,100.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,] 99.0 110.7 116.2 107.9 111.4 NA [2,] 115.4 113.1 112.0 101.8 113.0 NA [3,] 106.9 99.6 106.4 104.4 107.5 NA [4,] 107.1 93.6 95.7 93.4 95.9 NA [5,] 99.3 98.6 96.0 100.1 106.3 NA [6,] 99.2 99.6 95.8 98.5 105.2 NA [7,] 108.3 114.3 103.0 112.9 117.2 NA [8,] 105.6 107.8 102.2 101.4 106.9 NA [9,] 99.5 101.2 98.4 107.1 108.2 NA [10,] 107.4 112.5 111.4 110.8 110.0 NA [11,] 93.1 100.5 86.6 90.3 96.1 NA [12,] 88.1 93.9 91.3 95.5 100.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/1rn781193403327.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/28kni1193403327.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/3jmvy1193403327.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/4729l1193403327.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,] 107.9 112.0 104.4 93.4 98.6 98.5 103.0 101.4 98.4 110.0 86.6 88.1 [2,] 107.9 112.0 104.4 93.6 98.6 98.5 108.3 102.2 99.5 110.0 90.3 91.3 [3,] 110.7 113.0 106.4 95.7 99.3 99.2 112.9 105.6 101.2 110.8 93.1 93.9 [4,] 111.4 113.1 106.9 95.9 100.1 99.6 114.3 106.9 107.1 111.4 96.1 95.5 [5,] 116.2 113.1 107.5 95.9 100.1 99.6 117.2 107.8 108.2 112.5 100.5 100.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,] 108.2269 112.2227 104.6335 94.07483 98.2401 98.42274 108.6604 102.279 [2,] 113.1731 113.7773 108.1665 97.32517 100.3599 99.97726 117.1396 108.921 [,9] [,10] [,11] [,12] [1,] 95.82986 109.8108 89.00173 90.93229 [2,] 106.57014 111.7892 97.19827 96.86771 $out [1] 99.0 115.4 101.8 99.6 107.1 96.0 106.3 95.8 105.2 107.4 $group [1] 1 2 2 3 4 5 5 6 6 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(107.9, 107.9, 110.7, 111.4, 116.2, 112, 112, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5azx41193403327.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,] 88.10 93.60 86.60 90.3 95.9 NA [2,] 99.10 99.10 95.75 97.0 102.9 NA [3,] 102.55 100.85 100.30 101.6 107.2 NA [4,] 107.25 111.60 108.90 107.5 110.7 NA [5,] 115.40 114.30 116.20 112.9 117.2 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 98.83273 95.14867 94.3022 96.81088 103.6424 NA [2,] 106.26727 106.55133 106.2978 106.38912 110.7576 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(88.1, 99.1, 102.55, 107.25, 115.4, 93.6, 99.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6z1pc1193403327.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,] 93.32 93.10 93.200 [2,] 98.40 97.45 96.900 [3,] 103.83 103.40 103.925 [4,] 109.73 110.75 110.175 [5,] 111.14 113.00 112.550 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 98.66231 97.33378 97.87018 [2,] 108.99769 109.46622 109.97982 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(93.32, 98.4, 103.83, 109.73, 111.14, 93.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1rn781193403327.ps tmp/1rn781193403327.png") > system("convert tmp/28kni1193403327.ps tmp/28kni1193403327.png") > system("convert tmp/3jmvy1193403327.ps tmp/3jmvy1193403327.png") > system("convert tmp/4729l1193403327.ps tmp/4729l1193403327.png") > system("convert tmp/5azx41193403327.ps tmp/5azx41193403327.png") > system("convert tmp/6z1pc1193403327.ps tmp/6z1pc1193403327.png") > > > proc.time() user system elapsed 2.372 1.337 2.601