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(11798,8378,8131,7676,7505,8168,6455,6141,6554,6888,5339,1624,9187,5047,5289,4169,3862,4253,3768,3066,4108,3890,3420,1221,5984,4064,5151,4027,3530,4819,3855,3584,4322,4154,4656,1464,7780,5060,6084,4778,4989,4903,4142,4101,4595,5034,5407,1782,8395,5291,6116,4210,4621,5299,4293,4542,3831,4360,4088,1508,6743,4159,5105,4283,4019,4206,3948,3407,3701,4159,4208,2622) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 11798 9187 5984 7780 8395 6743 NA [2,] 8378 5047 4064 5060 5291 4159 NA [3,] 8131 5289 5151 6084 6116 5105 NA [4,] 7676 4169 4027 4778 4210 4283 NA [5,] 7505 3862 3530 4989 4621 4019 NA [6,] 8168 4253 4819 4903 5299 4206 NA [7,] 6455 3768 3855 4142 4293 3948 NA [8,] 6141 3066 3584 4101 4542 3407 NA [9,] 6554 4108 4322 4595 3831 3701 NA [10,] 6888 3890 4154 5034 4360 4159 NA [11,] 5339 3420 4656 5407 4088 4208 NA [12,] 1624 1221 1464 1782 1508 2622 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/1ue871416754755.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/2615e1416754755.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/3gvtu1416754755.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/4npyh1416754755.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] [,12] [1,] 5984.0 4064.0 5105.0 4027.0 3530 4206 3768 3066.0 3701 3890.0 3420 1221 [2,] 6743.0 4159.0 5151.0 4169.0 3862 4253 3855 3407.0 3831 4154.0 4088 1464 [3,] 8087.5 5053.5 5686.5 4246.5 4320 4861 4045 3842.5 4215 4259.5 4432 1566 [4,] 9187.0 5291.0 6116.0 4778.0 4989 5299 4293 4542.0 4595 5034.0 5339 1782 [5,] 11798.0 5291.0 6116.0 4778.0 4989 5299 4293 6141.0 4595 5034.0 5407 1782 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 6511.041 4323.323 5064.044 3853.675 3593.049 4186.296 3762.476 3110.388 [2,] 9663.959 5783.677 6308.956 4639.325 5046.951 5535.704 4327.524 4574.612 [,9] [,10] [,11] [,12] [1,] 3722.195 3691.872 3625.065 1360.88 [2,] 4707.805 4827.128 5238.935 1771.12 $out [1] 8378 8131 7676 7505 8168 6455 6554 6888 2622 $group [1] 2 3 4 5 6 7 9 10 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(5984, 6743, 8087.5, 9187, 11798, 4064, 4159, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ug8b1416754755.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] [1,] 5339.0 3066 3530.0 4101.0 3831 3407.0 NA [2,] 6298.0 3594 3719.5 4368.5 4149 3824.5 NA [3,] 7196.5 3999 4109.0 4946.0 4451 4159.0 NA [4,] 8149.5 4650 4737.5 5233.5 5295 4245.5 NA [5,] 8378.0 5289 5984.0 6084.0 6116 4283.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 6352.018 3517.351 3644.683 4551.468 3928.302 3966.979 NA [2,] 8040.982 4480.649 4573.317 5340.532 4973.698 4351.021 NA $out [1] 11798 1624 9187 1221 1464 7780 1782 8395 1508 6743 5105 2622 $group [1] 1 1 2 2 3 4 4 5 5 6 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(5339, 6298, 7196.5, 8149.5, 8378, 3066, 3594, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6t0aj1416754755.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,] 486.7261 1401.0 267.500 [2,] 1034.2302 2770.0 550.750 [3,] 1132.7879 3050.5 828.875 [4,] 1462.0677 3968.5 988.125 [5,] 2053.7303 4314.0 1050.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 937.6483 2503.856 629.3853 [2,] 1327.9274 3597.144 1028.3647 $out [1] 5814.00 1986.75 $group [1] 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(486.72610367639, 1034.23015607148, 1132.78785319905, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ue871416754755.ps tmp/1ue871416754755.png",intern=TRUE)) character(0) > try(system("convert tmp/2615e1416754755.ps tmp/2615e1416754755.png",intern=TRUE)) character(0) > try(system("convert tmp/3gvtu1416754755.ps tmp/3gvtu1416754755.png",intern=TRUE)) character(0) > try(system("convert tmp/4npyh1416754755.ps tmp/4npyh1416754755.png",intern=TRUE)) character(0) > try(system("convert tmp/5ug8b1416754755.ps tmp/5ug8b1416754755.png",intern=TRUE)) character(0) > try(system("convert tmp/6t0aj1416754755.ps tmp/6t0aj1416754755.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.082 0.389 2.492