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(103.77,103.82,103.86,103.9,103.63,103.65,103.7,103.77,103.94,104.03,104.03,104.29,104.35,104.67,104.73,104.86,104.05,104.15,104.27,104.33,104.41,104.4,104.41,104.6,104.61,104.65,104.55,104.51,104.74,104.89,104.91,104.93,104.95,104.97,105.16,105.29,105.35,105.36,105.45,105.3,105.73,105.86,105.85,105.95,105.97,106.15,105.37,105.39,105.39,105.38,105.23,105.34,104.98,105.16,105.27,105.27,105.33,105.33,105.46,105.54,105.59,105.57,105.62,105.57,105.33,105.34,105.5,105.47,105.59,105.65,105.8,105.87) > 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,] 103.77 104.35 104.61 105.35 105.39 105.59 NA [2,] 103.82 104.67 104.65 105.36 105.38 105.57 NA [3,] 103.86 104.73 104.55 105.45 105.23 105.62 NA [4,] 103.90 104.86 104.51 105.30 105.34 105.57 NA [5,] 103.63 104.05 104.74 105.73 104.98 105.33 NA [6,] 103.65 104.15 104.89 105.86 105.16 105.34 NA [7,] 103.70 104.27 104.91 105.85 105.27 105.50 NA [8,] 103.77 104.33 104.93 105.95 105.27 105.47 NA [9,] 103.94 104.41 104.95 105.97 105.33 105.59 NA [10,] 104.03 104.40 104.97 106.15 105.33 105.65 NA [11,] 104.03 104.41 105.16 105.37 105.46 105.80 NA [12,] 104.29 104.60 105.29 105.39 105.54 105.87 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/15uw11416507840.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/2f1ce1416507840.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/37ilz1416507840.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/4vg1l1416507840.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,] 103.77 103.820 103.86 103.90 103.63 103.650 103.70 103.77 103.94 104.03 [2,] 104.35 104.650 104.55 104.51 104.05 104.150 104.27 104.33 104.41 104.40 [3,] 104.98 105.015 104.98 105.08 104.86 105.025 105.09 105.10 105.14 105.15 [4,] 105.39 105.380 105.45 105.34 105.33 105.340 105.50 105.47 105.59 105.65 [5,] 105.59 105.570 105.62 105.57 105.73 105.860 105.85 105.95 105.97 106.15 [,11] [,12] [1,] 104.030 104.29 [2,] 104.410 104.60 [3,] 105.265 105.34 [4,] 105.460 105.54 [5,] 105.800 105.87 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 104.3092 104.5441 104.3995 104.5446 104.0344 104.2574 104.2966 104.3647 [2,] 105.6508 105.4859 105.5605 105.6154 105.6856 105.7926 105.8834 105.8353 [,9] [,10] [,11] [,12] [1,] 104.3789 104.3437 104.5877 104.7337 [2,] 105.9011 105.9563 105.9423 105.9463 $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(103.77, 104.35, 104.98, 105.39, 105.59, 103.82, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5jig81416507840.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,] 103.630 104.050 104.51 105.300 105.160 105.330 NA [2,] 103.735 104.300 104.63 105.365 105.250 105.485 NA [3,] 103.840 104.405 104.90 105.590 105.330 105.580 NA [4,] 103.985 104.635 104.96 105.905 105.385 105.635 NA [5,] 104.290 104.860 105.29 106.150 105.540 105.800 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 103.726 104.2522 104.7495 105.3437 105.2684 105.5116 NA [2,] 103.954 104.5578 105.0505 105.8363 105.3916 105.6484 NA $out [1] 104.98 105.87 $group [1] 5 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(103.63, 103.735, 103.84, 103.985, 104.29, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6t30s1416507840.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.5981193 1.580 0.72000 [2,] 0.6583928 1.755 0.76625 [3,] 0.7365312 1.925 0.95000 [4,] 0.7911226 2.135 0.99625 [5,] 0.8108617 2.210 1.02750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.6759922 1.751679 0.8450955 [2,] 0.7970701 2.098321 1.0549045 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.598119274615581, 0.658392829863862, 0.736531158648414, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15uw11416507840.ps tmp/15uw11416507840.png",intern=TRUE)) character(0) > try(system("convert tmp/2f1ce1416507840.ps tmp/2f1ce1416507840.png",intern=TRUE)) character(0) > try(system("convert tmp/37ilz1416507840.ps tmp/37ilz1416507840.png",intern=TRUE)) character(0) > try(system("convert tmp/4vg1l1416507840.ps tmp/4vg1l1416507840.png",intern=TRUE)) character(0) > try(system("convert tmp/5jig81416507840.ps tmp/5jig81416507840.png",intern=TRUE)) character(0) > try(system("convert tmp/6t30s1416507840.ps tmp/6t30s1416507840.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.085 0.355 2.481