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(332,369,384,373,378,426,423,397,422,409,430,412,470,491,504,484,474,508,492,452,457,457,471,451,493,514,522,490,484,506,501,462,465,454,464,427,460,473,465,422,415,413,420,363,376,380,384,346,389,407,393,346,348,353,364,305,307,312,312,286,324,336,327,302,299,311,315,264,278,278,287,279,324,354,354,360,363,385,412,370,389,395,417,404,456,478,468,437,432,441,449,386,396,394,403,373,409,430,415,392,401,400,447,392,427,444,448,427,480,490,482,490,485,498,544,483,508,529,547,543,608,638,661,650,654,678,725,644,670,662,641,642) > 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,] 332 470 493 460 389 324 324 456 409 480 608 NA [2,] 369 491 514 473 407 336 354 478 430 490 638 NA [3,] 384 504 522 465 393 327 354 468 415 482 661 NA [4,] 373 484 490 422 346 302 360 437 392 490 650 NA [5,] 378 474 484 415 348 299 363 432 401 485 654 NA [6,] 426 508 506 413 353 311 385 441 400 498 678 NA [7,] 423 492 501 420 364 315 412 449 447 544 725 NA [8,] 397 452 462 363 305 264 370 386 392 483 644 NA [9,] 422 457 465 376 307 278 389 396 427 508 670 NA [10,] 409 457 454 380 312 278 395 394 444 529 662 NA [11,] 430 471 464 384 312 287 417 403 448 547 641 NA [12,] 412 451 427 346 286 279 404 373 427 543 642 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/1hx2x1416775788.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/2t9gp1416775788.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/3xabc1416775788.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/4o5zi1416775788.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,] 324.0 336.0 327.0 302.0 299.0 311.0 315.0 264.0 278.0 312.0 287.0 279.0 [2,] 360.5 388.0 388.5 366.5 370.5 392.5 416.0 366.5 382.5 387.0 393.5 359.5 [3,] 456.0 473.0 465.0 422.0 415.0 426.0 447.0 392.0 422.0 409.0 430.0 412.0 [4,] 475.0 490.5 493.0 487.0 479.0 502.0 496.5 457.0 461.0 455.5 467.5 439.0 [5,] 608.0 638.0 522.0 650.0 485.0 508.0 544.0 483.0 508.0 529.0 547.0 543.0 $n [1] 11 11 11 11 11 11 11 11 11 11 11 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 401.4536 424.1702 415.2175 364.5953 363.3119 373.8355 408.6508 348.8869 [2,] 510.5464 521.8298 514.7825 479.4047 466.6881 478.1645 485.3492 435.1131 [,9] [,10] [,11] [,12] [1,] 384.6035 376.3674 394.7473 374.1272 [2,] 459.3965 441.6326 465.2527 449.8728 $out [1] 661 654 678 725 644 670 278 662 641 642 $group [1] 3 5 6 7 8 9 10 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(324, 360.5, 456, 475, 608, 336, 388, 473, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5wwlp1416775788.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,] 332.0 451.0 427.0 346 286.0 264.0 324.0 373.0 392.0 480 608.0 NA [2,] 375.5 457.0 463.0 378 309.5 278.5 357.0 395.0 400.5 484 641.5 NA [3,] 403.0 472.5 487.0 414 347.0 300.5 377.5 434.5 421.0 494 652.0 NA [4,] 422.5 491.5 503.5 441 376.5 319.5 399.5 452.5 437.0 536 666.0 NA [5,] 430.0 508.0 522.0 473 407.0 336.0 417.0 478.0 448.0 547 678.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,] 381.563 456.7643 468.5277 385.2653 316.4409 281.7996 358.1155 408.2739 [2,] 424.437 488.2357 505.4723 442.7347 377.5591 319.2004 396.8845 460.7261 [,9] [,10] [,11] [,12] [1,] 404.3521 470.2825 640.8254 NA [2,] 437.6479 517.7175 663.1746 NA $out [1] 725 $group [1] 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" NA Warning message: In bxp(list(stats = c(332, 375.5, 403, 422.5, 430, 451, 457, 472.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6lxvq1416775788.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,] 86.58763 284 68.5 [2,] 94.20738 341 79.0 [3,] 99.10646 359 96.5 [4,] 104.20504 382 109.0 [5,] 107.56250 410 120.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 94.54646 340.2996 82.8168 [2,] 103.66646 377.7004 110.1832 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(86.5876329611693, 94.2073819910334, 99.1064605185753, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1hx2x1416775788.ps tmp/1hx2x1416775788.png",intern=TRUE)) character(0) > try(system("convert tmp/2t9gp1416775788.ps tmp/2t9gp1416775788.png",intern=TRUE)) character(0) > try(system("convert tmp/3xabc1416775788.ps tmp/3xabc1416775788.png",intern=TRUE)) character(0) > try(system("convert tmp/4o5zi1416775788.ps tmp/4o5zi1416775788.png",intern=TRUE)) character(0) > try(system("convert tmp/5wwlp1416775788.ps tmp/5wwlp1416775788.png",intern=TRUE)) character(0) > try(system("convert tmp/6lxvq1416775788.ps tmp/6lxvq1416775788.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.135 0.445 2.609