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(5204472,5185089,5165433,5124756,5527158,5505864,5204472,5004090,5023473,5023473,5045040,5083806,5144139,5144139,5105373,5004090,5527158,5606874,5486481,5204472,5325138,5144139,5225766,5264805,5305482,5204472,5225766,5083806,5527158,5667207,5546814,5325138,5566197,5305482,5546814,5527158,5587491,5365815,5606874,5587491,5949216,5867589,5546814,5385198,5606874,5305482,5527158,5566197,5647824,5467098,5566197,5626530,5848206,5667207,5426148,5165433,5406765,4743375,5064423,5245149,5426148,5165433,5165433,5165433,5305482,5105373,4842747,4622982,4782414,4159974,4541355,4763031,4803708,4582032,4601415,4541355,4743375,4601415,4321590,4119297,4461366,3718533,4200924,4420689,4420689,4159974,3918915,3899532,4119297,3918915,3537807,3275181,3557190,2894073,3496857,3817632,3918915,3697239,3417141,3617523,3697239,3636906,3033849,2754024,2954133,2351349,2973789,3195465,3376191,3074799,2792790,2954133,3033849,2874417,2271633,2009007,2250066,1586949,2310399,2754024) > 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] 120 > (np <- floor(n / par1)) [1] 10 > 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] 10 10 10 10 10 10 10 10 10 10 10 10 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 5204472 5144139 5305482 5587491 5647824 5426148 4803708 4420689 3918915 [2,] 5185089 5144139 5204472 5365815 5467098 5165433 4582032 4159974 3697239 [3,] 5165433 5105373 5225766 5606874 5566197 5165433 4601415 3918915 3417141 [4,] 5124756 5004090 5083806 5587491 5626530 5165433 4541355 3899532 3617523 [5,] 5527158 5527158 5527158 5949216 5848206 5305482 4743375 4119297 3697239 [6,] 5505864 5606874 5667207 5867589 5667207 5105373 4601415 3918915 3636906 [7,] 5204472 5486481 5546814 5546814 5426148 4842747 4321590 3537807 3033849 [8,] 5004090 5204472 5325138 5385198 5165433 4622982 4119297 3275181 2754024 [9,] 5023473 5325138 5566197 5606874 5406765 4782414 4461366 3557190 2954133 [10,] 5023473 5144139 5305482 5305482 4743375 4159974 3718533 2894073 2351349 [11,] 5045040 5225766 5546814 5527158 5064423 4541355 4200924 3496857 2973789 [12,] 5083806 5264805 5527158 5566197 5245149 4763031 4420689 3817632 3195465 [,10] [,11] [1,] 3376191 NA [2,] 3074799 NA [3,] 2792790 NA [4,] 2954133 NA [5,] 3033849 NA [6,] 2874417 NA [7,] 2271633 NA [8,] 2009007 NA [9,] 2250066 NA [10,] 1586949 NA [11,] 2310399 NA [12,] 2754024 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/12wkl1439735691.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/288mx1439735691.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/31w6h1439735691.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/4w74i1439735691.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] [1,] 3376191 3074799 2792790 2954133 3033849 2874417 2271633 2009007 2250066 [2,] 4420689 4159974 3918915 3899532 4119297 3918915 3537807 3275181 3557190 [3,] 5174306 5154786 5135403 5043948 5416320 5305618 5023610 4813536 4902944 [4,] 5426148 5204472 5225766 5165433 5527158 5667207 5486481 5204472 5406765 [5,] 5647824 5467098 5606874 5626530 5949216 5867589 5546814 5385198 5606874 [,10] [,11] [,12] [1,] 1586949 2310399 2754024 [2,] 2894073 3496857 3817632 [3,] 4451674 4793198 4923418 [4,] 5144139 5225766 5264805 [5,] 5305482 5546814 5566197 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 4671938 4632913 4482448 4411453 4712897 4432102 4049974 3849585 3978822 [2,] 5676673 5676659 5788358 5676443 6119743 6179135 5997245 5777487 5827065 [,10] [,11] [,12] [1,] 3327452 3929366 4200353 [2,] 5575897 5657029 5646484 $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(3376191, 4420689, 5174305.5, 5426148, 5647824, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/52n3m1439735691.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,] 5004090 5004090 5083806 5305482 4743375 4159974 4119297 2894073 2351349 [2,] 5034256 5144139 5265624 5456178 5205291 4693006 4261257 3517332 2963961 [3,] 5145094 5215119 5426148 5576844 5446623 4974060 4501360 3858582 3306303 [4,] 5204472 5405810 5546814 5606874 5637177 5165433 4601415 4019106 3667072 [5,] 5204472 5606874 5667207 5606874 5848206 5426148 4803708 4420689 3918915 [,10] [,11] [1,] 1586949 NA [2,] 2260850 NA [3,] 2773407 NA [4,] 2993991 NA [5,] 3376191 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 5067458 5095769 5297895 5508111 5249637 4758583 4346212 3629720 2985609 [2,] 5222731 5334469 5554401 5645577 5643609 5189537 4656509 4087444 3626997 [,10] [,11] [1,] 2439016 NA [2,] 3107798 NA $out [1] 5527158 5505864 5949216 5867589 3718533 $group [1] 1 1 4 4 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(5004090, 5034256.5, 5145094.5, 5204472, 5204472, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6mtna1439735691.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,] 756178.4 2271633 879537.8 [2,] 926804.9 2742285 1108209.4 [3,] 1018083.0 2954270 1402025.6 [4,] 1184737.1 3315994 1655813.2 [5,] 1340856.2 3718533 2013784.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 900438.4 2692597 1152260 [2,] 1135727.6 3215942 1651791 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(756178.35247255, 926804.942099316, 1018082.97411282, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/12wkl1439735691.ps tmp/12wkl1439735691.png",intern=TRUE)) character(0) > try(system("convert tmp/288mx1439735691.ps tmp/288mx1439735691.png",intern=TRUE)) character(0) > try(system("convert tmp/31w6h1439735691.ps tmp/31w6h1439735691.png",intern=TRUE)) character(0) > try(system("convert tmp/4w74i1439735691.ps tmp/4w74i1439735691.png",intern=TRUE)) character(0) > try(system("convert tmp/52n3m1439735691.ps tmp/52n3m1439735691.png",intern=TRUE)) character(0) > try(system("convert tmp/6mtna1439735691.ps tmp/6mtna1439735691.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.098 0.322 2.456