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(242621,238545,240337,244752,244576,241572,240541,236089,236997,264579,270349,269645,267037,258113,262813,267413,267366,264777,258863,254844,254868,277267,285351,286602,283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663) > par1 = '36' > #'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] 1 > 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] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 > arr [,1] [,2] [1,] 242621 288186 [2,] 238545 281477 [3,] 240337 282656 [4,] 244752 280190 [5,] 244576 280408 [6,] 241572 276836 [7,] 240541 275216 [8,] 236089 274352 [9,] 236997 271311 [10,] 264579 289802 [11,] 270349 290726 [12,] 269645 292300 [13,] 267037 278506 [14,] 258113 269826 [15,] 262813 265861 [16,] 267413 269034 [17,] 267366 264176 [18,] 264777 255198 [19,] 258863 253353 [20,] 254844 246057 [21,] 254868 235372 [22,] 277267 258556 [23,] 285351 260993 [24,] 286602 254663 [25,] 283042 NA [26,] 276687 NA [27,] 277915 NA [28,] 277128 NA [29,] 277103 NA [30,] 275037 NA [31,] 270150 NA [32,] 267140 NA [33,] 264993 NA [34,] 287259 NA [35,] 291186 NA [36,] 292300 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/1mu0d1193394009.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/2t3na1193394009.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/32mna1193394009.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/4nk6w1193394009.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] [1,] 242621.0 238545 240337.0 244752 244576 241572 240541.0 236089.0 236997 [2,] 242621.0 238545 240337.0 244752 244576 241572 240541.0 236089.0 236997 [3,] 265403.5 260011 261496.5 262471 262492 259204 257878.5 255220.5 254154 [4,] 288186.0 281477 282656.0 280190 280408 276836 275216.0 274352.0 271311 [5,] 288186.0 281477 282656.0 280190 280408 276836 275216.0 274352.0 271311 [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [1,] 264579.0 270349.0 269645.0 267037.0 258113.0 262813 267413.0 264176 [2,] 264579.0 270349.0 269645.0 267037.0 258113.0 262813 267413.0 264176 [3,] 277190.5 280537.5 280972.5 272771.5 263969.5 264337 268223.5 265771 [4,] 289802.0 290726.0 292300.0 278506.0 269826.0 265861 269034.0 267366 [5,] 289802.0 290726.0 292300.0 278506.0 269826.0 265861 269034.0 267366 [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [1,] 255198.0 253353 246057.0 235372 258556.0 260993 254663.0 283042 276687 [2,] 255198.0 253353 246057.0 235372 258556.0 260993 254663.0 283042 276687 [3,] 259987.5 256108 250450.5 245120 267911.5 273172 270632.5 283042 276687 [4,] 264777.0 258863 254844.0 254868 277267.0 285351 286602.0 283042 276687 [5,] 264777.0 258863 254844.0 254868 277267.0 285351 286602.0 283042 276687 [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [1,] 277915 277128 277103 275037 270150 267140 264993 287259 291186 292300 [2,] 277915 277128 277103 275037 270150 267140 264993 287259 291186 292300 [3,] 277915 277128 277103 275037 270150 267140 264993 287259 291186 292300 [4,] 277915 277128 277103 275037 270150 267140 264993 287259 291186 292300 [5,] 277915 277128 277103 275037 270150 267140 264993 287259 291186 292300 $n [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 214497.0 212046.1 214216.5 222878.6 222459.5 219806.0 219138.6 212472.0 [2,] 316310.0 307975.9 308776.5 302063.4 302524.5 298602.0 296618.4 297969.0 [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] 215817.4 249010.6 257771.7 255661.7 259958 250883.4 260931.7 266412.5 [2,] 292490.6 305370.4 303303.3 306283.3 285585 277055.6 267742.3 270034.5 [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [1,] 262207.0 249285.6 249952.1 240633.4 223338.5 247007.0 245958.5 234949.3 [2,] 269335.0 270689.4 262263.9 260267.6 266901.5 288816.0 300385.5 306315.7 [,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [1,] 283042 276687 277915 277128 277103 275037 270150 267140 264993 287259 [2,] 283042 276687 277915 277128 277103 275037 270150 267140 264993 287259 [,35] [,36] [1,] 291186 292300 [2,] 291186 292300 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" [31] "31" "32" "33" "34" "35" "36" Warning message: In bxp(list(stats = c(242621, 242621, 265403.5, 288186, 288186, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5s75g1193394009.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] [1,] 236089.0 235372.0 [2,] 249798.0 259774.5 [3,] 267088.5 272831.5 [4,] 277115.5 280942.5 [5,] 292300.0 292300.0 $n [1] 36 24 $conf [,1] [,2] [1,] 259894.9 266004.5 [2,] 274282.1 279658.5 $out numeric(0) $group numeric(0) $names [1] "1" NA > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/630oy1193394009.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,] 245120.0 245120.0 245120.0 [2,] 260753.8 260753.8 260753.8 [3,] 267525.8 267525.8 267525.8 [4,] 277115.5 277115.5 277115.5 [5,] 292300.0 292300.0 292300.0 $n [1] 36 36 36 $conf [,1] [,2] [,3] [1,] 263217.2 263217.2 263217.2 [2,] 271834.3 271834.3 271834.3 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > system("convert tmp/1mu0d1193394009.ps tmp/1mu0d1193394009.png") > system("convert tmp/2t3na1193394009.ps tmp/2t3na1193394009.png") > system("convert tmp/32mna1193394009.ps tmp/32mna1193394009.png") > system("convert tmp/4nk6w1193394009.ps tmp/4nk6w1193394009.png") > system("convert tmp/5s75g1193394009.ps tmp/5s75g1193394009.png") > system("convert tmp/630oy1193394009.ps tmp/630oy1193394009.png") > > > proc.time() user system elapsed 2.592 1.425 2.806