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(2011,2203,2523,2565,2596,2545,1935,2386,2478,2457,2194,1736,1881,2520,2381,2419,2541,2514,1737,2221,2648,2159,2184,1745,1770,1871,2137,2283,2042,2099,1653,2254,2302,2233,1974,1684,1842,1592,2175,2366,2569,2894,2159,2877,2419,2305,1812,1514,1557,1606,1988,1901,1993,1993,1420,1927,2029,1899,1759,1496,2091,1850,2326,2212,2083,2048,1642,2014,1844,1846,1743,1337,1682,1512,2050,2108,1948,1927,1641,1916,1921,1858,1823,1367) > 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,] 2011 1881 1770 1842 1557 2091 1682 NA [2,] 2203 2520 1871 1592 1606 1850 1512 NA [3,] 2523 2381 2137 2175 1988 2326 2050 NA [4,] 2565 2419 2283 2366 1901 2212 2108 NA [5,] 2596 2541 2042 2569 1993 2083 1948 NA [6,] 2545 2514 2099 2894 1993 2048 1927 NA [7,] 1935 1737 1653 2159 1420 1642 1641 NA [8,] 2386 2221 2254 2877 1927 2014 1916 NA [9,] 2478 2648 2302 2419 2029 1844 1921 NA [10,] 2457 2159 2233 2305 1899 1846 1858 NA [11,] 2194 2184 1974 1812 1759 1743 1823 NA [12,] 1736 1745 1684 1514 1496 1337 1367 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/1cn0d1416751776.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/2mfue1416751776.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/348p51416751776.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/4r3911416751776.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,] 1557 1512 1988.0 1901.0 1948.0 1927.0 1420.0 1916.0 1844.0 1846.0 1743.0 [2,] 1726 1599 2093.5 2160.0 2017.5 2020.5 1641.5 1970.5 1975.0 1878.5 1785.5 [3,] 1842 1850 2175.0 2283.0 2083.0 2099.0 1653.0 2221.0 2302.0 2159.0 1823.0 [4,] 1946 2037 2353.5 2392.5 2555.0 2529.5 1836.0 2320.0 2448.5 2269.0 2079.0 [5,] 2091 2520 2523.0 2565.0 2596.0 2894.0 1935.0 2386.0 2648.0 2457.0 2194.0 [,12] [1,] 1337.0 [2,] 1431.5 [3,] 1514.0 [4,] 1710.0 [5,] 1745.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1710.62 1588.433 2019.732 2144.155 1762.014 1795.033 1536.848 2012.284 [2,] 1973.38 2111.567 2330.268 2421.845 2403.986 2402.967 1769.152 2429.716 [,9] [,10] [,11] [,12] [1,] 2019.233 1925.8 1647.727 1347.684 [2,] 2584.767 2392.2 1998.273 1680.316 $out [1] 2159 2877 $group [1] 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1557, 1726, 1842, 1946, 2091, 1512, 1599, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/59mva1416751776.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,] 1736.0 1737 1653.0 1514 1420.0 1642.0 1367.0 NA [2,] 2102.5 2020 1820.5 1827 1581.5 1793.5 1661.5 NA [3,] 2421.5 2301 2070.5 2240 1900.0 1932.0 1887.0 NA [4,] 2534.0 2517 2243.5 2494 1990.5 2087.0 1937.5 NA [5,] 2596.0 2648 2302.0 2894 2029.0 2326.0 2108.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2224.69 2074.315 1877.567 1935.777 1713.452 1798.133 1761.115 NA [2,] 2618.31 2527.685 2263.433 2544.223 2086.548 2065.867 2012.885 NA $out [1] 1337 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(1736, 2102.5, 2421.5, 2534, 2596, 1737, 2020, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/607st1416751776.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,] 170.0622 408.0 194.50 [2,] 192.7926 534.5 246.25 [3,] 240.9325 656.0 321.50 [4,] 321.4110 882.5 455.75 [5,] 367.0488 1008.0 537.50 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 182.2688 497.2749 225.9456 [2,] 299.5963 814.7251 417.0544 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(170.0621735047, 192.792575959086, 240.932524437998, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1cn0d1416751776.ps tmp/1cn0d1416751776.png",intern=TRUE)) character(0) > try(system("convert tmp/2mfue1416751776.ps tmp/2mfue1416751776.png",intern=TRUE)) character(0) > try(system("convert tmp/348p51416751776.ps tmp/348p51416751776.png",intern=TRUE)) character(0) > try(system("convert tmp/4r3911416751776.ps tmp/4r3911416751776.png",intern=TRUE)) character(0) > try(system("convert tmp/59mva1416751776.ps tmp/59mva1416751776.png",intern=TRUE)) character(0) > try(system("convert tmp/607st1416751776.ps tmp/607st1416751776.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.059 0.422 2.507