R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(1516,1289,1428,1335,1402,1475,1582,1317,1450,1497,1556,981,1807,1573,1756,1708,1737,1679,1872,1598,1747,1882,1369,865,1432,1172,1268,1120,1235,1272,1360,1069,1434,1552,1584,1070,1676,1690,1643,1446,1566,1352,1805,1613,1824,1866,1774,1505,1972,1856,2037,1888,2167,2191,2036,2103,2131,2039,1983,1629,2032,2216,2141,2073,2145,2429,2157,1994,2116,2287,2162,1699) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1516 1807 1432 1676 1972 2032 NA [2,] 1289 1573 1172 1690 1856 2216 NA [3,] 1428 1756 1268 1643 2037 2141 NA [4,] 1335 1708 1120 1446 1888 2073 NA [5,] 1402 1737 1235 1566 2167 2145 NA [6,] 1475 1679 1272 1352 2191 2429 NA [7,] 1582 1872 1360 1805 2036 2157 NA [8,] 1317 1598 1069 1613 2103 1994 NA [9,] 1450 1747 1434 1824 2131 2116 NA [10,] 1497 1882 1552 1866 2039 2287 NA [11,] 1556 1369 1584 1774 1983 2162 NA [12,] 981 865 1070 1505 1629 1699 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/1sjkz1398719145.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/2i8rg1398719145.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/3815t1398719145.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/4yv9o1398719145.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,] 1432.0 1172.0 1268.0 1120 1235.0 1272 1360.0 1069.0 1434.0 1497 1369 [2,] 1516.0 1289.0 1428.0 1335 1402.0 1352 1582.0 1317.0 1450.0 1552 1556 [3,] 1741.5 1631.5 1699.5 1577 1651.5 1577 1838.5 1605.5 1785.5 1874 1679 [4,] 1972.0 1856.0 2037.0 1888 2145.0 2191 2036.0 1994.0 2116.0 2039 1983 [5,] 2032.0 2216.0 2141.0 2073 2167.0 2429 2157.0 2103.0 2131.0 2287 2162 [,12] [1,] 865.0 [2,] 981.0 [3,] 1287.5 [4,] 1629.0 [5,] 1699.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1447.365 1265.767 1306.675 1220.297 1172.241 1035.818 1545.655 1168.813 [2,] 2035.635 1997.233 2092.325 1933.703 2130.759 2118.182 2131.345 2042.187 [,9] [,10] [,11] [,12] [1,] 1355.908 1559.869 1403.571 869.5191 [2,] 2215.092 2188.131 1954.429 1705.4809 $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(1432, 1516, 1741.5, 1972, 2032, 1172, 1289, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5zg1w1398719145.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] [1,] 1289.0 1369.0 1069 1352.0 1856.0 1994.0 NA [2,] 1326.0 1585.5 1146 1535.5 1930.0 2052.5 NA [3,] 1439.0 1722.5 1270 1659.5 2036.5 2143.0 NA [4,] 1506.5 1781.5 1433 1789.5 2117.0 2189.0 NA [5,] 1582.0 1882.0 1584 1866.0 2191.0 2287.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1356.673 1633.103 1139.097 1543.649 1951.208 2080.741 NA [2,] 1521.327 1811.897 1400.903 1775.351 2121.792 2205.259 NA $out [1] 981 865 1629 2429 1699 $group [1] 1 2 5 6 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1289, 1326, 1439, 1506.5, 1582, 1369, 1585.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6w0bl1398719145.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,] 241.9541 600.0 357.250 [2,] 295.8679 791.5 372.000 [3,] 348.6720 853.5 482.625 [4,] 383.0552 993.5 556.750 [5,] 473.5698 1157.0 680.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 308.9052 761.3664 398.3593 [2,] 388.4387 945.6336 566.8907 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(241.954059000188, 295.867882900682, 348.671979472334, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1sjkz1398719145.ps tmp/1sjkz1398719145.png",intern=TRUE)) character(0) > try(system("convert tmp/2i8rg1398719145.ps tmp/2i8rg1398719145.png",intern=TRUE)) character(0) > try(system("convert tmp/3815t1398719145.ps tmp/3815t1398719145.png",intern=TRUE)) character(0) > try(system("convert tmp/4yv9o1398719145.ps tmp/4yv9o1398719145.png",intern=TRUE)) character(0) > try(system("convert tmp/5zg1w1398719145.ps tmp/5zg1w1398719145.png",intern=TRUE)) character(0) > try(system("convert tmp/6w0bl1398719145.ps tmp/6w0bl1398719145.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.232 1.038 6.259