R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(79.21,79.08,79.88,80.57,80.9,80.89,80.61,80.98,81.68,83.28,83.94,89.25,95.3,97.68,98.53,98.32,97.02,90.13,88.49,88.07,87.17,86.1,86.59,85.89,85.82,86.68,86.3,86.32,85.61,85.52,85.97,86.6,86.78,84.98,85.21,86.39,88.39,88.83,95.76,100.98,102.56,102.92,104.35,105.07,105.41,105.06,104.33,104.61,104.78,104.38,104.08,103.4,101.72,100.1,100.37,96.27,95.28,95.85,96.76,97,96.71,96.97,96.97,98.01,99.18,99.51,99.16,99.4,97.59,96.71,96.56,96.42) > 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,] 79.21 95.30 85.82 88.39 104.78 96.71 NA [2,] 79.08 97.68 86.68 88.83 104.38 96.97 NA [3,] 79.88 98.53 86.30 95.76 104.08 96.97 NA [4,] 80.57 98.32 86.32 100.98 103.40 98.01 NA [5,] 80.90 97.02 85.61 102.56 101.72 99.18 NA [6,] 80.89 90.13 85.52 102.92 100.10 99.51 NA [7,] 80.61 88.49 85.97 104.35 100.37 99.16 NA [8,] 80.98 88.07 86.60 105.07 96.27 99.40 NA [9,] 81.68 87.17 86.78 105.41 95.28 97.59 NA [10,] 83.28 86.10 84.98 105.06 95.85 96.71 NA [11,] 83.94 86.59 85.21 104.33 96.76 96.56 NA [12,] 89.25 85.89 86.39 104.61 97.00 96.42 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/1r2qd1447927915.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/2o4ld1447927915.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/3oxy41447927915.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/4o2871447927915.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] [1,] 79.210 79.08 79.880 80.570 80.90 80.89 80.610 80.98 81.680 [2,] 85.820 86.68 86.300 86.320 85.61 85.52 85.970 86.60 86.780 [3,] 91.845 92.90 96.365 98.165 98.10 94.82 93.825 92.17 91.225 [4,] 96.710 97.68 98.530 100.980 101.72 100.10 100.370 99.40 97.590 [5,] 104.780 104.38 104.080 103.400 102.56 102.92 104.350 105.07 105.410 [,10] [,11] [,12] [1,] 83.280 83.940 85.890 [2,] 84.980 85.210 86.390 [3,] 90.975 91.575 92.835 [4,] 96.710 96.760 97.000 [5,] 105.060 104.330 104.610 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 84.8206 85.80464 88.47625 88.70883 87.70853 85.41543 84.53653 [2,] 98.8694 99.99536 104.25375 107.62117 108.49147 104.22457 103.11347 [,8] [,9] [,10] [,11] [,12] [1,] 83.91359 84.2522 83.40877 84.12488 85.99121 [2,] 100.42641 98.1978 98.54123 99.02512 99.67879 $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(79.21, 85.82, 91.845, 96.71, 104.78, 79.08, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5i4lf1447927915.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,] 79.080 85.89 84.980 88.830 95.280 96.42 NA [2,] 80.225 86.88 85.565 98.370 96.515 96.71 NA [3,] 80.895 89.31 86.135 103.625 100.235 97.28 NA [4,] 82.480 97.35 86.495 104.835 103.740 99.17 NA [5,] 83.940 98.53 86.780 105.410 104.780 99.51 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 79.86648 84.53456 85.71082 100.6763 96.93963 96.15798 NA [2,] 81.92352 94.08544 86.55918 106.5737 103.53037 98.40202 NA $out [1] 89.25 88.39 $group [1] 1 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(79.08, 80.225, 80.895, 82.48, 83.94, 85.89, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/66d8e1447927915.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,] 8.191384 18.720 9.47500 [2,] 8.636941 21.720 10.01500 [3,] 8.991602 23.280 11.11375 [4,] 9.055459 24.145 12.13625 [5,] 9.425579 25.570 13.46750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 8.800713 22.17394 10.14623 [2,] 9.182491 24.38606 12.08127 $out [1] 7.353769 $group [1] 1 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(8.19138429489587, 8.63694105938108, 8.99160177300769, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1r2qd1447927915.ps tmp/1r2qd1447927915.png",intern=TRUE)) character(0) > try(system("convert tmp/2o4ld1447927915.ps tmp/2o4ld1447927915.png",intern=TRUE)) character(0) > try(system("convert tmp/3oxy41447927915.ps tmp/3oxy41447927915.png",intern=TRUE)) character(0) > try(system("convert tmp/4o2871447927915.ps tmp/4o2871447927915.png",intern=TRUE)) character(0) > try(system("convert tmp/5i4lf1447927915.ps tmp/5i4lf1447927915.png",intern=TRUE)) character(0) > try(system("convert tmp/66d8e1447927915.ps tmp/66d8e1447927915.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.175 0.369 2.571