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(1196,1141,6081,-3508,1782,-891,-2043,35,5042,-1837,406,-3621,1987,1627,6692,-3999,679,-215,-2820,799,9957,5154,1302,6287,1891,2191,7336,-2351,881,388,-1936,1120,4438,-3495,1012,-3704,2879,1907,6451,-2814,1613,-40,-3086,292,5283,-1671,3529,-3191,2090,3278,5686,-1817,2322,-705,-1980,646,6077,2632,2356,-1717,1733,2232,6167,-4668,1694,589,-4163,174,5421,-38,3158,-4322,1920,2527,7755,-2567,-388,-2084,-2024,-131,5615,187,2054,-7172) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1196 1987 1891 2879 2090 1733 1920 NA [2,] 1141 1627 2191 1907 3278 2232 2527 NA [3,] 6081 6692 7336 6451 5686 6167 7755 NA [4,] -3508 -3999 -2351 -2814 -1817 -4668 -2567 NA [5,] 1782 679 881 1613 2322 1694 -388 NA [6,] -891 -215 388 -40 -705 589 -2084 NA [7,] -2043 -2820 -1936 -3086 -1980 -4163 -2024 NA [8,] 35 799 1120 292 646 174 -131 NA [9,] 5042 9957 4438 5283 6077 5421 5615 NA [10,] -1837 5154 -3495 -1671 2632 -38 187 NA [11,] 406 1302 1012 3529 2356 3158 2054 NA [12,] -3621 6287 -3704 -3191 -1717 -4322 -7172 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/1sls31419514991.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/2vnks1419514991.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/3j8y01419514991.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/42t4h1419514991.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,] 1733.0 1141.0 5686 -4668.0 -388 -2084 -4163 -131.0 4438.0 -3495.0 406 [2,] 1812.0 1767.0 6124 -3753.5 780 -798 -2953 104.5 5162.5 -1754.0 1157 [3,] 1920.0 2191.0 6451 -2814.0 1613 -215 -2043 292.0 5421.0 -38.0 2054 [4,] 2038.5 2379.5 7014 -2459.0 1738 174 -2002 722.5 5846.0 1409.5 2757 [5,] 2090.0 3278.0 7755 -1817.0 2322 589 -1936 1120.0 6077.0 5154.0 3529 [,12] [1,] -4322 [2,] -4013 [3,] -3621 [4,] -2454 [5,] -1717 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1784.738 1825.225 5919.506 -3587.055 1040.898 -795.4627 -2610.922 [2,] 2055.262 2556.775 6982.494 -2040.945 2185.102 365.4627 -1475.078 [,8] [,9] [,10] [,11] [,12] [1,] -77.05963 5012.825 -1927.191 1098.506 -4552.01 [2,] 661.05963 5829.175 1851.191 3009.494 -2689.99 $out [1] 1196 2879 9957 6287 -7172 $group [1] 1 1 9 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1733, 1812, 1920, 2038.5, 2090, 1141, 1767, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/587961419514991.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] [1,] -3621.0 -3999.0 -3704.0 -3191.0 -1980 -4668.0 -7172.0 NA [2,] -1940.0 232.0 -2143.5 -2242.5 -1211 -2100.5 -2054.0 NA [3,] 220.5 1464.5 946.5 952.5 2206 1141.5 28.0 NA [4,] 1489.0 5720.5 2041.0 3204.0 2955 2695.0 2290.5 NA [5,] 6081.0 9957.0 7336.0 6451.0 6077 6167.0 7755.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -1343.49 -1038.842 -962.0785 -1531.685 305.8594 -1045.76 -1953.556 NA [2,] 1784.49 3967.842 2855.0785 3436.685 4106.1406 3328.76 2009.556 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(-3621, -1940, 220.5, 1489, 6081, -3999, 232, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6hila1419514991.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,] 449.7109 1251.0 226.50 [2,] 704.8223 2103.0 650.75 [3,] 905.1539 2691.5 954.50 [4,] 1483.5870 4321.0 1426.75 [5,] 1826.4244 5519.0 1600.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 549.9541 1679.855 600.5612 [2,] 1260.3537 3703.145 1308.4388 $out [1] 2937.836 4206.244 8649.000 13459.000 3163.500 $group [1] 1 1 2 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(449.710912433649, 704.822296928825, 905.153861531459, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1sls31419514991.ps tmp/1sls31419514991.png",intern=TRUE)) character(0) > try(system("convert tmp/2vnks1419514991.ps tmp/2vnks1419514991.png",intern=TRUE)) character(0) > try(system("convert tmp/3j8y01419514991.ps tmp/3j8y01419514991.png",intern=TRUE)) character(0) > try(system("convert tmp/42t4h1419514991.ps tmp/42t4h1419514991.png",intern=TRUE)) character(0) > try(system("convert tmp/587961419514991.ps tmp/587961419514991.png",intern=TRUE)) character(0) > try(system("convert tmp/6hila1419514991.ps tmp/6hila1419514991.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.178 0.402 2.604