R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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(20,25,15,15,25,25,254,200,165,123,162,145,145,161,155,173,160,47,232,143,161,159,243,192,157,143,221,227,132,41,273,182,188,162,140,186,178,236,202,184,119,16,340,151,240,235,174,309,174,207,209,171,117,10,339,139,186,155,153,222,102,107,188,162,185,24,394,209,248,254,202,258,215,309,240,258,276,48,455,345,311,346,310,297,300,274,292,304,186,14,321,206,160,217,204,246,234,175,364,328,158,40,556,193,221,278,230,253,240,252,228,306,206,48,557,279,399,364,306,471,293,333,316,329,265,61,679,428,394,352,387,590,177,199,203,255,261,115) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Standard Deviation Plot (v1.0.2) 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 > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 138 > (np <- floor(n / par1)) [1] 11 > 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] 12 12 12 12 12 12 11 11 11 11 11 11 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 20 145 157 178 174 102 215 300 234 240 293 177 [2,] 25 161 143 236 207 107 309 274 175 252 333 199 [3,] 15 155 221 202 209 188 240 292 364 228 316 203 [4,] 15 173 227 184 171 162 258 304 328 306 329 255 [5,] 25 160 132 119 117 185 276 186 158 206 265 261 [6,] 25 47 41 16 10 24 48 14 40 48 61 115 [7,] 254 232 273 340 339 394 455 321 556 557 679 NA [8,] 200 143 182 151 139 209 345 206 193 279 428 NA [9,] 165 161 188 240 186 248 311 160 221 399 394 NA [10,] 123 159 162 235 155 254 346 217 278 364 352 NA [11,] 162 243 140 174 153 202 310 204 230 306 387 NA [12,] 145 192 186 309 222 258 297 246 253 471 590 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/wessaorg/rcomp/tmp/1q0a11425980347.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2gjv61425980347.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3gji31425980347.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4p5o61425980347.ps",horizontal=F,onefile=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,] 102.0 25 155 15 25.0 10.0 232.0 139.0 160.0 123.0 140.0 145 [2,] 151.0 152 195 172 125.5 20.0 297.0 166.5 175.5 160.5 168.0 207 [3,] 177.5 203 215 241 172.5 40.5 340.0 200.0 221.0 235.0 204.0 253 [4,] 237.0 263 266 305 233.5 48.0 505.5 244.0 279.5 312.0 274.5 303 [5,] 300.0 333 364 329 276.0 61.0 679.0 345.0 399.0 364.0 387.0 309 $n [1] 12 12 12 12 12 12 11 11 11 11 11 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 138.2748 152.3722 182.6164 180.3378 123.2405 27.72901 240.6731 163.0799 [2,] 216.7252 253.6278 247.3836 301.6622 221.7595 53.27099 439.3269 236.9201 [,9] [,10] [,11] [,12] [1,] 171.4557 162.8272 153.2647 207.2668 [2,] 270.5443 307.1728 254.7353 298.7332 $out [1] 20 15 115 428 471 590 $group [1] 1 3 6 8 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(102, 151, 177.5, 237, 300, 25, 152, 203, 263, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/572e61425980347.ps",horizontal=F,onefile=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] [,8] [,9] [,10] [,11] [,12] [1,] 15.0 143.0 132.0 119.0 117.0 24.0 215 160.0 40 48.0 265.0 115 [2,] 22.5 150.0 141.5 162.5 146.0 134.5 249 195.0 184 234.0 304.5 177 [3,] 74.0 160.5 172.0 193.0 172.5 195.0 303 231.5 232 292.5 342.5 201 [4,] 163.5 182.5 204.5 238.0 208.0 251.0 328 296.0 303 381.5 411.0 255 [5,] 254.0 192.0 273.0 340.0 222.0 394.0 346 321.0 364 557.0 428.0 261 $n [1] 12 12 12 12 12 12 12 12 12 12 12 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 9.688954 145.6765 143.2653 158.5639 144.2214 141.8636 266.9676 185.4332 [2,] 138.311046 175.3235 200.7347 227.4361 200.7786 248.1364 339.0324 277.5668 [,9] [,10] [,11] [,12] [1,] 177.7233 225.2243 293.9246 150.6875 [2,] 286.2767 359.7757 391.0754 251.3125 $out [1] 47 232 243 41 16 10 339 48 455 14 556 61 679 590 $group [1] 2 2 2 3 4 5 5 7 7 8 9 11 11 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" NA Warning message: In bxp(list(stats = c(15, 22.5, 74, 163.5, 254, 143, 150, 160.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ow671425980347.ps",horizontal=F,onefile=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,] 72.75967 239.0 26.00 [2,] 78.08913 244.0 79.50 [3,] 87.21268 284.5 98.50 [4,] 90.96350 331.5 119.25 [5,] 91.24293 447.0 151.50 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 81.34060 244.5907 80.36976 [2,] 93.08477 324.4093 116.63024 $out [1] 28.39694 144.60913 131.73037 105.00000 208.50000 $group [1] 1 1 1 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(72.7596708140553, 78.0891341168684, 87.2126825485411, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1q0a11425980347.ps tmp/1q0a11425980347.png",intern=TRUE)) character(0) > try(system("convert tmp/2gjv61425980347.ps tmp/2gjv61425980347.png",intern=TRUE)) character(0) > try(system("convert tmp/3gji31425980347.ps tmp/3gji31425980347.png",intern=TRUE)) character(0) > try(system("convert tmp/4p5o61425980347.ps tmp/4p5o61425980347.png",intern=TRUE)) character(0) > try(system("convert tmp/572e61425980347.ps tmp/572e61425980347.png",intern=TRUE)) character(0) > try(system("convert tmp/6ow671425980347.ps tmp/6ow671425980347.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.032 0.375 2.434