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. 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(99,115.4,106.9,107.1,99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,110,96.1,100.6) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2006), Standard Deviation Plot (v1.0.0) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_sdplot.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,] 99.0 110.7 116.2 107.9 111.4 NA [2,] 115.4 113.1 112.0 101.8 113.0 NA [3,] 106.9 99.6 106.4 104.4 107.5 NA [4,] 107.1 93.6 95.7 93.4 95.9 NA [5,] 99.3 98.6 96.0 100.1 106.3 NA [6,] 99.2 99.6 95.8 98.5 105.2 NA [7,] 108.3 114.3 103.0 112.9 117.2 NA [8,] 105.6 107.8 102.2 101.4 106.9 NA [9,] 99.5 101.2 98.4 107.1 108.2 NA [10,] 107.4 112.5 111.4 110.8 110.0 NA [11,] 93.1 100.5 86.6 90.3 96.1 NA [12,] 88.1 93.9 91.3 95.5 100.6 NA > arr.sd <- array(NA,dim=par1) > arr.range <- array(NA,dim=par1) > arr.iqr <- array(NA,dim=par1) > for (j in 1:par1) + { + arr.sd[j] <- sqrt(var(arr[j,],na.rm=TRUE)) + arr.range[j] <- max(arr[j,],na.rm=TRUE) - min(arr[j,],na.rm=TRUE) + arr.iqr[j] <- quantile(arr[j,],0.75,na.rm=TRUE) - quantile(arr[j,],0.25,na.rm=TRUE) + } > overall.sd <- sqrt(var(x)) > overall.range <- max(x) - min(x) > overall.iqr <- quantile(x,0.75) - quantile(x,0.25) > postscript(file="/var/www/html/rcomp/tmp/1396p1197195391.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.sd,type='b',ylab='S.D.',main='Standard Deviation Plot',xlab='Periodic Index') > mtext(paste('# blocks = ',np)) > abline(overall.sd,0) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2fu0y1197195391.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.range,type='b',ylab='range',main='Range Plot',xlab='Periodic Index') > mtext(paste('# blocks = ',np)) > abline(overall.range,0) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3se4r1197195391.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.iqr,type='b',ylab='IQR',main='Interquartile Range Plot',xlab='Periodic Index') > mtext(paste('# blocks = ',np)) > abline(overall.iqr,0) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4mpal1197195391.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,] 107.9 112.0 104.4 93.4 98.6 98.5 103.0 101.4 98.4 110.0 86.6 88.1 [2,] 107.9 112.0 104.4 93.6 98.6 98.5 108.3 102.2 99.5 110.0 90.3 91.3 [3,] 110.7 113.0 106.4 95.7 99.3 99.2 112.9 105.6 101.2 110.8 93.1 93.9 [4,] 111.4 113.1 106.9 95.9 100.1 99.6 114.3 106.9 107.1 111.4 96.1 95.5 [5,] 116.2 113.1 107.5 95.9 100.1 99.6 117.2 107.8 108.2 112.5 100.5 100.6 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 108.2269 112.2227 104.6335 94.07483 98.2401 98.42274 108.6604 102.279 [2,] 113.1731 113.7773 108.1665 97.32517 100.3599 99.97726 117.1396 108.921 [,9] [,10] [,11] [,12] [1,] 95.82986 109.8108 89.00173 90.93229 [2,] 106.57014 111.7892 97.19827 96.86771 $out [1] 99.0 115.4 101.8 99.6 107.1 96.0 106.3 95.8 105.2 107.4 $group [1] 1 2 2 3 4 5 5 6 6 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(107.9, 107.9, 110.7, 111.4, 116.2, 112, 112, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5bhyi1197195391.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,] 88.10 93.60 86.60 90.3 95.9 NA [2,] 99.10 99.10 95.75 97.0 102.9 NA [3,] 102.55 100.85 100.30 101.6 107.2 NA [4,] 107.25 111.60 108.90 107.5 110.7 NA [5,] 115.40 114.30 116.20 112.9 117.2 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 98.83273 95.14867 94.3022 96.81088 103.6424 NA [2,] 106.26727 106.55133 106.2978 106.38912 110.7576 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(88.1, 99.1, 102.55, 107.25, 115.4, 93.6, 99.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6ysg21197195391.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(cbind(arr.sd,arr.range,arr.iqr)) > names(z) <- list('S.D.','Range','IQR') > (boxplot(z,notch=TRUE,col='grey',ylab='Overall Variability',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 1.918854 5.10 1.10 [2,] 3.323932 8.65 1.45 [3,] 4.585223 11.40 3.00 [4,] 5.450040 13.80 5.25 [5,] 6.357908 17.20 7.60 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.615491 9.05105 1.266794 [2,] 5.554955 13.74895 4.733206 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.91885382455256, 3.32393205065091, 4.58522307817966, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1396p1197195391.ps tmp/1396p1197195391.png") > system("convert tmp/2fu0y1197195391.ps tmp/2fu0y1197195391.png") > system("convert tmp/3se4r1197195391.ps tmp/3se4r1197195391.png") > system("convert tmp/4mpal1197195391.ps tmp/4mpal1197195391.png") > system("convert tmp/5bhyi1197195391.ps tmp/5bhyi1197195391.png") > system("convert tmp/6ysg21197195391.ps tmp/6ysg21197195391.png") > > > proc.time() user system elapsed 1.353 0.857 1.929