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.48,106.83,107.14,107.94,108.46,108.81,108.92,108.99,109.16,109.22,109.43,109.23,109.93,110.09,110.33,110.11,110.35,110.09,110.44,110.39,110.62,110.43,110.46,110.55,110.94,111.56,111.82,111.73,111.57,111.85,112.06,112.2,112.47,112.15,112.36,112.32,112.67,113.02,113.05,113.5,113.67,113.65,114,114.03,114.08,114.49,114.48,114.25,114.68,115.28,115.9,115.87,116.09,116.29,116.76,116.78,116.65,116.46,116.82,116.91) > 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.48 109.93 110.94 112.67 114.68 NA [2,] 106.83 110.09 111.56 113.02 115.28 NA [3,] 107.14 110.33 111.82 113.05 115.90 NA [4,] 107.94 110.11 111.73 113.50 115.87 NA [5,] 108.46 110.35 111.57 113.67 116.09 NA [6,] 108.81 110.09 111.85 113.65 116.29 NA [7,] 108.92 110.44 112.06 114.00 116.76 NA [8,] 108.99 110.39 112.20 114.03 116.78 NA [9,] 109.16 110.62 112.47 114.08 116.65 NA [10,] 109.22 110.43 112.15 114.49 116.46 NA [11,] 109.43 110.46 112.36 114.48 116.82 NA [12,] 109.23 110.55 112.32 114.25 116.91 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/1vt8h1193582787.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/2kqol1193582787.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/35lqx1193582787.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/4op9v1193582787.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,] 106.48 106.83 107.14 107.94 108.46 108.81 108.92 108.99 109.16 109.22 [2,] 109.93 110.09 110.33 110.11 110.35 110.09 110.44 110.39 110.62 110.43 [3,] 110.94 111.56 111.82 111.73 111.57 111.85 112.06 112.20 112.47 112.15 [4,] 112.67 113.02 113.05 113.50 113.67 113.65 114.00 114.03 114.08 114.49 [5,] 114.68 115.28 115.90 115.87 116.09 116.29 116.76 116.78 116.65 116.46 [,11] [,12] [1,] 109.43 109.23 [2,] 110.46 110.55 [3,] 112.36 112.32 [4,] 114.48 114.25 [5,] 116.82 116.91 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 109.0039 109.4897 109.8981 109.3346 109.2241 109.3345 109.5445 109.6280 [2,] 112.8761 113.6303 113.7419 114.1254 113.9159 114.3655 114.5755 114.7720 [,9] [,10] [,11] [,12] [1,] 110.0252 109.2812 109.5195 109.7056 [2,] 114.9148 115.0188 115.2005 114.9344 $out numeric(0) $group numeric(0) $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(106.48, 109.93, 110.94, 112.67, 114.68, 106.83, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5h50u1193582787.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.480 109.93 110.940 112.670 114.680 NA [2,] 107.540 110.10 111.650 113.275 115.885 NA [3,] 108.865 110.37 111.955 113.835 116.375 NA [4,] 109.190 110.45 112.260 114.165 116.770 NA [5,] 109.430 110.62 112.470 114.490 116.910 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 108.1124 110.2104 111.6768 113.4291 115.9713 NA [2,] 109.6176 110.5296 112.2332 114.2409 116.7787 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.48, 107.54, 108.865, 109.19, 109.43, 109.93, > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6go0e1193582787.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,] 110.940 110.940 111.3000 [2,] 111.739 111.650 111.7475 [3,] 112.287 111.955 112.1100 [4,] 112.573 112.260 112.3750 [5,] 112.710 112.470 112.4700 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 111.9066 111.6768 111.8238 [2,] 112.6674 112.2332 112.3962 $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(110.94, 111.739, 112.287, 112.573, 112.71, > dev.off() null device 1 > > system("convert tmp/1vt8h1193582787.ps tmp/1vt8h1193582787.png") > system("convert tmp/2kqol1193582787.ps tmp/2kqol1193582787.png") > system("convert tmp/35lqx1193582787.ps tmp/35lqx1193582787.png") > system("convert tmp/4op9v1193582787.ps tmp/4op9v1193582787.png") > system("convert tmp/5h50u1193582787.ps tmp/5h50u1193582787.png") > system("convert tmp/6go0e1193582787.ps tmp/6go0e1193582787.png") > > > proc.time() user system elapsed 1.369 0.823 1.608