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(790,766,1040,2596,949,758,1023,2730,921,775,907,2603,835,871,836,2542,10471,789,811,996,2596,778,603,990,2371,735,800,706,2241,766,870,647,2283,9491,726,784,884,2394,696,893,674,2263,703,799,793,2295,799,1022,758,2579,9531,1021,944,915,2880,864,1022,891,2777,1087,822,890,2799,1092,967,833,2892,11348,1104,1063,1103,3270,1039,1185,1047,3271,1155,878,879,2912,1133,920,943,2996,12449) > 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] 85 > (np <- floor(n / par1)) [1] 7 > 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 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 790 835 2371 884 758 822 1039 12449 [2,] 766 871 735 2394 2579 890 1185 NA [3,] 1040 836 800 696 9531 2799 1047 NA [4,] 2596 2542 706 893 1021 1092 3271 NA [5,] 949 10471 2241 674 944 967 1155 NA [6,] 758 789 766 2263 915 833 878 NA [7,] 1023 811 870 703 2880 2892 879 NA [8,] 2730 996 647 799 864 11348 2912 NA [9,] 921 2596 2283 793 1022 1104 1133 NA [10,] 775 778 9491 2295 891 1063 920 NA [11,] 907 603 726 799 2777 1103 943 NA [12,] 2603 990 784 1022 1087 3270 2996 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/1oma21416593345.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/2w1uv1416593345.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/3xsss1416593345.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/44g3p1416593345.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,] 758.0 735.0 696 706 674.0 758.0 703.0 647.0 793.0 775.0 603.0 [2,] 806.0 818.5 818 957 946.5 777.5 840.5 831.5 971.5 834.5 762.5 [3,] 859.5 890.0 1040 1092 967.0 833.0 879.0 996.0 1104.0 920.0 907.0 [4,] 1705.0 1789.5 1923 2569 1698.0 896.5 1951.5 2821.0 1708.0 1679.0 1023.0 [5,] 2371.0 2579.0 2799 3271 2241.0 915.0 2892.0 2912.0 2596.0 2295.0 1103.0 [,12] [1,] 784.0 [2,] 1006.0 [3,] 1087.0 [4,] 2799.5 [5,] 3270.0 $n [1] 8 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 357.3057 310.1345 380.1118 129.3396 518.2163 761.9351 215.5287 [2,] 1361.6943 1469.8655 1699.8882 2054.6604 1415.7837 904.0649 1542.4713 [,8] [,9] [,10] [,11] [,12] [1,] -192.0973 664.1741 415.6782 751.4336 15.95073 [2,] 2184.0973 1543.8259 1424.3218 1062.5664 2158.04927 $out [1] 12449 9531 10471 2263 11348 9491 2777 $group [1] 1 3 5 6 8 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(758, 806, 859.5, 1705, 2371, 735, 818.5, 890, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5fztr1416593345.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] [1,] 758.0 603.0 647.0 674.0 758.0 822.0 878.0 12449 [2,] 782.5 800.0 730.5 748.0 903.0 928.5 931.5 12449 [3,] 935.0 853.5 792.0 841.5 1021.5 1097.5 1090.0 12449 [4,] 1818.0 1769.0 2262.0 1642.5 2678.0 2845.5 2048.5 12449 [5,] 2730.0 2596.0 2371.0 2394.0 2880.0 3270.0 3271.0 12449 $n [1] 12 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 462.7015 411.5326 93.47257 433.5125 211.9106 223.1434 580.5288 [2,] 1407.2985 1295.4674 1490.52743 1249.4875 1831.0894 1971.8566 1599.4712 [,8] [1,] 12449 [2,] 12449 $out [1] 10471 9491 9531 11348 $group [1] 2 3 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(758, 782.5, 935, 1818, 2730, 603, 800, 853.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6kh6n1416593345.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,] 547.2932 1505.0 119.00 [2,] 770.7774 2009.0 647.25 [3,] 1059.5267 2525.5 907.75 [4,] 3393.6396 9316.0 1361.50 [5,] 4058.3504 11691.0 1989.50 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] -136.7783 -807.2717 581.9758 [2,] 2255.8318 5858.2717 1233.5242 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(547.293165975795, 770.777380873834, 1059.5267490014, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1oma21416593345.ps tmp/1oma21416593345.png",intern=TRUE)) character(0) > try(system("convert tmp/2w1uv1416593345.ps tmp/2w1uv1416593345.png",intern=TRUE)) character(0) > try(system("convert tmp/3xsss1416593345.ps tmp/3xsss1416593345.png",intern=TRUE)) character(0) > try(system("convert tmp/44g3p1416593345.ps tmp/44g3p1416593345.png",intern=TRUE)) character(0) > try(system("convert tmp/5fztr1416593345.ps tmp/5fztr1416593345.png",intern=TRUE)) character(0) > try(system("convert tmp/6kh6n1416593345.ps tmp/6kh6n1416593345.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.196 0.369 2.590