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(304040,307100,304330,294710,286890,279050,271860,266710,259590,253830,250640,249140,250840,247590,237830,226380,217230,211420,207620,204310,197490,193580,192330,191970,196070,191940,185620,179410,173920,169190,166840,165170,161450,160830,163670,170830,182690,190940,197770,205090,210720,220210,229730,237070,241620,250370,258570,269860,283220,289610,281770,274700,267650,261380,260500,260730,254200,250450,253380,263740,276240,273820,265890,258400,253520,250710,252850,255260,251170,252500,257780,269900,291590,298870,295570,292100,290870,290580,297970,304010,304340,309850,322320,340170,369280,376690,379700,379520,377770,381560,394580,399320,400370,408200,419070,437730) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 304040 250840 196070 182690 283220 276240 291590 369280 NA [2,] 307100 247590 191940 190940 289610 273820 298870 376690 NA [3,] 304330 237830 185620 197770 281770 265890 295570 379700 NA [4,] 294710 226380 179410 205090 274700 258400 292100 379520 NA [5,] 286890 217230 173920 210720 267650 253520 290870 377770 NA [6,] 279050 211420 169190 220210 261380 250710 290580 381560 NA [7,] 271860 207620 166840 229730 260500 252850 297970 394580 NA [8,] 266710 204310 165170 237070 260730 255260 304010 399320 NA [9,] 259590 197490 161450 241620 254200 251170 304340 400370 NA [10,] 253830 193580 160830 250370 250450 252500 309850 408200 NA [11,] 250640 192330 163670 258570 253380 257780 322320 419070 NA [12,] 249140 191970 170830 269860 263740 269900 340170 437730 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/1xjmr1426160056.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/2t1js1426160056.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/3gpb61426160056.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/4xqae1426160056.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,] 182690 190940 185620 179410 173920 169190 166840 165170 161450 160830 [2,] 223455 219765 217800 215735 213975 215815 218675 220690 219555 221975 [3,] 279730 281715 273830 266550 260585 256045 256675 257995 252685 251475 [4,] 297815 302985 299950 293405 288880 284815 284915 285360 281965 281840 [5,] 369280 376690 379700 379520 377770 381560 297970 304010 304340 309850 [,11] [,12] [1,] 163670 170830 [2,] 221485 220555 [3,] 255580 266800 [4,] 290445 305035 [5,] 322320 340170 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 238191.4 235227.1 227939.8 223162.4 218742 217500.6 219672.4 221869.4 [2,] 321268.6 328202.9 319720.2 309937.6 302428 294589.4 293677.6 294120.6 [,9] [,10] [,11] [,12] [1,] 217821.9 218033.6 217058 219608.3 [2,] 287548.1 284916.4 294102 313991.7 $out [1] 394580 399320 400370 408200 419070 437730 $group [1] 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(182690, 223455, 279730, 297815, 369280, 190940, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5o4zr1426160056.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] [,9] [1,] 249140 191970 160830 182690 250450 250710 290580 369280 NA [2,] 256710 195535 164420 201430 257350 252675 291845 378645 NA [3,] 275455 209520 170010 224970 262560 256520 298420 388070 NA [4,] 299375 232105 182515 245995 278235 267895 307095 404285 NA [5,] 307100 250840 196070 269860 289610 276240 322320 437730 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 255995.2 192840.2 161756.7 204643.6 253034.2 249578.1 291464.4 376375.4 [2,] 294914.8 226199.8 178263.3 245296.4 272085.8 263461.9 305375.6 399764.6 [,9] [1,] NA [2,] NA $out [1] 340170 $group [1] 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(249140, 256710, 275455, 299375, 307100, 191970, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6670p1426160056.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,] 59936.06 185750 31662.5 [2,] 62437.28 197095 43672.5 [3,] 65654.03 220055 55870.0 [4,] 73028.65 243145 68597.5 [5,] 83935.32 266900 72282.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 60823.24 199051.3 44501.54 [2,] 70484.82 241058.7 67238.46 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(59936.0559113985, 62437.2849849788, 65654.0306180336, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xjmr1426160056.ps tmp/1xjmr1426160056.png",intern=TRUE)) character(0) > try(system("convert tmp/2t1js1426160056.ps tmp/2t1js1426160056.png",intern=TRUE)) character(0) > try(system("convert tmp/3gpb61426160056.ps tmp/3gpb61426160056.png",intern=TRUE)) character(0) > try(system("convert tmp/4xqae1426160056.ps tmp/4xqae1426160056.png",intern=TRUE)) character(0) > try(system("convert tmp/5o4zr1426160056.ps tmp/5o4zr1426160056.png",intern=TRUE)) character(0) > try(system("convert tmp/6670p1426160056.ps tmp/6670p1426160056.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.125 0.332 2.467