R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(340.7,343.5,345.3,346.9,349,351.4,353,355,360.1,364.7,366.5,369,369.9,370.8,374.5,378.4,381.3,383.5,387.6,391.7,395.4,399.3,403.3,406.6,410.5,413.5,418.7,421.7,422.8,425.8,427.6,431,434.3,437.6,440.4,443.5,446.2,446.2,449.7,454.2,458.4,461.1,464,466.2,468.7,471.8,474.9,477.5,480,482.8,485.7,488.5,492,495.1,498.5,502.2,502.1,510,515,520.4,525.2,530.1,534.5,538.5,544.4,548.4,551.9,554.9,558.1,561.3,564.4,567,568.7,570.9,572.5,574.6,577.1,580.9,583.3,586.5) > par1 = '4' > par1 <- '4' > #'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] 80 > (np <- floor(n / par1)) [1] 20 > 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] 20 20 20 20 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 340.7 349.0 360.1 369.9 381.3 395.4 410.5 422.8 434.3 446.2 458.4 468.7 [2,] 343.5 351.4 364.7 370.8 383.5 399.3 413.5 425.8 437.6 446.2 461.1 471.8 [3,] 345.3 353.0 366.5 374.5 387.6 403.3 418.7 427.6 440.4 449.7 464.0 474.9 [4,] 346.9 355.0 369.0 378.4 391.7 406.6 421.7 431.0 443.5 454.2 466.2 477.5 [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [1,] 480.0 492.0 502.1 525.2 544.4 558.1 568.7 577.1 NA [2,] 482.8 495.1 510.0 530.1 548.4 561.3 570.9 580.9 NA [3,] 485.7 498.5 515.0 534.5 551.9 564.4 572.5 583.3 NA [4,] 488.5 502.2 520.4 538.5 554.9 567.0 574.6 586.5 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/1fv3o1447844920.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/297hy1447844920.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/3jgtz1447844920.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/4srks1447844920.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] [1,] 340.70 343.50 345.30 346.90 [2,] 388.35 391.40 395.45 399.15 [3,] 452.30 453.65 456.85 460.20 [4,] 513.65 520.05 524.75 529.45 [5,] 577.10 580.90 583.30 586.50 $n [1] 20 20 20 20 $conf [,1] [,2] [,3] [,4] [1,] 408.0317 408.1981 411.1685 414.1652 [2,] 496.5683 499.1019 502.5315 506.2348 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5v9rn1447844920.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] [1,] 340.7 349.0 360.10 369.90 381.30 395.40 410.5 422.8 434.30 446.20 458.40 [2,] 342.1 350.2 362.40 370.35 382.40 397.35 412.0 424.3 435.95 446.20 459.75 [3,] 344.4 352.2 365.60 372.65 385.55 401.30 416.1 426.7 439.00 447.95 462.55 [4,] 346.1 354.0 367.75 376.45 389.65 404.95 420.2 429.3 441.95 451.95 465.10 [5,] 346.9 355.0 369.00 378.40 391.70 406.60 421.7 431.0 443.50 454.20 466.20 [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [1,] 468.70 480.00 492.00 502.10 525.20 544.40 558.10 568.70 577.1 NA [2,] 470.25 481.40 493.55 506.05 527.65 546.40 559.70 569.80 579.0 NA [3,] 473.35 484.25 496.80 512.50 532.30 550.15 562.85 571.70 582.1 NA [4,] 476.20 487.10 500.35 517.70 536.50 553.40 565.70 573.55 584.9 NA [5,] 477.50 488.50 502.20 520.40 538.50 554.90 567.00 574.60 586.5 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 341.24 349.198 361.3735 367.831 379.8225 395.296 409.622 422.75 434.26 [2,] 347.56 355.202 369.8265 377.469 391.2775 407.304 422.578 430.65 443.74 [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [1,] 443.4075 458.3235 468.6495 479.747 491.428 503.2965 525.3085 544.62 558.11 [2,] 452.4925 466.7765 478.0505 488.753 502.172 521.7035 539.2915 555.68 567.59 [,19] [,20] [,21] [1,] 568.7375 577.439 NA [2,] 574.6625 586.761 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" NA Warning message: In bxp(list(stats = c(340.7, 342.1, 344.4, 346.1, 346.9, 349, 350.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/61fz91447844920.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,] 75.68694 236.4 116.0000 [2,] 75.91065 236.9 117.8375 [3,] 76.20020 237.7 120.0875 [4,] 76.34107 238.8 121.2750 [5,] 76.41610 239.6 122.0500 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 75.86017 236.199 117.3719 [2,] 76.54023 239.201 122.8031 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(75.6869416186105, 75.910649222847, 76.2001979324781, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1fv3o1447844920.ps tmp/1fv3o1447844920.png",intern=TRUE)) character(0) > try(system("convert tmp/297hy1447844920.ps tmp/297hy1447844920.png",intern=TRUE)) character(0) > try(system("convert tmp/3jgtz1447844920.ps tmp/3jgtz1447844920.png",intern=TRUE)) character(0) > try(system("convert tmp/4srks1447844920.ps tmp/4srks1447844920.png",intern=TRUE)) character(0) > try(system("convert tmp/5v9rn1447844920.ps tmp/5v9rn1447844920.png",intern=TRUE)) character(0) > try(system("convert tmp/61fz91447844920.ps tmp/61fz91447844920.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.032 0.382 2.446