R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-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(1103,1125,1150,1187,1248,1172,1092,5255,5297,5461,5729,5795,5411,5503,5583,5763,5840,5907,5836,5756,5916,6056,6469,6603,6247,6342,6431) > 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] 27 > (np <- floor(n / par1)) [1] 2 > 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] 3 3 3 2 2 2 2 2 2 2 2 2 > arr [,1] [,2] [,3] [1,] 1103 5411 6247 [2,] 1125 5503 6342 [3,] 1150 5583 6431 [4,] 1187 5763 NA [5,] 1248 5840 NA [6,] 1172 5907 NA [7,] 1092 5836 NA [8,] 5255 5756 NA [9,] 5297 5916 NA [10,] 5461 6056 NA [11,] 5729 6469 NA [12,] 5795 6603 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/13ygj1358172377.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/2yr751358172377.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/3o6o41358172377.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/41gmp1358172377.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,] 1103 1125.0 1150.0 1187 1248 1172.0 1092 5255.0 5297.0 5461.0 5729 5795 [2,] 3257 3314.0 3366.5 1187 1248 1172.0 1092 5255.0 5297.0 5461.0 5729 5795 [3,] 5411 5503.0 5583.0 3475 3544 3539.5 3464 5505.5 5606.5 5758.5 6099 6199 [4,] 5829 5922.5 6007.0 5763 5840 5907.0 5836 5756.0 5916.0 6056.0 6469 6603 [5,] 6247 6342.0 6431.0 5763 5840 5907.0 5836 5756.0 5916.0 6056.0 6469 6603 $n [1] 3 3 3 2 2 2 2 2 2 2 2 2 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3064.787 3123.491 3174.3 -1637.439 -1586.314 -1750.578 -1836.133 4945.768 [2,] 7757.213 7882.509 7991.7 8587.439 8674.314 8829.578 8764.133 6065.232 [,9] [,10] [,11] [,12] [1,] 4914.935 5093.749 5272.251 5296.279 [2,] 6298.065 6423.251 6925.749 7101.721 $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(1103, 3257, 5411, 5829, 6247, 1125, 3314, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5lga41358172377.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] [1,] 1092.0 5411.0 6247.0 [2,] 1137.5 5669.5 6294.5 [3,] 1217.5 5838.0 6342.0 [4,] 5379.0 5986.0 6386.5 [5,] 5795.0 6056.0 6431.0 $n [1] 12 12 3 $conf [,1] [,2] [,3] [1,] -717.0766 5693.642 6258.076 [2,] 3152.0766 5982.358 6425.924 $out [1] 6469 6603 $group [1] 2 2 $names [1] "1" "2" NA Warning message: In bxp(list(stats = c(1092, 1137.5, 1217.5, 5379, 5795, 5411, 5669.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6nc2f1358172377.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,] 354.2605 501.0 250.50 [2,] 480.4791 679.5 339.75 [3,] 2780.9072 4584.0 2292.00 [4,] 3241.3775 4944.0 2472.00 [5,] 3354.5146 5281.0 2640.50 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1521.643 2638.933 1319.466 [2,] 4040.172 6529.067 3264.534 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(354.26049737446, 480.479057816259, 2780.90719927322, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/13ygj1358172377.ps tmp/13ygj1358172377.png",intern=TRUE)) character(0) > try(system("convert tmp/2yr751358172377.ps tmp/2yr751358172377.png",intern=TRUE)) character(0) > try(system("convert tmp/3o6o41358172377.ps tmp/3o6o41358172377.png",intern=TRUE)) character(0) > try(system("convert tmp/41gmp1358172377.ps tmp/41gmp1358172377.png",intern=TRUE)) character(0) > try(system("convert tmp/5lga41358172377.ps tmp/5lga41358172377.png",intern=TRUE)) character(0) > try(system("convert tmp/6nc2f1358172377.ps tmp/6nc2f1358172377.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.306 0.531 3.904