R version 2.5.1 (2007-06-27) 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(106.22,106.31,107.38,109.31,110.82,111.22,110.66,110.76,110.69,111.08,110.97,110.24,112.51,111.52,112.13,112.23,112.92,111.89,111.99,111.51,112.33,112.04,112.09,111.41,112.61,113.14,113.65,114.26,114.4,114.93,114.86,114.95,116.17,114.6,114.62,113.82,115.02,115.18,115.59,116.6,117.07,116.96,116.66,116.07,116.04,115.81,116.22,115.85,116.43,117.39,119.17,119.24,120.03,119.34,118.49,118.59,117.5,117.56,118.25,118.01) > 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,] 106.22 112.51 112.61 115.02 116.43 NA [2,] 106.31 111.52 113.14 115.18 117.39 NA [3,] 107.38 112.13 113.65 115.59 119.17 NA [4,] 109.31 112.23 114.26 116.60 119.24 NA [5,] 110.82 112.92 114.40 117.07 120.03 NA [6,] 111.22 111.89 114.93 116.96 119.34 NA [7,] 110.66 111.99 114.86 116.66 118.49 NA [8,] 110.76 111.51 114.95 116.07 118.59 NA [9,] 110.69 112.33 116.17 116.04 117.50 NA [10,] 111.08 112.04 114.60 115.81 117.56 NA [11,] 110.97 112.09 114.62 116.22 118.25 NA [12,] 110.24 111.41 113.82 115.85 118.01 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/1c3mo1193570566.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/27paa1193570566.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/3i6521193570566.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/4t8o81193570566.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,] 112.51 106.31 107.38 109.31 110.82 111.22 110.66 110.76 110.69 111.08 [2,] 112.51 111.52 112.13 112.23 112.92 111.89 111.99 111.51 112.33 112.04 [3,] 112.61 113.14 113.65 114.26 114.40 114.93 114.86 114.95 116.04 114.60 [4,] 115.02 115.18 115.59 116.60 117.07 116.96 116.66 116.07 116.17 115.81 [5,] 116.43 117.39 119.17 119.24 120.03 119.34 118.49 118.59 117.50 117.56 [,11] [,12] [1,] 110.97 110.24 [2,] 112.09 111.41 [3,] 114.62 113.82 [4,] 116.22 115.85 [5,] 118.25 118.01 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 110.8364 110.5539 111.2052 111.1722 111.4676 111.3476 111.5602 111.7279 [2,] 114.3836 115.7261 116.0948 117.3478 117.3324 118.5124 118.1598 118.1721 [,9] [,10] [,11] [,12] [1,] 113.3267 111.9361 111.7018 110.6827 [2,] 118.7533 117.2639 117.5382 116.9573 $out [1] 106.22 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(112.51, 112.51, 112.61, 115.02, 116.43, 106.31, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5xebt1193570566.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,] 106.220 111.410 112.610 115.020 116.430 NA [2,] 108.345 111.705 113.735 115.700 117.530 NA [3,] 110.675 112.065 114.500 116.055 118.370 NA [4,] 110.895 112.280 114.895 116.630 119.205 NA [5,] 111.220 112.920 116.170 117.070 120.030 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 109.5119 111.8027 113.9709 115.6308 117.6060 NA [2,] 111.8381 112.3273 115.0291 116.4792 119.1340 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(106.22, 108.345, 110.675, 110.895, 111.22, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6610i1193570567.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,] 112.558 112.610 113.3500 [2,] 113.725 113.735 113.7775 [3,] 114.352 114.500 114.0400 [4,] 114.539 114.895 114.3700 [5,] 115.048 116.040 114.9950 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 113.9807 113.9709 113.7698 [2,] 114.7233 115.0291 114.3102 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: some notches went outside hinges ('box'): maybe set notch=FALSE in: bxp(list(stats = c(112.558, 113.725, 114.352, 114.539, 115.048, > dev.off() null device 1 > > system("convert tmp/1c3mo1193570566.ps tmp/1c3mo1193570566.png") > system("convert tmp/27paa1193570566.ps tmp/27paa1193570566.png") > system("convert tmp/3i6521193570566.ps tmp/3i6521193570566.png") > system("convert tmp/4t8o81193570566.ps tmp/4t8o81193570566.png") > system("convert tmp/5xebt1193570566.ps tmp/5xebt1193570566.png") > system("convert tmp/6610i1193570567.ps tmp/6610i1193570567.png") > > > proc.time() user system elapsed 1.423 0.868 1.646