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(3004,3080,3017,3114,3057,3032,3127,3050,2910,2671,2638,2672,2654,2568,2467,2419,2363,2291,2560,2527,2370,2310,2231,2367,2346,2286,2249,2226,2108,2131,2387,2358,2284,2312,2293,2576,2665,2749,2926,2886,2893,2944,3060,3045,2894,2955,2954,3243,3120,3074,3034,2981,2876,2835,2978,2881,2768,2722,2630,2753,2771,2652,2584,2501,2449,2445,2620,2579,2460,2434,2392,1037,1212,1232,1174,1158,1140,1118,1212,1207,1186,608,627,626,649,619,612,643,623,649,699,693,659,669,668,693) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 3004 2654 2346 2665 3120 2771 1212 649 NA [2,] 3080 2568 2286 2749 3074 2652 1232 619 NA [3,] 3017 2467 2249 2926 3034 2584 1174 612 NA [4,] 3114 2419 2226 2886 2981 2501 1158 643 NA [5,] 3057 2363 2108 2893 2876 2449 1140 623 NA [6,] 3032 2291 2131 2944 2835 2445 1118 649 NA [7,] 3127 2560 2387 3060 2978 2620 1212 699 NA [8,] 3050 2527 2358 3045 2881 2579 1207 693 NA [9,] 2910 2370 2284 2894 2768 2460 1186 659 NA [10,] 2671 2310 2312 2955 2722 2434 608 669 NA [11,] 2638 2231 2293 2954 2630 2392 627 668 NA [12,] 2672 2367 2576 3243 2753 1037 626 693 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/15jdg1416514758.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/2xuxg1416514758.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/3cyj31416514758.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/4vrz31416514758.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] [1,] 649.0 619.0 612.0 643.0 623.0 649.0 699.0 693.0 659 608.0 627.0 [2,] 1779.0 1759.0 1711.5 1692.0 1624.0 1624.5 1799.5 1782.5 1735 1489.5 1449.5 [3,] 2659.5 2610.0 2525.5 2460.0 2406.0 2368.0 2590.0 2553.0 2415 2373.0 2342.5 [4,] 2887.5 2911.5 2971.5 2933.5 2884.5 2889.5 3019.0 2963.0 2831 2696.5 2634.0 [5,] 3120.0 3080.0 3034.0 3114.0 3057.0 3032.0 3127.0 3050.0 2910 2955.0 2954.0 [,12] [1,] 626.0 [2,] 865.0 [3,] 2471.5 [4,] 2712.5 [5,] 3243.0 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2040.276 1966.197 1821.646 1766.48 1701.867 1661.353 1908.77 1893.556 [2,] 3278.724 3253.803 3229.354 3153.52 3110.133 3074.647 3271.23 3212.444 [,9] [,10] [,11] [,12] [1,] 1802.759 1698.752 1680.821 1439.46 [2,] 3027.241 3047.248 3004.179 3503.54 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(649, 1779, 2659.5, 2887.5, 3120, 619, 1759, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5m59q1416514758.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] [1,] 2638.0 2231.0 2108.0 2749.0 2630.0 2392.0 608.0 612 NA [2,] 2791.0 2336.5 2237.5 2889.5 2760.5 2439.5 872.5 633 NA [3,] 3024.5 2394.5 2289.5 2935.0 2878.5 2480.5 1166.0 654 NA [4,] 3068.5 2543.5 2352.0 3000.0 3007.5 2602.0 1209.5 681 NA [5,] 3127.0 2654.0 2387.0 3060.0 3120.0 2771.0 1232.0 699 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 2897.93 2300.086 2237.276 2884.6 2765.842 2406.383 1012.292 632.1069 NA [2,] 3151.07 2488.914 2341.724 2985.4 2991.158 2554.617 1319.708 675.8931 NA $out [1] 2576 2665 3243 1037 $group [1] 3 4 4 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(2638, 2791, 3024.5, 3068.5, 3127, 2231, 2336.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/62lt81416514758.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,] 869.7597 2251 766.750 [2,] 875.9756 2352 790.875 [3,] 891.5852 2425 878.500 [4,] 898.4803 2466 976.500 [5,] 919.3635 2617 1014.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 881.3206 2373.004 793.8352 [2,] 901.8497 2476.996 963.1648 $out [1] 829.3024 1038.7812 1741.2500 $group [1] 1 1 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(869.759726673325, 875.975598384423, 891.585188733337, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15jdg1416514758.ps tmp/15jdg1416514758.png",intern=TRUE)) character(0) > try(system("convert tmp/2xuxg1416514758.ps tmp/2xuxg1416514758.png",intern=TRUE)) character(0) > try(system("convert tmp/3cyj31416514758.ps tmp/3cyj31416514758.png",intern=TRUE)) character(0) > try(system("convert tmp/4vrz31416514758.ps tmp/4vrz31416514758.png",intern=TRUE)) character(0) > try(system("convert tmp/5m59q1416514758.ps tmp/5m59q1416514758.png",intern=TRUE)) character(0) > try(system("convert tmp/62lt81416514758.ps tmp/62lt81416514758.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.175 0.355 2.558