R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(105.32,106.93,107.99,109.41,111.79,112.7,113.41,115.14,115.6,116.21,116.9,117.31,117.62,118.66,120,120.41,120.8,120.93,121.54,122.04,122.5,123.01,123.79,123.99,124.58,125.77,127.6,130.97,131.79,132.29,132.29,132.65,133.88,134.79,135.9,136.33,136.33,137.91,138.92,140.12,141.92,142.57,143.69,144.61,145.02,146.07,146.77,147.55,148.14,148.62,151.16,152.56,154.55,156.17,158.8,159.39,162.44,166.48,168.3,170.32,170.64,172.85,174.38,177.2,178.96,179.62,180.27,183.38,190.81,193.72,196.86,197.73) > 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,] 105.32 117.62 124.58 136.33 148.14 170.64 NA [2,] 106.93 118.66 125.77 137.91 148.62 172.85 NA [3,] 107.99 120.00 127.60 138.92 151.16 174.38 NA [4,] 109.41 120.41 130.97 140.12 152.56 177.20 NA [5,] 111.79 120.80 131.79 141.92 154.55 178.96 NA [6,] 112.70 120.93 132.29 142.57 156.17 179.62 NA [7,] 113.41 121.54 132.29 143.69 158.80 180.27 NA [8,] 115.14 122.04 132.65 144.61 159.39 183.38 NA [9,] 115.60 122.50 133.88 145.02 162.44 190.81 NA [10,] 116.21 123.01 134.79 146.07 166.48 193.72 NA [11,] 116.90 123.79 135.90 146.77 168.30 196.86 NA [12,] 117.31 123.99 136.33 147.55 170.32 197.73 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/1w4j41335783617.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/2m9lk1335783617.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/35vj61335783617.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/4xfmb1335783617.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,] 105.320 106.93 107.99 109.410 111.790 112.70 113.41 115.14 115.60 116.21 [2,] 117.620 118.66 120.00 120.410 120.800 120.93 121.54 122.04 122.50 123.01 [3,] 130.455 131.84 133.26 135.545 136.855 137.43 137.99 138.63 139.45 140.43 [4,] 148.140 148.62 151.16 152.560 154.550 156.17 158.80 159.39 162.44 166.48 [5,] 170.640 172.85 174.38 177.200 178.960 179.62 180.27 183.38 190.81 193.72 [,11] [,12] [1,] 116.900 117.31 [2,] 123.790 123.99 [3,] 141.335 141.94 [4,] 168.300 170.32 [5,] 196.860 197.73 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 110.7686 112.5148 113.1608 114.8072 115.0852 114.6991 113.9561 114.538 [2,] 150.1414 151.1652 153.3592 156.2828 158.6248 160.1609 162.0239 162.722 [,9] [,10] [,11] [,12] [1,] 113.6874 112.3904 112.6246 112.0557 [2,] 165.2126 168.4696 170.0454 171.8243 $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(105.32, 117.62, 130.455, 148.14, 170.64, 106.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5kglt1335783617.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,] 105.320 117.620 124.580 136.330 148.140 170.640 NA [2,] 108.700 120.205 129.285 139.520 151.860 175.790 NA [3,] 113.055 121.235 132.290 143.130 157.485 179.945 NA [4,] 115.905 122.755 134.335 145.545 164.460 192.265 NA [5,] 117.310 123.990 136.330 147.550 170.320 197.730 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 109.7688 120.0719 129.9867 140.382 151.7381 172.4306 NA [2,] 116.3412 122.3981 134.5933 145.878 163.2319 187.4594 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(105.32, 108.7, 113.055, 115.905, 117.31, 117.62, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/61xq01335783617.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,] 23.35435 65.320 25.50500 [2,] 23.97375 66.625 26.30000 [3,] 24.66218 67.480 29.89750 [4,] 28.51083 76.360 34.08125 [5,] 30.40212 80.420 37.55250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 22.59279 63.0398 26.34842 [2,] 26.73157 71.9202 33.44658 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(23.3543507010293, 23.9737536285655, 24.6621815049231, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1w4j41335783617.ps tmp/1w4j41335783617.png",intern=TRUE)) character(0) > try(system("convert tmp/2m9lk1335783617.ps tmp/2m9lk1335783617.png",intern=TRUE)) character(0) > try(system("convert tmp/35vj61335783617.ps tmp/35vj61335783617.png",intern=TRUE)) character(0) > try(system("convert tmp/4xfmb1335783617.ps tmp/4xfmb1335783617.png",intern=TRUE)) character(0) > try(system("convert tmp/5kglt1335783617.ps tmp/5kglt1335783617.png",intern=TRUE)) character(0) > try(system("convert tmp/61xq01335783617.ps tmp/61xq01335783617.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.631 0.449 2.081