R version 2.7.2 (2008-08-25) 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(104.2,103.2,112.7,106.4,102.6,110.6,95.2,89.0,112.5,116.8,107.2,113.6,101.8,102.6,122.7,110.3,110.5,121.6,100.3,100.7,123.4,127.1,124.1,131.2,111.6,114.2,130.1,125.9,119.0,133.8,107.5,113.5,134.4,126.8,135.6,139.9,129.8,131.0,153.1,134.1,144.1,155.9,123.3,128.1,144.3,153.0,149.9,150.9,141.0,138.9,157.4,142.9,151.7,161.0,138.5,135.9,151.5,164.0,159.1,157.0,142.1,144.8,152.1,154.6,148.7,157.7,146.7) > 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] 67 > (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 6 6 6 6 6 6 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 104.2 101.8 111.6 129.8 141.0 142.1 [2,] 103.2 102.6 114.2 131.0 138.9 144.8 [3,] 112.7 122.7 130.1 153.1 157.4 152.1 [4,] 106.4 110.3 125.9 134.1 142.9 154.6 [5,] 102.6 110.5 119.0 144.1 151.7 148.7 [6,] 110.6 121.6 133.8 155.9 161.0 157.7 [7,] 95.2 100.3 107.5 123.3 138.5 146.7 [8,] 89.0 100.7 113.5 128.1 135.9 NA [9,] 112.5 123.4 134.4 144.3 151.5 NA [10,] 116.8 127.1 126.8 153.0 164.0 NA [11,] 107.2 124.1 135.6 149.9 159.1 NA [12,] 113.6 131.2 139.9 150.9 157.0 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/1wozw1225634755.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/2sjxj1225634755.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/3yesa1225634755.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/4b10m1225634755.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,] 101.8 102.6 112.7 106.4 102.60 110.60 95.2 89.0 112.5 116.8 107.2 113.6 [2,] 104.2 103.2 122.7 110.3 110.50 121.60 100.3 100.7 123.4 126.8 124.1 131.2 [3,] 120.7 122.6 141.1 130.0 131.55 144.85 115.4 113.5 134.4 127.1 135.6 139.9 [4,] 141.0 138.9 153.1 142.9 148.70 157.70 138.5 128.1 144.3 153.0 149.9 150.9 [5,] 142.1 144.8 157.4 154.6 151.70 161.00 146.7 135.9 151.5 164.0 159.1 157.0 $n [1] 6 6 6 6 6 6 6 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.96281 99.57235 121.4910 108.9719 106.9098 121.5643 90.75977 [2,] 144.43719 145.62765 160.7090 151.0281 156.1902 168.1357 140.04023 [,8] [,9] [,10] [,11] [,12] [1,] 94.13923 119.6321 108.5871 117.3698 125.9800 [2,] 132.86077 149.1679 145.6129 153.8302 153.8200 $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(101.8, 104.2, 120.7, 141, 142.1, 102.6, 103.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/542xp1225634755.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,] 89.0 100.30 107.50 123.30 135.90 142.10 [2,] 102.9 102.20 113.85 130.40 139.95 145.75 [3,] 106.8 116.05 126.35 144.20 151.60 148.70 [4,] 112.6 123.75 134.10 151.95 158.25 153.35 [5,] 116.8 131.20 139.90 155.90 164.00 157.70 $n [1] 12 12 12 12 12 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 102.3758 106.2209 117.1138 134.3709 143.2532 144.1614 [2,] 111.2242 125.8791 135.5862 154.0291 159.9468 153.2386 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(89, 102.9, 106.8, 112.6, 116.8, 100.3, 102.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6g8hh1225634755.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,] 113.4400 113.500 114.4000 [2,] 122.1000 121.650 121.7812 [3,] 131.3267 130.775 131.9688 [4,] 137.7783 137.750 139.3000 [5,] 140.1000 144.850 141.0500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 124.1757 123.4317 123.9783 [2,] 138.4777 138.1183 139.9592 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(113.44, 122.1, 131.326666666667, 137.778333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1wozw1225634755.ps tmp/1wozw1225634755.png") > system("convert tmp/2sjxj1225634755.ps tmp/2sjxj1225634755.png") > system("convert tmp/3yesa1225634755.ps tmp/3yesa1225634755.png") > system("convert tmp/4b10m1225634755.ps tmp/4b10m1225634755.png") > system("convert tmp/542xp1225634755.ps tmp/542xp1225634755.png") > system("convert tmp/6g8hh1225634755.ps tmp/6g8hh1225634755.png") > > > proc.time() user system elapsed 1.286 0.839 1.656