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(20.89,21.04,21.07,21.12,21.25,21.24,21.24,21.22,21.29,21.25,21.15,21.16,21.16,21.52,21.59,21.60,21.68,21.67,21.67,21.65,21.74,21.72,21.84,21.94,21.94,21.95,21.96,22.10,22.13,22.18,22.18,22.27,22.30,22.04,22.05,22.06,22.06,22.06,21.97,22.03,22.08,22.13,22.13,22.40,22.40,22.12,22.22,22.14,22.14,22.19,22.29,22.24,22.26,22.29,22.29,22.29,22.29,22.35,22.39,22.43,22.43,22.11,22.12,22.05,22.05,22.08,22.08,22.09,22.09,22.24,22.25,22.24,22.24,22.25,22.28,22.23,22.29,22.31,22.31,22.31,22.39,22.42,22.42,22.42,22.15,21.95,21.96,21.97,21.66,21.66,21.68,21.75,21.55,21.59,21.54,21.54) > 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,] 20.89 21.16 21.94 22.06 22.14 22.43 22.24 22.15 NA [2,] 21.04 21.52 21.95 22.06 22.19 22.11 22.25 21.95 NA [3,] 21.07 21.59 21.96 21.97 22.29 22.12 22.28 21.96 NA [4,] 21.12 21.60 22.10 22.03 22.24 22.05 22.23 21.97 NA [5,] 21.25 21.68 22.13 22.08 22.26 22.05 22.29 21.66 NA [6,] 21.24 21.67 22.18 22.13 22.29 22.08 22.31 21.66 NA [7,] 21.24 21.67 22.18 22.13 22.29 22.08 22.31 21.68 NA [8,] 21.22 21.65 22.27 22.40 22.29 22.09 22.31 21.75 NA [9,] 21.29 21.74 22.30 22.40 22.29 22.09 22.39 21.55 NA [10,] 21.25 21.72 22.04 22.12 22.35 22.24 22.42 21.59 NA [11,] 21.15 21.84 22.05 22.22 22.39 22.25 22.42 21.54 NA [12,] 21.16 21.94 22.06 22.14 22.43 22.24 22.42 21.54 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/1mkbq1427410893.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/260yc1427410893.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/37oft1427410893.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/4ettf1427410893.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] [1,] 20.890 21.520 21.590 21.600 21.250 21.240 21.240 21.22 21.290 21.250 [2,] 21.550 21.735 21.775 21.785 21.670 21.665 21.675 21.70 21.645 21.655 [3,] 22.100 22.005 21.965 22.040 22.065 22.105 22.105 22.18 22.190 22.080 [4,] 22.195 22.150 22.200 22.165 22.195 22.235 22.235 22.30 22.345 22.295 [5,] 22.430 22.250 22.290 22.240 22.290 22.310 22.310 22.40 22.400 22.420 [,11] [,12] [1,] 21.150 21.16 [2,] 21.690 21.74 [3,] 22.135 22.10 [4,] 22.320 22.33 [5,] 22.420 22.43 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 21.73969 21.77318 21.72759 21.82773 21.77173 21.78659 21.79218 21.84483 [2,] 22.46031 22.23682 22.20241 22.25227 22.35827 22.42341 22.41782 22.51517 [,9] [,10] [,11] [,12] [1,] 21.79897 21.72249 21.78307 21.77042 [2,] 22.58103 22.43751 22.48693 22.42958 $out [1] 21.04 21.07 21.12 $group [1] 2 3 4 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(20.89, 21.55, 22.1, 22.195, 22.43, 21.52, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5790n1427410893.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,] 20.890 21.520 21.94 21.970 22.19 22.05 22.230 21.540 NA [2,] 21.095 21.595 22.00 22.060 22.25 22.08 22.265 21.570 NA [3,] 21.190 21.670 22.08 22.125 22.29 22.10 22.310 21.670 NA [4,] 21.245 21.730 22.18 22.180 22.32 22.24 22.405 21.955 NA [5,] 21.290 21.840 22.30 22.220 22.39 22.43 22.420 22.150 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 21.12158 21.60843 21.9979 22.07027 22.25807 22.02702 22.24615 21.4944 NA [2,] 21.25842 21.73157 22.1621 22.17973 22.32193 22.17298 22.37385 21.8456 NA $out [1] 21.16 21.94 22.40 22.40 22.14 22.43 $group [1] 2 2 4 4 5 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(20.89, 21.095, 21.19, 21.245, 21.29, 21.52, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6aul91427410893.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,] 0.3611490 1.040 0.25500 [2,] 0.3797123 1.090 0.36000 [3,] 0.4084436 1.175 0.50375 [4,] 0.4333947 1.245 0.55500 [5,] 0.4470778 1.270 0.63000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.3839587 1.104303 0.4148092 [2,] 0.4329285 1.245697 0.5926908 $out [1] 0.548633 1.540000 $group [1] 1 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.36114896016543, 0.379712283579819, 0.408443556171944, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1mkbq1427410893.ps tmp/1mkbq1427410893.png",intern=TRUE)) character(0) > try(system("convert tmp/260yc1427410893.ps tmp/260yc1427410893.png",intern=TRUE)) character(0) > try(system("convert tmp/37oft1427410893.ps tmp/37oft1427410893.png",intern=TRUE)) character(0) > try(system("convert tmp/4ettf1427410893.ps tmp/4ettf1427410893.png",intern=TRUE)) character(0) > try(system("convert tmp/5790n1427410893.ps tmp/5790n1427410893.png",intern=TRUE)) character(0) > try(system("convert tmp/6aul91427410893.ps tmp/6aul91427410893.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.149 0.345 2.508