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(250.8,247.6,237.8,226.4,217.2,211.4,207.6,204.3,197.5,193.6,192.3,192,196.1,191.9,185.6,179.4,173.9,169.2,166.8,165.2,161.4,160.8,163.7,170.8,182.7,190.9,197.8,205.1,210.7,220.2,229.7,237.1,241.6,250.4,258.6,269.9,283.2,289.6,281.8,274.7,267.6,261.4,260.5,260.7,254.2,250.5,253.4,263.7,276.2,273.8,265.9,258.4,253.5,250.7,252.8,255.3,251.2,252.5,257.8,269.9,291.6,298.9,295.6,292.1,290.9,290.6,298,304,304.3,309.8,322.3,340.2,369.3,376.7,379.7,379.5,377.8,381.6,394.6,399.3,400.4,408.2,419.1,437.7) > 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,] 250.8 196.1 182.7 283.2 276.2 291.6 369.3 NA [2,] 247.6 191.9 190.9 289.6 273.8 298.9 376.7 NA [3,] 237.8 185.6 197.8 281.8 265.9 295.6 379.7 NA [4,] 226.4 179.4 205.1 274.7 258.4 292.1 379.5 NA [5,] 217.2 173.9 210.7 267.6 253.5 290.9 377.8 NA [6,] 211.4 169.2 220.2 261.4 250.7 290.6 381.6 NA [7,] 207.6 166.8 229.7 260.5 252.8 298.0 394.6 NA [8,] 204.3 165.2 237.1 260.7 255.3 304.0 399.3 NA [9,] 197.5 161.4 241.6 254.2 251.2 304.3 400.4 NA [10,] 193.6 160.8 250.4 250.5 252.5 309.8 408.2 NA [11,] 192.3 163.7 258.6 253.4 257.8 322.3 419.1 NA [12,] 192.0 170.8 269.9 263.7 269.9 340.2 437.7 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/1ktj51416557697.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/2g5et1416557697.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/34ug91416557697.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/4jqhj1416557697.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] [1,] 182.70 190.90 185.6 179.40 173.90 169.2 166.80 165.20 161.40 160.80 163.70 [2,] 223.45 219.75 217.8 215.75 213.95 215.8 218.65 220.70 219.55 222.00 222.85 [3,] 276.20 273.80 265.9 258.40 253.50 250.7 252.80 255.30 251.20 250.50 257.80 [4,] 287.40 294.25 288.7 283.40 279.25 276.0 279.25 282.35 279.25 281.15 290.45 [5,] 369.30 376.70 379.7 379.50 290.90 290.6 298.00 304.00 304.30 309.80 322.30 [,12] [1,] 170.80 [2,] 227.85 [3,] 269.90 [4,] 305.05 [5,] 340.20 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 238.0101 229.3098 223.5597 218.0005 214.5039 214.7495 216.6107 218.4836 [2,] 314.3899 318.2902 308.2403 298.7995 292.4961 286.6505 288.9893 292.1164 [,9] [,10] [,11] [,12] [1,] 215.5481 215.1766 217.4304 223.7974 [2,] 286.8519 285.8234 298.1696 316.0026 $out [1] 377.8 381.6 394.6 399.3 400.4 408.2 419.1 437.7 $group [1] 5 6 7 8 9 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(182.7, 223.45, 276.2, 287.4, 369.3, 190.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5931s1416557697.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,] 192.00 160.80 182.70 250.50 250.70 290.60 369.30 NA [2,] 195.55 164.45 201.45 257.35 252.65 291.85 378.65 NA [3,] 209.50 170.00 224.95 262.55 256.55 298.45 388.10 NA [4,] 232.10 182.50 246.00 278.25 267.90 307.05 404.30 NA [5,] 250.80 196.10 269.90 289.60 276.20 322.30 437.70 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 192.8293 161.7673 204.6304 253.0174 249.5944 291.5172 376.4009 NA [2,] 226.1707 178.2327 245.2696 272.0826 263.5056 305.3828 399.7991 NA $out [1] 340.2 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(192, 195.55, 209.5, 232.1, 250.8, 160.8, 164.45, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6tgvz1416557697.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,] 62.93006 185.8 59.150 [2,] 65.88150 197.1 60.400 [3,] 70.53720 220.1 64.625 [4,] 78.86306 243.2 69.275 [5,] 89.99631 266.9 77.200 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 64.61622 199.0735 60.57705 [2,] 76.45818 241.1265 68.67295 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(62.9300594386529, 65.8814962631598, 70.5371957324911, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ktj51416557697.ps tmp/1ktj51416557697.png",intern=TRUE)) character(0) > try(system("convert tmp/2g5et1416557697.ps tmp/2g5et1416557697.png",intern=TRUE)) character(0) > try(system("convert tmp/34ug91416557697.ps tmp/34ug91416557697.png",intern=TRUE)) character(0) > try(system("convert tmp/4jqhj1416557697.ps tmp/4jqhj1416557697.png",intern=TRUE)) character(0) > try(system("convert tmp/5931s1416557697.ps tmp/5931s1416557697.png",intern=TRUE)) character(0) > try(system("convert tmp/6tgvz1416557697.ps tmp/6tgvz1416557697.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.052 0.402 2.478