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(15071,14236,14771,14804,15597,15418,16903,16350,16393,15685,14556,14850,15391,13704,15409,15098,15254,15522,16669,16238,16246,15424,14952,15008,14929,13905,14994,14753,15031,15386,16160,16116,16219,16064,15436,15404,15112,14119,14775,14289,15121,15371,15782,16104,15674,15105,14223,14385,14558,13804,14672,14244,15089,14580,15218,15696,15129,15110,14204,13655,14534,12746,14074,13699,14184,14110,15820,15362,14993,14437,13694,13688) > 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,] 15071 15391 14929 15112 14558 14534 NA [2,] 14236 13704 13905 14119 13804 12746 NA [3,] 14771 15409 14994 14775 14672 14074 NA [4,] 14804 15098 14753 14289 14244 13699 NA [5,] 15597 15254 15031 15121 15089 14184 NA [6,] 15418 15522 15386 15371 14580 14110 NA [7,] 16903 16669 16160 15782 15218 15820 NA [8,] 16350 16238 16116 16104 15696 15362 NA [9,] 16393 16246 16219 15674 15129 14993 NA [10,] 15685 15424 16064 15105 15110 14437 NA [11,] 14556 14952 15436 14223 14204 13694 NA [12,] 14850 15008 15404 14385 13655 13688 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/1xvtf1426146746.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/2dine1426146746.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/3o95g1426146746.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/4b9ln1426146746.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,] 14534 13704.0 14672 13699 15031 14110.0 15218 15362 14993.0 14437 13694.0 [2,] 14558 13704.0 14672 14244 15031 14580.0 15782 15696 15129.0 15105 14204.0 [3,] 15000 13854.5 14773 14521 15105 15378.5 15990 16110 15946.5 15267 14389.5 [4,] 15112 14119.0 14994 14804 15254 15418.0 16669 16238 16246.0 15685 14952.0 [5,] 15391 14236.0 15409 15098 15254 15522.0 16903 16350 16393.0 16064 15436.0 [,12] [1,] 13655.0 [2,] 13688.0 [3,] 14617.5 [4,] 15008.0 [5,] 15404.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 14642.65 13586.81 14565.3 14159.78 14961.16 14837.96 15417.86 15760.39 [2,] 15357.35 14122.19 14980.7 14882.22 15248.84 15919.04 16562.14 16459.61 [,9] [,10] [,11] [,12] [1,] 15226 14892.88 13907.02 13766.06 [2,] 16667 15641.12 14871.98 15468.94 $out [1] 12746 14074 15597 14184 $group [1] 2 3 5 5 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(14534, 14558, 15000, 15112, 15391, 13704, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5oyvi1426146746.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,] 14236.0 14952 13905.0 14119.0 13655.0 12746.0 NA [2,] 14787.5 15053 14961.5 14337.0 14224.0 13696.5 NA [3,] 15244.5 15400 15395.0 15108.5 14626.0 14147.0 NA [4,] 16017.5 15880 16090.0 15522.5 15119.5 14763.5 NA [5,] 16903.0 16669 16219.0 16104.0 15696.0 15820.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 14683.49 15022.8 14880.28 14567.79 14217.56 13660.33 NA [2,] 15805.51 15777.2 15909.72 15649.21 15034.44 14633.67 NA $out [1] 13704 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(14236, 14787.5, 15244.5, 16017.5, 16903, 14952, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6dd1t1426146746.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,] 334.8700 988.0 175.25 [2,] 452.3947 1367.0 373.00 [3,] 545.2907 1412.5 524.75 [4,] 611.2721 1656.0 697.25 [5,] 718.9377 1749.0 1106.25 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 472.8257 1280.685 376.8574 [2,] 617.7558 1544.315 672.6426 $out [1] 857 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(334.869974766326, 452.394694076714, 545.290739943348, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xvtf1426146746.ps tmp/1xvtf1426146746.png",intern=TRUE)) character(0) > try(system("convert tmp/2dine1426146746.ps tmp/2dine1426146746.png",intern=TRUE)) character(0) > try(system("convert tmp/3o95g1426146746.ps tmp/3o95g1426146746.png",intern=TRUE)) character(0) > try(system("convert tmp/4b9ln1426146746.ps tmp/4b9ln1426146746.png",intern=TRUE)) character(0) > try(system("convert tmp/5oyvi1426146746.ps tmp/5oyvi1426146746.png",intern=TRUE)) character(0) > try(system("convert tmp/6dd1t1426146746.ps tmp/6dd1t1426146746.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.139 0.422 2.559