R version 2.8.0 (2008-10-20) 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(147768,137507,136919,136151,133001,125554,119647,114158,116193,152803,161761,160942,149470,139208,134588,130322,126611,122401,117352,112135,112879,148729,157230,157221,146681,136524,132111,125326,122716,116615,113719,110737,112093,143565,149946,149147,134339,122683,115614,116566,111272,104609,101802,94542,93051,124129,130374,123946,114971,105531,104919,104782,101281,94545,93248,84031,87486,115867,120327,117008,108811) > 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] 61 > (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 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 147768 149470 146681 134339 114971 108811 [2,] 137507 139208 136524 122683 105531 NA [3,] 136919 134588 132111 115614 104919 NA [4,] 136151 130322 125326 116566 104782 NA [5,] 133001 126611 122716 111272 101281 NA [6,] 125554 122401 116615 104609 94545 NA [7,] 119647 117352 113719 101802 93248 NA [8,] 114158 112135 110737 94542 84031 NA [9,] 116193 112879 112093 93051 87486 NA [10,] 152803 148729 143565 124129 115867 NA [11,] 161761 157230 149946 130374 120327 NA [12,] 160942 157221 149147 123946 117008 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/153v31229623981.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/27rzo1229623981.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/3lmpv1229623981.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/4kgbs1229623981.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,] 108811 105531 104919 104782 101281 94545 93248 84031 87486 115867 [2,] 114971 122683 115614 116566 111272 104609 101802 94542 93051 124129 [3,] 140510 136524 132111 125326 122716 116615 113719 110737 112093 143565 [4,] 147768 137507 134588 130322 126611 122401 117352 112135 112879 148729 [5,] 149470 139208 136919 136151 133001 125554 119647 114158 116193 152803 [,11] [,12] [1,] 120327 117008 [2,] 130374 123946 [3,] 149946 149147 [4,] 157230 157221 [5,] 161761 160942 $n [1] 6 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 119354.9 126049.4 118704.0 115606.0 111877.5 104043.2 102731.4 98305.83 [2,] 161665.1 146998.6 145518.0 135046.0 133554.5 129186.8 124706.6 123168.17 [,9] [,10] [,11] [,12] [1,] 98082.59 126182.7 130969.6 125635.0 [2,] 126103.41 160947.3 168922.4 172659.0 $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(108811, 114971, 140510, 147768, 149470, 105531, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/56gjv1229623981.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,] 114158.0 112135.0 110737.0 93051.0 84031.0 108811 [2,] 122600.5 119876.5 115167.0 103205.5 93896.5 108811 [3,] 136535.0 132455.0 128718.5 116090.0 104850.5 108811 [4,] 150285.5 149099.5 145123.0 124037.5 115419.0 108811 [5,] 161761.0 157230.0 149946.0 134339.0 120327.0 108811 $n [1] 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 123907.7 119126.2 115055.4 106588.4 95033.94 108811 [2,] 149162.3 145783.8 142381.6 125591.6 114667.06 108811 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(114158, 122600.5, 136535, 150285.5, 161761, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6m8su1229623981.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,] 103120.6 110737.0 102965.0 [2,] 110949.2 115167.0 111541.0 [3,] 123729.8 128718.5 124272.5 [4,] 135346.0 142037.5 135041.8 [5,] 143927.6 149946.0 143802.0 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 112602.3 116462.7 113553.6 [2,] 134857.3 140974.3 134991.4 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" > dev.off() null device 1 > system("convert tmp/153v31229623981.ps tmp/153v31229623981.png") > system("convert tmp/27rzo1229623981.ps tmp/27rzo1229623981.png") > system("convert tmp/3lmpv1229623981.ps tmp/3lmpv1229623981.png") > system("convert tmp/4kgbs1229623981.ps tmp/4kgbs1229623981.png") > system("convert tmp/56gjv1229623981.ps tmp/56gjv1229623981.png") > system("convert tmp/6m8su1229623981.ps tmp/6m8su1229623981.png") > > > proc.time() user system elapsed 1.088 0.843 2.108