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(246.78,247.91,247.99,248.6,248.68,248.75,248.75,249.03,249.05,249.57,249.35,249.46,249.46,250.82,254.19,255.18,256.68,256.73,256.73,257.39,257.78,258.67,258.71,258.91,258.91,261.38,262.42,262.77,263.24,262.83,262.83,263.09,263.6,265.68,266.08,266.28,266.28,269.14,270.96,272.97,273.13,274.73,274.73,274.59,275.15,275.16,275.38,275.4,275.4,275.71,275.21,279.04,279.1,279.11,279.11,279.02,279.3,279.34,279.36,279.39,279.39,280.21,283,284.33,285.15,284.21,284.21,284.17,286.28,286.95,287.12,287.34) > 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,] 246.78 249.46 258.91 266.28 275.40 279.39 NA [2,] 247.91 250.82 261.38 269.14 275.71 280.21 NA [3,] 247.99 254.19 262.42 270.96 275.21 283.00 NA [4,] 248.60 255.18 262.77 272.97 279.04 284.33 NA [5,] 248.68 256.68 263.24 273.13 279.10 285.15 NA [6,] 248.75 256.73 262.83 274.73 279.11 284.21 NA [7,] 248.75 256.73 262.83 274.73 279.11 284.21 NA [8,] 249.03 257.39 263.09 274.59 279.02 284.17 NA [9,] 249.05 257.78 263.60 275.15 279.30 286.28 NA [10,] 249.57 258.67 265.68 275.16 279.34 286.95 NA [11,] 249.35 258.71 266.08 275.38 279.36 287.12 NA [12,] 249.46 258.91 266.28 275.40 279.39 287.34 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/1faxw1416481915.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/2fhu31416481915.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/3y4871416481915.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/42gto1416481915.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,] 246.780 247.91 247.99 248.60 248.680 248.75 248.75 249.03 249.050 249.57 [2,] 249.460 250.82 254.19 255.18 256.680 256.73 256.73 257.39 257.780 258.67 [3,] 262.595 265.26 266.69 267.87 268.185 268.78 268.78 268.84 269.375 270.42 [4,] 275.400 275.71 275.21 279.04 279.100 279.11 279.11 279.02 279.300 279.34 [5,] 279.390 280.21 283.00 284.33 285.150 284.21 284.21 284.17 286.280 286.95 [,11] [,12] [1,] 249.35 249.46 [2,] 258.71 258.91 [3,] 270.73 270.84 [4,] 279.36 279.39 [5,] 287.12 287.34 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 245.8629 249.2051 253.1314 252.4795 253.7234 254.3442 254.3442 254.888 [2,] 279.3271 281.3149 280.2486 283.2605 282.6466 283.2158 283.2158 282.792 [,9] [,10] [,11] [,12] [1,] 255.4939 257.0872 257.4101 257.6297 [2,] 283.2561 283.7528 284.0499 284.0503 $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(246.78, 249.46, 262.595, 275.4, 279.39, 247.91, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5hxu51416481915.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,] 247.910 249.460 261.380 269.140 275.210 279.390 NA [2,] 248.295 254.685 262.595 271.965 277.365 283.585 NA [3,] 248.750 256.730 262.960 274.660 279.105 284.270 NA [4,] 249.200 258.225 264.640 275.155 279.320 286.615 NA [5,] 249.570 258.910 266.280 275.400 279.390 287.340 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 248.3372 255.1154 262.0273 273.205 278.2133 282.888 NA [2,] 249.1628 258.3446 263.8927 276.115 279.9967 285.652 NA $out [1] 246.78 258.91 266.28 $group [1] 1 3 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(247.91, 248.295, 248.75, 249.2, 249.57, 249.46, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ayhf1416481915.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,] 13.15709 32.300 17.64000 [2,] 13.48505 35.075 17.88625 [3,] 13.84683 35.595 19.19250 [4,] 13.96865 37.305 20.10250 [5,] 14.10119 37.880 21.29750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 13.62625 34.57788 18.18165 [2,] 14.06740 36.61212 20.20335 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(13.1570859235622, 13.4850458541125, 13.8468279032332, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1faxw1416481915.ps tmp/1faxw1416481915.png",intern=TRUE)) character(0) > try(system("convert tmp/2fhu31416481915.ps tmp/2fhu31416481915.png",intern=TRUE)) character(0) > try(system("convert tmp/3y4871416481915.ps tmp/3y4871416481915.png",intern=TRUE)) character(0) > try(system("convert tmp/42gto1416481915.ps tmp/42gto1416481915.png",intern=TRUE)) character(0) > try(system("convert tmp/5hxu51416481915.ps tmp/5hxu51416481915.png",intern=TRUE)) character(0) > try(system("convert tmp/6ayhf1416481915.ps tmp/6ayhf1416481915.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.128 0.345 2.501