R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 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(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] 132 > (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] 11 11 11 11 11 11 11 11 11 11 11 11 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 254 232 273 340 339 394 455 321 556 557 679 NA [2,] 200 143 182 151 139 209 345 206 193 279 428 NA [3,] 165 161 188 240 186 248 311 160 221 399 394 NA [4,] 123 159 162 235 155 254 346 217 278 364 352 NA [5,] 162 243 140 174 153 202 310 204 230 306 387 NA [6,] 145 192 186 309 222 258 297 246 253 471 590 NA [7,] 145 157 178 174 102 215 300 234 240 293 177 NA [8,] 161 143 236 207 107 309 274 175 252 333 199 NA [9,] 155 221 202 209 188 240 292 364 228 316 203 NA [10,] 173 227 184 171 162 258 304 328 306 329 255 NA [11,] 160 132 119 117 185 276 186 158 206 265 261 NA [12,] 47 41 16 10 24 48 14 40 48 61 115 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/1kr8x1464533900.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/2t9c81464533900.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/3fnql1464533900.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/4hro51464533900.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,] 232.0 139.0 160.0 123.0 140.0 145 102.0 107 155.0 162.0 117.0 10 [2,] 297.0 166.5 175.5 160.5 168.0 207 165.5 168 202.5 178.5 145.0 20 [3,] 340.0 200.0 221.0 235.0 204.0 253 178.0 207 221.0 255.0 185.0 41 [4,] 505.5 244.0 279.5 312.0 274.5 303 237.0 263 266.0 305.0 233.5 48 [5,] 679.0 345.0 399.0 364.0 387.0 309 300.0 333 316.0 329.0 276.0 61 $n [1] 11 11 11 11 11 11 11 11 11 11 11 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 240.6731 163.0799 171.4557 162.8272 153.2647 207.2668 143.9383 161.7431 [2,] 439.3269 236.9201 270.5443 307.1728 254.7353 298.7332 212.0617 252.2569 [,9] [,10] [,11] [,12] [1,] 190.7494 194.7369 142.8397 27.66114 [2,] 251.2506 315.2631 227.1603 54.33886 $out [1] 428 471 590 364 115 $group [1] 2 6 6 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(232, 297, 340, 505.5, 679, 139, 166.5, 200, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5mcro1464533900.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,] 123.0 41 119 117.0 102.0 202 274 40.0 193.0 265.0 115.0 NA [2,] 145.0 143 151 161.0 123.0 212 283 167.5 213.5 286.0 201.0 NA [3,] 160.5 160 183 190.5 158.5 251 302 211.5 235.0 322.5 306.5 NA [4,] 169.0 224 195 237.5 187.0 267 328 283.5 265.5 381.5 411.0 NA [5,] 200.0 243 236 340.0 222.0 309 346 364.0 306.0 471.0 679.0 NA $n [1] 12 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 149.5534 123.0554 162.9313 155.6078 129.3092 225.9141 281.4752 158.5916 [2,] 171.4466 196.9446 203.0687 225.3922 187.6908 276.0859 322.5248 264.4084 [,9] [,10] [,11] [,12] [1,] 211.2825 278.9418 210.7176 NA [2,] 258.7175 366.0582 402.2824 NA $out [1] 254 47 273 16 10 339 24 394 48 455 186 14 556 48 557 61 $group [1] 1 1 3 3 4 5 5 6 6 7 7 7 9 9 10 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" NA Warning message: In bxp(list(stats = c(123, 145, 160.5, 169, 200, 41, 143, 160, 224, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ftu41464533900.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,] 29.32514 105.0 28.0 [2,] 61.56149 182.5 74.5 [3,] 74.02815 232.5 95.5 [4,] 89.57155 268.0 116.5 [5,] 90.68407 289.0 151.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 61.25258 193.5029 76.34352 [2,] 86.80372 271.4971 114.65648 $out [1] 144.6091 131.7304 447.0000 445.0000 208.5000 $group [1] 1 1 2 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(29.3251365958223, 61.5614936316607, 74.0281494862082, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kr8x1464533900.ps tmp/1kr8x1464533900.png",intern=TRUE)) character(0) > try(system("convert tmp/2t9c81464533900.ps tmp/2t9c81464533900.png",intern=TRUE)) character(0) > try(system("convert tmp/3fnql1464533900.ps tmp/3fnql1464533900.png",intern=TRUE)) character(0) > try(system("convert tmp/4hro51464533900.ps tmp/4hro51464533900.png",intern=TRUE)) character(0) > try(system("convert tmp/5mcro1464533900.ps tmp/5mcro1464533900.png",intern=TRUE)) character(0) > try(system("convert tmp/6ftu41464533900.ps tmp/6ftu41464533900.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.052 0.315 2.394