R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(5731,5040,6102,4904,5369,5578,4619,4731,5011,5227,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5657,4249,3830,4736,4840,4413,4571,4106,4801,3956,3829,4453,4027,4121,4798,3233,3554,3952,3951,3685,4312,3867,4140,4114,3818,3377,3453,3502,4017,5410,5184,5529,6434,4962,2980,2937,2969,2731,3163,3145,3173,3723,3224,4114,3446,2955,3879,4278,4177,3698,4449,4162,3961,5246,5170,3682,3495,3770,3291,3580,3898,3477,3054) > 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] 84 > (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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 5731 4736 4736 3233 3502 3145 4162 NA [2,] 5040 4219 4840 3554 4017 3173 3961 NA [3,] 6102 5116 4413 3952 5410 3723 5246 NA [4,] 4904 4205 4571 3951 5184 3224 5170 NA [5,] 5369 4121 4106 3685 5529 4114 3682 NA [6,] 5578 5103 4801 4312 6434 3446 3495 NA [7,] 4619 4300 3956 3867 4962 2955 3770 NA [8,] 4731 4578 3829 4140 2980 3879 3291 NA [9,] 5011 3809 4453 4114 2937 4278 3580 NA [10,] 5227 5657 4027 3818 2969 4177 3898 NA [11,] 4146 4249 4121 3377 2731 3698 3477 NA [12,] 4625 3830 4798 3453 3163 4449 3054 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/14l1v1386142314.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/2zd1w1386142314.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/3030o1386142314.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/43iqe1386142314.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,] 3145.0 3173.0 3723.0 3224 3682.0 3446.0 2955.0 2980 2937.0 2969 2731.0 [2,] 3367.5 3757.5 4182.5 4078 3895.5 3903.5 3818.5 3560 3694.5 3858 3427.0 [3,] 4162.0 4017.0 5116.0 4571 4114.0 4801.0 3956.0 3879 4114.0 4027 3698.0 [4,] 4736.0 4529.5 5328.0 5037 4745.0 5340.5 4459.5 4359 4365.5 4702 4133.5 [5,] 5731.0 5040.0 6102.0 5184 5529.0 6434.0 4962.0 4731 5011.0 5657 4249.0 [,12] [1,] 3054 [2,] 3308 [3,] 3830 [4,] 4537 [5,] 4798 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3344.754 3555.974 4431.926 3998.301 3606.692 3942.847 3573.205 3401.85 [2,] 4979.246 4478.026 5800.074 5143.699 4621.308 5659.153 4338.795 4356.15 [,9] [,10] [,11] [,12] [1,] 3713.29 3522.977 3276.09 3096.061 [2,] 4514.71 4531.023 4119.91 4563.939 $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(3145, 3367.5, 4162, 4736, 5731, 3173, 3757.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/50d061386142314.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,] 4146.0 3809.0 3829.0 3233.0 2731.0 2955.0 3054.0 NA [2,] 4678.0 4163.0 4066.5 3503.5 2974.5 3198.5 3486.0 NA [3,] 5025.5 4274.5 4433.0 3842.5 3759.5 3710.5 3726.0 NA [4,] 5473.5 4919.5 4767.0 4033.0 5297.0 4145.5 4061.5 NA [5,] 6102.0 5657.0 4840.0 4312.0 6434.0 4449.0 4162.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 4662.667 3929.455 4113.497 3600.991 2700.192 3278.567 3463.511 NA [2,] 5388.333 4619.545 4752.503 4084.009 4818.808 4142.433 3988.489 NA $out [1] 5246 5170 $group [1] 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(4146, 4678, 5025.5, 5473.5, 6102, 3809, 4163, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6jbv71386142314.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,] 543.0046 1518.0 641.00 [2,] 655.9940 1799.0 739.25 [3,] 717.9716 1983.5 846.75 [4,] 880.7312 2482.5 1187.25 [5,] 1088.9596 2988.0 1437.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 615.4675 1671.751 642.4142 [2,] 820.4758 2295.249 1051.0858 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(543.004560184307, 655.99395524866, 717.971638997562, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/14l1v1386142314.ps tmp/14l1v1386142314.png",intern=TRUE)) character(0) > try(system("convert tmp/2zd1w1386142314.ps tmp/2zd1w1386142314.png",intern=TRUE)) character(0) > try(system("convert tmp/3030o1386142314.ps tmp/3030o1386142314.png",intern=TRUE)) character(0) > try(system("convert tmp/43iqe1386142314.ps tmp/43iqe1386142314.png",intern=TRUE)) character(0) > try(system("convert tmp/50d061386142314.ps tmp/50d061386142314.png",intern=TRUE)) character(0) > try(system("convert tmp/6jbv71386142314.ps tmp/6jbv71386142314.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.539 0.896 5.554