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(2.04,2.08,1.94,1.91,1.34,1.3,1.39,1.23,1.3,1.79,2.25,2.63,2.8,3.08,3.89,3.68,4.62,5.07,5.22,4.94,5.14,4.8,3.89,3.54,3.34,2.8,1.6,1.56,0.68,-0.11,-0.66,-0.2,-0.62,-0.59,-0.3,-0.26,-0.08,0.13,0.94,1.05,1.59,2.03,2.15,2.05,2.56,2.54,2.53,2.6,2.71,2.82,2.92,2.87,2.89,3.27,3.32,3.14,3.04,3.09,3.39,3.24,3.38,3.41,3.14,2.96,2.74,2.21,2.24,2.56,2.39,2.49,2.17,2.16,1.48,1.09,1.25,1.27,1.39,1.69,1.55,1.19,1.08,0.94,0.98,1.01) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2.04 2.80 3.34 -0.08 2.71 3.38 1.48 NA [2,] 2.08 3.08 2.80 0.13 2.82 3.41 1.09 NA [3,] 1.94 3.89 1.60 0.94 2.92 3.14 1.25 NA [4,] 1.91 3.68 1.56 1.05 2.87 2.96 1.27 NA [5,] 1.34 4.62 0.68 1.59 2.89 2.74 1.39 NA [6,] 1.30 5.07 -0.11 2.03 3.27 2.21 1.69 NA [7,] 1.39 5.22 -0.66 2.15 3.32 2.24 1.55 NA [8,] 1.23 4.94 -0.20 2.05 3.14 2.56 1.19 NA [9,] 1.30 5.14 -0.62 2.56 3.04 2.39 1.08 NA [10,] 1.79 4.80 -0.59 2.54 3.09 2.49 0.94 NA [11,] 2.25 3.89 -0.30 2.53 3.39 2.17 0.98 NA [12,] 2.63 3.54 -0.26 2.60 3.24 2.16 1.01 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/1g9ur1416763737.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/2wed01416763737.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/3zefb1416763737.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/4pt1w1416763737.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,] -0.08 0.130 0.940 1.050 0.680 -0.110 1.39 -0.20 -0.62 -0.590 -0.300 -0.260 [2,] 1.76 1.585 1.425 1.415 1.365 1.495 1.47 1.21 1.19 1.365 1.575 1.585 [3,] 2.71 2.800 1.940 1.910 1.590 2.030 2.15 2.05 2.39 2.490 2.250 2.600 [4,] 3.07 2.950 3.030 2.915 2.815 2.740 2.78 2.85 2.80 2.815 2.960 2.935 [5,] 3.38 3.410 3.890 3.680 4.620 3.270 3.32 4.94 5.14 4.800 3.890 3.540 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.927689 1.984844 0.9815199 1.014224 0.7240834 1.286506 1.367689 1.070618 [2,] 3.492311 3.615156 2.8984801 2.805776 2.4559166 2.773494 2.932311 3.029382 [,9] [,10] [,11] [,12] [1,] 1.428534 1.624083 1.4229 1.793802 [2,] 3.351466 3.355917 3.0771 3.406198 $out [1] 5.07 5.22 -0.66 $group [1] 6 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.08, 1.76, 2.71, 3.07, 3.38, 0.13, 1.585, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5icme1416763737.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] [1,] 1.23 2.800 -0.660 -0.080 2.710 2.160 0.940 NA [2,] 1.32 3.610 -0.445 0.995 2.880 2.225 1.045 NA [3,] 1.85 4.255 -0.155 2.040 3.065 2.525 1.220 NA [4,] 2.06 5.005 1.580 2.535 3.255 3.050 1.435 NA [5,] 2.63 5.220 3.340 2.600 3.390 3.410 1.690 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.512481 3.618731 -1.0786161 1.337596 2.89396 2.148712 1.042118 NA [2,] 2.187519 4.891269 0.7686161 2.742404 3.23604 2.901288 1.397882 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(1.23, 1.32, 1.85, 2.06, 2.63, 2.8, 3.61, 4.255, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6je5r1416763737.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.9913435 2.630 1.2450 [2,] 1.2094894 3.370 1.3300 [3,] 1.3773914 4.065 1.4175 [4,] 1.6707517 5.285 1.5525 [5,] 1.8088644 5.880 1.6400 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.167007 3.191556 1.316016 [2,] 1.587776 4.938444 1.518984 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.99134348475284, 1.20948935573809, 1.37739137635942, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1g9ur1416763737.ps tmp/1g9ur1416763737.png",intern=TRUE)) character(0) > try(system("convert tmp/2wed01416763737.ps tmp/2wed01416763737.png",intern=TRUE)) character(0) > try(system("convert tmp/3zefb1416763737.ps tmp/3zefb1416763737.png",intern=TRUE)) character(0) > try(system("convert tmp/4pt1w1416763737.ps tmp/4pt1w1416763737.png",intern=TRUE)) character(0) > try(system("convert tmp/5icme1416763737.ps tmp/5icme1416763737.png",intern=TRUE)) character(0) > try(system("convert tmp/6je5r1416763737.ps tmp/6je5r1416763737.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.132 0.366 2.523