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(6195800,6172725,6149325,6100900,6579950,6554600,6195800,5957250,5980325,5980325,6006000,6052150,6123975,6123975,6077825,5957250,6579950,6674850,6531525,6195800,6339450,6123975,6221150,6267625,6316050,6195800,6221150,6052150,6579950,6746675,6603350,6339450,6626425,6316050,6603350,6579950,6651775,6387875,6674850,6651775,7082400,6985225,6603350,6410950,6674850,6316050,6579950,6626425,6723600,6508450,6626425,6698250,6962150,6746675,6459700,6149325,6436625,5646875,6029075,6244225,6459700,6149325,6149325,6149325,6316050,6077825,5765175,5503550,5693350,4952350,5406375,5670275,5718700,5454800,5477875,5406375,5646875,5477875,5144750,4903925,5311150,4426825,5001100,5262725,5262725,4952350,4665375,4642300,4903925,4665375,4211675,3899025,4234750,3445325,4162925,4544800,4665375,4401475,4068025,4306575,4401475,4329650,3611725,3278600,3516825,2799225,3540225,3804125,4019275,3660475,3324750,3516825,3611725,3421925,2704325,2391675,2678650,1889225,2750475,3278600) > 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,] 6195800 6123975 6316050 6651775 6723600 6459700 5718700 5262725 4665375 [2,] 6172725 6123975 6195800 6387875 6508450 6149325 5454800 4952350 4401475 [3,] 6149325 6077825 6221150 6674850 6626425 6149325 5477875 4665375 4068025 [4,] 6100900 5957250 6052150 6651775 6698250 6149325 5406375 4642300 4306575 [5,] 6579950 6579950 6579950 7082400 6962150 6316050 5646875 4903925 4401475 [6,] 6554600 6674850 6746675 6985225 6746675 6077825 5477875 4665375 4329650 [7,] 6195800 6531525 6603350 6603350 6459700 5765175 5144750 4211675 3611725 [8,] 5957250 6195800 6339450 6410950 6149325 5503550 4903925 3899025 3278600 [9,] 5980325 6339450 6626425 6674850 6436625 5693350 5311150 4234750 3516825 [10,] 5980325 6123975 6316050 6316050 5646875 4952350 4426825 3445325 2799225 [11,] 6006000 6221150 6603350 6579950 6029075 5406375 5001100 4162925 3540225 [12,] 6052150 6267625 6579950 6626425 6244225 5670275 5262725 4544800 3804125 [,10] [,11] [1,] 4019275 NA [2,] 3660475 NA [3,] 3324750 NA [4,] 3516825 NA [5,] 3611725 NA [6,] 3421925 NA [7,] 2704325 NA [8,] 2391675 NA [9,] 2678650 NA [10,] 1889225 NA [11,] 2750475 NA [12,] 3278600 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/1ble61439548158.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/2bzr41439548158.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/3m4an1439548158.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/4253b1439548158.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,] 4019275 3660475 3324750 3516825 3611725 3421925 2704325 2391675 2678650 [2,] 5262725 4952350 4665375 4642300 4903925 4665375 4211675 3899025 4234750 [3,] 6159888 6136650 6113575 6004700 6448000 6316212 5980488 5730400 5836838 [4,] 6459700 6195800 6221150 6149325 6579950 6746675 6531525 6195800 6436625 [5,] 6723600 6508450 6674850 6698250 7082400 6985225 6603350 6410950 6674850 [,10] [,11] [,12] [1,] 1889225 2750475 3278600 [2,] 3445325 4162925 4544800 [3,] 5299612 5706188 5861212 [4,] 6123975 6221150 6267625 [5,] 6316050 6603350 6626425 $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,] 5561831 5515373 5336248 5251730 5610591 5276312 4821398 4582840 4736693 [2,] 6757944 6757927 6890902 6757670 7285409 7356113 7139577 6877960 6936982 [,10] [,11] [,12] [1,] 3961252 4677816 5000420 [2,] 6637973 6734559 6722005 $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(4019275, 5262725, 6159887.5, 6459700, 6723600, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5mvhe1439548158.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,] 5957250 5957250 6052150 6316050 5646875 4952350 4903925 3445325 2799225 [2,] 5993162 6123975 6268600 6495450 6196775 5586912 5072925 4187300 3528525 [3,] 6125112 6208475 6459700 6639100 6484075 5921500 5358762 4593550 3936075 [4,] 6195800 6435488 6603350 6674850 6710925 6149325 5477875 4784650 4365562 [5,] 6195800 6674850 6746675 6674850 6962150 6459700 5718700 5262725 4665375 [,10] [,11] [1,] 1889225 NA [2,] 2691488 NA [3,] 3301675 NA [4,] 3564275 NA [5,] 4019275 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,] 6032688 6066392 6307018 6557274 6249568 5664980 5174062 4321095 3554297 [2,] 6217537 6350558 6612382 6720926 6718582 6178020 5543463 4866005 4317853 [,10] [,11] [1,] 2903591 NA [2,] 3699759 NA $out [1] 6579950 6554600 7082400 6985225 4426825 $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(5957250, 5993162.5, 6125112.5, 6195800, 6195800, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6rni01439548158.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,] 900212.3 2704325 1047069 [2,] 1103339.2 3264625 1319297 [3,] 1212003.5 3516988 1669078 [4,] 1410401.3 3947612 1971206 [5,] 1596257.4 4426825 2397362 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1071950 3205472 1371738 [2,] 1352057 3828503 1966418 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(900212.324372083, 1103339.2167849, 1212003.5406105, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ble61439548158.ps tmp/1ble61439548158.png",intern=TRUE)) character(0) > try(system("convert tmp/2bzr41439548158.ps tmp/2bzr41439548158.png",intern=TRUE)) character(0) > try(system("convert tmp/3m4an1439548158.ps tmp/3m4an1439548158.png",intern=TRUE)) character(0) > try(system("convert tmp/4253b1439548158.ps tmp/4253b1439548158.png",intern=TRUE)) character(0) > try(system("convert tmp/5mvhe1439548158.ps tmp/5mvhe1439548158.png",intern=TRUE)) character(0) > try(system("convert tmp/6rni01439548158.ps tmp/6rni01439548158.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.142 0.395 2.554