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(104.93,105.68,106.93,107.29,107.25,106.74,106.44,106.6,107.26,107.35,107.22,106.99,106.87,107.68,108.9,109.48,109.57,109.03,109.58,109.76,110.15,110.2,109.86,109.58,109.52,110.35,111.61,112.06,111.9,111.36,112.09,112.24,112.7,113.36,112.9,112.74,112.7,113.66,114.87,114.97,115,114.57,115.54,115.39,115.46,115.13,114.56,114.62,114.37,114.86,115.82,116.35,115.95,115.64,116.58,116.5,116.48,116.34,115.65,115.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] 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,] 104.93 106.87 109.52 112.70 114.37 NA [2,] 105.68 107.68 110.35 113.66 114.86 NA [3,] 106.93 108.90 111.61 114.87 115.82 NA [4,] 107.29 109.48 112.06 114.97 116.35 NA [5,] 107.25 109.57 111.90 115.00 115.95 NA [6,] 106.74 109.03 111.36 114.57 115.64 NA [7,] 106.44 109.58 112.09 115.54 116.58 NA [8,] 106.60 109.76 112.24 115.39 116.50 NA [9,] 107.26 110.15 112.70 115.46 116.48 NA [10,] 107.35 110.20 113.36 115.13 116.34 NA [11,] 107.22 109.86 112.90 114.56 115.65 NA [12,] 106.99 109.58 112.74 114.62 115.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/1v6bm1448220950.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/2eoa51448220950.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/3pa4a1448220950.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/4jsri1448220950.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,] 104.93 105.68 106.93 107.29 107.25 106.74 106.44 106.60 107.26 107.35 [2,] 106.87 107.68 108.90 109.48 109.57 109.03 109.58 109.76 110.15 110.20 [3,] 109.52 110.35 111.61 112.06 111.90 111.36 112.09 112.24 112.70 113.36 [4,] 112.70 113.66 114.87 114.97 115.00 114.57 115.54 115.39 115.46 115.13 [5,] 114.37 114.86 115.82 116.35 115.95 115.64 116.58 116.50 116.48 116.34 [,11] [,12] [1,] 107.22 106.99 [2,] 109.86 109.58 [3,] 112.90 112.74 [4,] 114.56 114.62 [5,] 115.65 115.42 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 105.4005 106.1245 107.3916 108.1808 108.0632 107.4454 107.8787 108.2619 [2,] 113.6395 114.5755 115.8284 115.9392 115.7368 115.2746 116.3013 116.2181 [,9] [,10] [,11] [,12] [1,] 108.948 109.8765 109.579 109.1787 [2,] 116.452 116.8435 116.221 116.3013 $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(104.93, 106.87, 109.52, 112.7, 114.37, 105.68, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5m5v71448220950.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,] 105.680 108.900 110.350 113.660 114.370 NA [2,] 106.520 108.965 111.485 114.565 115.530 NA [3,] 106.960 109.575 112.075 114.920 115.885 NA [4,] 107.255 109.810 112.720 115.260 116.415 NA [5,] 107.350 110.200 113.360 115.540 116.580 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 106.6248 109.1896 111.5117 114.603 115.4813 NA [2,] 107.2952 109.9604 112.6383 115.237 116.2887 NA $out [1] 104.93 106.87 107.68 109.52 112.70 $group [1] 1 2 2 3 4 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(105.68, 106.52, 106.96, 107.255, 107.35, 108.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/69nrr1448220950.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,] 3.467956 8.430 4.700 [2,] 3.661740 8.795 5.175 [3,] 3.772513 9.025 5.515 [4,] 3.901674 9.330 5.895 [5,] 4.191525 9.900 5.980 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.663078 8.780983 5.186603 [2,] 3.881949 9.269017 5.843397 $out [1] 10.14 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.46795617042661, 3.66174033764294, 3.77251346629898, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1v6bm1448220950.ps tmp/1v6bm1448220950.png",intern=TRUE)) character(0) > try(system("convert tmp/2eoa51448220950.ps tmp/2eoa51448220950.png",intern=TRUE)) character(0) > try(system("convert tmp/3pa4a1448220950.ps tmp/3pa4a1448220950.png",intern=TRUE)) character(0) > try(system("convert tmp/4jsri1448220950.ps tmp/4jsri1448220950.png",intern=TRUE)) character(0) > try(system("convert tmp/5m5v71448220950.ps tmp/5m5v71448220950.png",intern=TRUE)) character(0) > try(system("convert tmp/69nrr1448220950.ps tmp/69nrr1448220950.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.059 0.405 2.485