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(94.10,94.90,96.40,91.10,84.40,86.40,88.00,75.10,109.70,103.00,82.10,68.00,96.40,94.30,90.00,88.00,76.10,82.50,81.40,66.50,97.20,94.10,80.70,70.50,87.80,89.50,99.60,84.20,75.10,92.00,80.80,73.10,99.80,90.00,83.10,72.40,78.80,87.30,91.00,80.10,73.60,86.40,74.50,71.20,92.40,81.50,85.30,69.90) > 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] 48 > (np <- floor(n / par1)) [1] 4 > 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] 4 4 4 4 4 4 4 4 4 4 4 4 > arr [,1] [,2] [,3] [,4] [,5] [1,] 94.1 96.4 87.8 78.8 NA [2,] 94.9 94.3 89.5 87.3 NA [3,] 96.4 90.0 99.6 91.0 NA [4,] 91.1 88.0 84.2 80.1 NA [5,] 84.4 76.1 75.1 73.6 NA [6,] 86.4 82.5 92.0 86.4 NA [7,] 88.0 81.4 80.8 74.5 NA [8,] 75.1 66.5 73.1 71.2 NA [9,] 109.7 97.2 99.8 92.4 NA [10,] 103.0 94.1 90.0 81.5 NA [11,] 82.1 80.7 83.1 85.3 NA [12,] 68.0 70.5 72.4 69.9 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/freestat/rcomp/tmp/1aavh1225741126.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/freestat/rcomp/tmp/2mkdf1225741126.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/freestat/rcomp/tmp/3q7u31225741126.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/freestat/rcomp/tmp/4lb161225741126.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,] 78.80 87.3 90.0 80.10 73.60 82.50 74.50 66.50 92.40 81.50 80.7 68.00 [2,] 83.30 88.4 90.5 82.15 74.35 84.45 77.65 68.85 94.80 85.75 81.4 68.95 [3,] 90.95 91.9 93.7 86.10 75.60 86.40 81.10 72.15 98.50 92.05 82.6 70.20 [4,] 95.25 94.6 98.0 89.55 80.25 89.20 84.70 74.10 104.75 98.55 84.2 71.45 [5,] 96.40 94.9 99.6 91.10 84.40 92.00 88.00 75.10 109.70 103.00 85.3 72.40 $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 81.5095 87.002 87.775 80.254 70.939 82.6475 75.5305 68.0025 90.6395 [2,] 100.3905 96.798 99.625 91.946 80.261 90.1525 86.6695 76.2975 106.3605 [,10] [,11] [,12] [1,] 81.938 80.388 68.225 [2,] 102.162 84.812 72.175 $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(78.8, 83.3, 90.95, 95.25, 96.4, 87.3, 88.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/5xkvn1225741126.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] [1,] 68.00 66.50 72.40 69.90 NA [2,] 83.25 78.40 77.95 74.05 NA [3,] 89.55 85.25 86.00 80.80 NA [4,] 95.65 94.20 91.00 86.85 NA [5,] 109.70 97.20 99.80 92.40 NA $n [1] 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [1,] 83.89428 78.04351 80.0478 74.96183 NA [2,] 95.20572 92.45649 91.9522 86.63817 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" NA Warning message: In bxp(list(stats = c(68, 83.25, 89.55, 95.65, 109.7, 66.5, 78.4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/64by81225741126.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,] 70.2000 70.200 70.20000 [2,] 79.2375 78.350 78.79375 [3,] 86.3375 86.250 86.29375 [4,] 91.8250 91.975 91.90000 [5,] 99.7750 98.500 99.13750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 80.59626 80.03555 80.3159 [2,] 92.07874 92.46445 92.2716 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(70.2, 79.2375, 86.3375, 91.825, 99.775, 70.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1aavh1225741126.ps tmp/1aavh1225741126.png") > system("convert tmp/2mkdf1225741126.ps tmp/2mkdf1225741126.png") > system("convert tmp/3q7u31225741126.ps tmp/3q7u31225741126.png") > system("convert tmp/4lb161225741126.ps tmp/4lb161225741126.png") > system("convert tmp/5xkvn1225741126.ps tmp/5xkvn1225741126.png") > system("convert tmp/64by81225741126.ps tmp/64by81225741126.png") > > > proc.time() user system elapsed 1.923 1.267 2.696