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(1069108,1059362,1049495,1029082,1231089,1220388,1069108,968521,978233,978233,989056,1008514,1069108,1049495,1079775,1129547,1412683,1412683,1352244,1291650,1341422,1401983,1412683,1442964,1533833,1473244,1473244,1564114,1816014,1836427,1785734,1664578,1755420,1755420,1765165,1816014,1856040,1876453,1876453,1937014,2169452,2229890,2239603,2088322,2169452,2139171,2078582,2209478,2239603,2188909,2199610,2269916,2532640,2663352,2663352,2602913,2693660,2602913,2552092,2744509,2774634,2703378,2884967,2956228,3168103,3308711,3289258,3278430,3359559,3349692,3228692,3410253,3470847,3410253,3662154,3783309,4065362,4176650,4146492,4085897,4136624,4197185,3995056,4156204,4257779,4216798,4479366,4570080,4953837,5024138,4933418,4984117,5014398,5044678,4852261,5033856,5134437,5033856,5326854,5417607,5811037,5871631,5891089,5992631,5992631,6032657,5851063,5941938,6002377,5891089,6214246,6274812,6678021,6749283,6849864,6940739,6950451,6961152,6779563,6961152) > 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,] 1069108 1069108 1533833 1856040 2239603 2774634 3470847 4257779 5134437 [2,] 1059362 1049495 1473244 1876453 2188909 2703378 3410253 4216798 5033856 [3,] 1049495 1079775 1473244 1876453 2199610 2884967 3662154 4479366 5326854 [4,] 1029082 1129547 1564114 1937014 2269916 2956228 3783309 4570080 5417607 [5,] 1231089 1412683 1816014 2169452 2532640 3168103 4065362 4953837 5811037 [6,] 1220388 1412683 1836427 2229890 2663352 3308711 4176650 5024138 5871631 [7,] 1069108 1352244 1785734 2239603 2663352 3289258 4146492 4933418 5891089 [8,] 968521 1291650 1664578 2088322 2602913 3278430 4085897 4984117 5992631 [9,] 978233 1341422 1755420 2169452 2693660 3359559 4136624 5014398 5992631 [10,] 978233 1401983 1755420 2139171 2602913 3349692 4197185 5044678 6032657 [11,] 989056 1412683 1765165 2078582 2552092 3228692 3995056 4852261 5851063 [12,] 1008514 1442964 1816014 2209478 2744509 3410253 4156204 5033856 5941938 [,10] [,11] [1,] 6002377 NA [2,] 5891089 NA [3,] 6214246 NA [4,] 6274812 NA [5,] 6678021 NA [6,] 6749283 NA [7,] 6849864 NA [8,] 6940739 NA [9,] 6950451 NA [10,] 6961152 NA [11,] 6779563 NA [12,] 6961152 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/1y97q1404902972.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/2g2h71404902972.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/31xhg1404902972.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/4iiuc1404902972.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,] 1069108 1049495 1049495 1029082 1231089 1220388 1069108 968521 978233 [2,] 1533833 1473244 1473244 1564114 1816014 1836427 1785734 1664578 1755420 [3,] 2507118 2446144 2542288 2613072 2850372 2986032 2976305 2940672 3026610 [4,] 4257779 4216798 4479366 4570080 4953837 5024138 4933418 4984117 5014398 [5,] 6002377 5891089 6214246 6274812 6678021 6749283 6849864 6940739 6950451 [,10] [,11] [,12] [1,] 978233 989056 1008514 [2,] 1755420 1765165 1816014 [3,] 2976302 2890392 3077381 [4,] 5044678 4852261 5033856 [5,] 6961152 6779563 6961152 $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,] 1146126 1075355 1040310 1111172 1282590 1393324 1403597 1282097 1398294 [2,] 3868111 3816932 4044267 4114972 4418153 4578739 4549013 4599246 4654925 [,10] [,11] [,12] [1,] 1332858 1347956 1469619 [2,] 4619747 4432828 4685143 $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(1069108, 1533833, 2507118.5, 4257779, 6002377, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/550a01404902972.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,] 968521.0 1049495 1473244 1856040 2188909 2703378 3410253 4216798 5033856 [2,] 983644.5 1104661 1548974 1906734 2254760 2920598 3722732 4524723 5372230 [3,] 1039288.5 1346833 1755420 2113746 2577502 3253561 4075630 4943628 5861347 [4,] 1069108.0 1412683 1800874 2189465 2663352 3329202 4151348 5019268 5967284 [5,] 1069108.0 1442964 1836427 2239603 2744509 3410253 4197185 5044678 6032657 [,10] [,11] [1,] 5891089 NA [2,] 6244529 NA [3,] 6764423 NA [4,] 6945595 NA [5,] 6961152 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,] 1000308 1206342 1640526 1984791 2391141 3067194 3880135 4718062 5589939 [2,] 1078269 1487324 1870314 2242702 2763864 3439928 4271124 5169193 6132755 [,10] [,11] [1,] 6444662 NA [2,] 7084184 NA $out [1] 1231089 1220388 $group [1] 1 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(968521, 983644.5, 1039288.5, 1069108, 1069108, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6oobr1404902972.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,] 1697489 4841594 2441116 [2,] 1837496 5205240 2708532 [3,] 1949361 5654826 2832415 [4,] 2020956 5962428 2918045 [5,] 2054181 5982919 2989048 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1865684 5309467 2736855 [2,] 2033039 6000184 2927975 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1697489.47418082, 1837496.00191839, 1949361.0956597, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1y97q1404902972.ps tmp/1y97q1404902972.png",intern=TRUE)) character(0) > try(system("convert tmp/2g2h71404902972.ps tmp/2g2h71404902972.png",intern=TRUE)) character(0) > try(system("convert tmp/31xhg1404902972.ps tmp/31xhg1404902972.png",intern=TRUE)) character(0) > try(system("convert tmp/4iiuc1404902972.ps tmp/4iiuc1404902972.png",intern=TRUE)) character(0) > try(system("convert tmp/550a01404902972.ps tmp/550a01404902972.png",intern=TRUE)) character(0) > try(system("convert tmp/6oobr1404902972.ps tmp/6oobr1404902972.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.162 0.362 2.555