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(26.133,25.979,25.541,25.308,25.663,25.78,25.328,24.806,24.651,24.531,24.633,25.174,24.449,24.277,24.393,24.301,24.381,24.286,24.335,24.273,24.556,24.841,25.464,25.514,25.531,25.042,24.676,24.809,25.313,25.64,25.447,25.021,24.752,24.939,25.365,25.214,25.563,25.475,25.659,25.841,25.888,25.759,25.944,25.818,25.789,25.662,26.927,27.521,27.485,27.444,27.395,27.45,27.437,27.45,27.458,27.816,27.599,27.588,27.667,27.64) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 26.133 24.449 25.531 25.563 27.485 NA [2,] 25.979 24.277 25.042 25.475 27.444 NA [3,] 25.541 24.393 24.676 25.659 27.395 NA [4,] 25.308 24.301 24.809 25.841 27.450 NA [5,] 25.663 24.381 25.313 25.888 27.437 NA [6,] 25.780 24.286 25.640 25.759 27.450 NA [7,] 25.328 24.335 25.447 25.944 27.458 NA [8,] 24.806 24.273 25.021 25.818 27.816 NA [9,] 24.651 24.556 24.752 25.789 27.599 NA [10,] 24.531 24.841 24.939 25.662 27.588 NA [11,] 24.633 25.464 25.365 26.927 27.667 NA [12,] 25.174 25.514 25.214 27.521 27.640 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/1st6z1448806805.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/29im31448806805.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/3cyyx1448806805.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/49f0i1448806805.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,] 25.531 24.277 24.393 24.301 25.313 25.640 25.328 24.273 24.556 24.531 [2,] 25.531 25.042 24.676 24.809 25.313 25.640 25.328 24.806 24.651 24.841 [3,] 25.563 25.475 25.541 25.308 25.663 25.759 25.447 25.021 24.752 24.939 [4,] 26.133 25.979 25.659 25.841 25.888 25.780 25.944 25.818 25.789 25.662 [5,] 26.133 25.979 25.659 25.841 25.888 25.780 25.944 25.818 25.789 25.662 [,11] [,12] [1,] 24.633 25.174 [2,] 25.365 25.214 [3,] 25.464 25.514 [4,] 26.927 27.521 [5,] 27.667 27.640 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 25.13763 24.81292 24.84641 24.57879 25.25671 25.66008 25.01174 24.30592 [2,] 25.98837 26.13708 26.23559 26.03721 26.06929 25.85792 25.88226 25.73608 [,9] [,10] [,11] [,12] [1,] 23.94789 24.35888 24.36029 23.88388 [2,] 25.55611 25.51912 26.56771 27.14412 $out [1] 24.449 27.485 27.444 27.395 27.450 24.381 27.437 24.286 27.450 24.335 [11] 27.458 27.816 27.599 27.588 $group [1] 1 1 2 3 4 5 5 6 6 7 7 8 9 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(25.531, 25.531, 25.563, 26.133, 26.133, 24.277, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5730l1448806805.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] [1,] 24.5310 24.2730 24.676 25.4750 27.3950 NA [2,] 24.7285 24.2935 24.874 25.6605 27.4470 NA [3,] 25.3180 24.3870 25.128 25.8035 27.4715 NA [4,] 25.7215 24.6985 25.406 25.9160 27.6195 NA [5,] 26.1330 24.8410 25.640 25.9440 27.8160 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 24.86509 24.20228 24.88535 25.68696 27.39282 NA [2,] 25.77091 24.57172 25.37065 25.92004 27.55018 NA $out [1] 25.464 25.514 26.927 27.521 $group [1] 2 2 4 4 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(24.531, 24.7285, 25.318, 25.7215, 26.133, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/680w41448806805.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,] 1.106646 3.0020 0.140 [2,] 1.132248 3.0350 0.609 [3,] 1.197524 3.0565 0.960 [4,] 1.250492 3.1565 1.085 [5,] 1.384796 3.1670 1.562 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.143592 3.001083 0.7428932 [2,] 1.251456 3.111917 1.1771068 $out [1] 3.543 2.466 2.307 $group [1] 2 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.10664592350038, 1.13224758483134, 1.1975237372414, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1st6z1448806805.ps tmp/1st6z1448806805.png",intern=TRUE)) character(0) > try(system("convert tmp/29im31448806805.ps tmp/29im31448806805.png",intern=TRUE)) character(0) > try(system("convert tmp/3cyyx1448806805.ps tmp/3cyyx1448806805.png",intern=TRUE)) character(0) > try(system("convert tmp/49f0i1448806805.ps tmp/49f0i1448806805.png",intern=TRUE)) character(0) > try(system("convert tmp/5730l1448806805.ps tmp/5730l1448806805.png",intern=TRUE)) character(0) > try(system("convert tmp/680w41448806805.ps tmp/680w41448806805.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.249 0.378 2.651