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(106.7,110.2,125.9,100.1,106.4,114.8,81.3,87,104.2,108,105,94.5,92,95.9,108.8,103.4,102.1,110.1,83.2,82.7,106.8,113.7,102.5,96.6,92.1,95.6,102.3,98.6,98.2,104.5,84,73.8,103.9,106,97.2,102.6,89,93.8,116.7,106.8,98.5,118.7,90,91.9,113.3,113.1,104.1,108.7,96.7,101,116.9,105.8,99,129.4,83,88.9,115.9,104.2,113.4,112.2,100.8,107.3,126.6,102.9,117.9,128.8,87.5,93.8,122.7,126.2,124.6,116.7,115.2,111.1,129.9,113.3,118.5,133.5,102.1,102.4) > 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] 80 > (np <- floor(n / par1)) [1] 6 > 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] 7 7 7 7 7 7 7 7 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 106.7 92.0 92.1 89.0 96.7 100.8 115.2 [2,] 110.2 95.9 95.6 93.8 101.0 107.3 111.1 [3,] 125.9 108.8 102.3 116.7 116.9 126.6 129.9 [4,] 100.1 103.4 98.6 106.8 105.8 102.9 113.3 [5,] 106.4 102.1 98.2 98.5 99.0 117.9 118.5 [6,] 114.8 110.1 104.5 118.7 129.4 128.8 133.5 [7,] 81.3 83.2 84.0 90.0 83.0 87.5 102.1 [8,] 87.0 82.7 73.8 91.9 88.9 93.8 102.4 [9,] 104.2 106.8 103.9 113.3 115.9 122.7 NA [10,] 108.0 113.7 106.0 113.1 104.2 126.2 NA [11,] 105.0 102.5 97.2 104.1 113.4 124.6 NA [12,] 94.5 96.6 102.6 108.7 112.2 116.7 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/1y1t11196414672.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/2p6561196414672.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/3jbo31196414672.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/46gzt1196414672.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] [1,] 89.00 93.80 102.30 98.6 98.20 104.50 81.30 73.80 103.90 104.20 97.20 [2,] 92.05 95.75 112.75 101.5 98.75 112.45 83.10 84.85 104.20 106.00 102.50 [3,] 96.70 101.00 116.90 103.4 102.10 118.70 84.00 88.90 110.05 110.55 104.55 [4,] 103.75 108.75 126.25 106.3 112.15 129.10 88.75 92.85 115.90 113.70 113.40 [5,] 115.20 111.10 129.90 113.3 118.50 133.50 90.00 102.40 122.70 113.70 124.60 [,12] [1,] 94.50 [2,] 96.60 [3,] 105.65 [4,] 112.20 [5,] 116.70 $n [1] 7 7 7 7 7 7 7 7 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 89.71295 93.23661 108.8380 100.5335 94.09774 108.7569 80.62591 84.12253 [2,] 103.68705 108.76339 124.9620 106.2665 110.10226 128.6431 87.37409 93.67747 [,9] [,10] [,11] [,12] [1,] 102.5031 105.5833 97.51915 95.5875 [2,] 117.5969 115.5167 111.58085 115.7125 $out [1] 102.1 126.2 $group [1] 7 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(89, 92.05, 96.7, 103.75, 115.2, 93.8, 95.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/561nc1196414672.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] [,7] [1,] 81.3 82.70 84.00 89.00 83.00 87.50 102.10 [2,] 97.3 93.95 93.85 92.85 97.85 101.85 106.75 [3,] 105.7 102.30 98.40 105.45 105.00 117.30 114.25 [4,] 109.1 107.80 103.25 113.20 114.65 125.40 124.20 [5,] 125.9 113.70 106.00 118.70 129.40 128.80 133.50 $n [1] 12 12 12 12 12 12 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 100.3179 95.98292 94.1126 96.16823 97.3374 106.5587 104.5022 [2,] 111.0821 108.61708 102.6874 114.73177 112.6626 128.0413 123.9978 $out [1] 73.8 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(81.3, 97.3, 105.7, 109.1, 125.9, 82.7, 93.95, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6zqa11196414672.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,] 87.3000 84.000 85.9250 [2,] 100.5286 98.850 100.0750 [3,] 105.5083 103.975 105.0813 [4,] 111.5000 110.300 110.0375 [5,] 119.9714 118.700 120.7750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 100.5042 98.75258 100.5373 [2,] 110.5125 109.19742 109.6252 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(87.3, 100.528571428571, 105.508333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1y1t11196414672.ps tmp/1y1t11196414672.png") > system("convert tmp/2p6561196414672.ps tmp/2p6561196414672.png") > system("convert tmp/3jbo31196414672.ps tmp/3jbo31196414672.png") > system("convert tmp/46gzt1196414672.ps tmp/46gzt1196414672.png") > system("convert tmp/561nc1196414672.ps tmp/561nc1196414672.png") > system("convert tmp/6zqa11196414672.ps tmp/6zqa11196414672.png") > > > proc.time() user system elapsed 2.406 1.361 2.614