R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(530.3,527.76,521.41,1601.93,1577.49,1551.43,1551.43,1516.88,1485.95,1438.22,1385.06,1329.49,1329.49,1276.16,1242.34,1181.59,1160.21,1135.18,1135.18,1084.96,1077.35,1061.13,1029.98,1013.08,1013.08,996.04,975.02,951.89,944.4,932.47,932.47,920.44,900.18,886.9,869.74,859.03,859.03,844.99,834.82,825.62,816.92,813.21,813.21,811.03,804.16,788.62,778.76,765.91,765.91,753.85,742.22,732.11,729.94,731.22,731.22,729.11,726.94,720.52,709.36,703.21) > 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] 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,] 530.30 1329.49 1013.08 859.03 765.91 NA [2,] 527.76 1276.16 996.04 844.99 753.85 NA [3,] 521.41 1242.34 975.02 834.82 742.22 NA [4,] 1601.93 1181.59 951.89 825.62 732.11 NA [5,] 1577.49 1160.21 944.40 816.92 729.94 NA [6,] 1551.43 1135.18 932.47 813.21 731.22 NA [7,] 1551.43 1135.18 932.47 813.21 731.22 NA [8,] 1516.88 1084.96 920.44 811.03 729.11 NA [9,] 1485.95 1077.35 900.18 804.16 726.94 NA [10,] 1438.22 1061.13 886.90 788.62 720.52 NA [11,] 1385.06 1029.98 869.74 778.76 709.36 NA [12,] 1329.49 1013.08 859.03 765.91 703.21 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/1t5la1398709571.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/2tiwy1398709571.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/3h2gw1398709571.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/4d0fh1398709571.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] [1,] 530.30 527.76 521.41 732.11 729.94 731.22 731.22 729.11 726.94 [2,] 765.91 753.85 742.22 825.62 816.92 813.21 813.21 811.03 804.16 [3,] 859.03 844.99 834.82 951.89 944.40 932.47 932.47 920.44 900.18 [4,] 1013.08 996.04 975.02 1181.59 1160.21 1135.18 1135.18 1084.96 1077.35 [5,] 1329.49 1276.16 1242.34 1601.93 1577.49 1551.43 1551.43 1084.96 1485.95 [,10] [,11] [,12] [1,] 720.52 709.36 703.21 [2,] 788.62 778.76 765.91 [3,] 886.90 869.74 859.03 [4,] 1061.13 1029.98 1013.08 [5,] 1438.22 1385.06 1329.49 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 684.3803 673.8592 670.3241 700.3625 701.8322 704.9668 704.9668 [2,] 1033.6797 1016.1208 999.3159 1203.4175 1186.9678 1159.9732 1159.9732 [,8] [,9] [,10] [,11] [,12] [1,] 726.8818 707.1446 694.3451 692.2286 684.3803 [2,] 1113.9982 1093.2154 1079.4549 1047.2514 1033.6797 $out [1] 1516.88 $group [1] 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(530.3, 765.91, 859.03, 1013.08, 1329.49, 527.76, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ti8f1398709571.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] [1,] 521.410 1013.080 859.030 765.91 709.360 NA [2,] 929.895 1069.240 893.540 796.39 723.730 NA [3,] 1462.085 1135.180 932.470 813.21 730.580 NA [4,] 1551.430 1211.965 963.455 830.22 737.165 NA [5,] 1601.930 1329.490 1013.080 859.03 753.850 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1178.599 1070.082 900.5813 797.7799 724.4522 NA [2,] 1745.571 1200.278 964.3587 828.6401 736.7078 NA $out [1] 765.91 703.21 $group [1] 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(521.41, 929.895, 1462.085, 1551.43, 1601.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ha981398709571.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,] 249.9023 626.280 232.80 [2,] 274.0103 719.315 247.17 [3,] 299.6963 773.390 272.85 [4,] 327.3740 820.210 321.97 [5,] 347.3458 869.820 355.97 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 275.3567 727.3711 238.7332 [2,] 324.0358 819.4089 306.9668 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(249.902308872887, 274.010349515994, 299.696269038901, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1t5la1398709571.ps tmp/1t5la1398709571.png",intern=TRUE)) character(0) > try(system("convert tmp/2tiwy1398709571.ps tmp/2tiwy1398709571.png",intern=TRUE)) character(0) > try(system("convert tmp/3h2gw1398709571.ps tmp/3h2gw1398709571.png",intern=TRUE)) character(0) > try(system("convert tmp/4d0fh1398709571.ps tmp/4d0fh1398709571.png",intern=TRUE)) character(0) > try(system("convert tmp/5ti8f1398709571.ps tmp/5ti8f1398709571.png",intern=TRUE)) character(0) > try(system("convert tmp/6ha981398709571.ps tmp/6ha981398709571.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.075 0.718 4.822