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(299.81,299.01,296.82,296.67,296.95,296.80,296.80,295.93,293.77,291.02,288.61,284.55,284.55,278.14,273.28,270.14,268.36,267.15,267.15,265.47,261.75,256.51,252.98,251.17,251.17,244.27,240.54,238.92,237.47,235.91,235.91,231.41,224.94,222.19,219.06,217.83,217.83,216.89,213.84,212.90,213.98,215.31,215.31,214.09,213.71,211.54,209.40,207.33,207.33,202.75,200.26,198.99,198.82,198.43,198.43,195.68,195.45,193.65,191.38,189.71,189.71,185.49,183.01,182.38,181.60,182.13,182.13,180.81,180.25,179.84,178.50,178.11,178.11,178.10,177.52,177.34,175.53,176.01,175.94,175.47,175.48,173.76,173.74,173.65,172.00,171.50,170.41,171.50,171.43,170.69,170.40,169.90,170.21,170.55,169.98,169.34) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 299.81 284.55 251.17 217.83 207.33 189.71 178.11 172.00 NA [2,] 299.01 278.14 244.27 216.89 202.75 185.49 178.10 171.50 NA [3,] 296.82 273.28 240.54 213.84 200.26 183.01 177.52 170.41 NA [4,] 296.67 270.14 238.92 212.90 198.99 182.38 177.34 171.50 NA [5,] 296.95 268.36 237.47 213.98 198.82 181.60 175.53 171.43 NA [6,] 296.80 267.15 235.91 215.31 198.43 182.13 176.01 170.69 NA [7,] 296.80 267.15 235.91 215.31 198.43 182.13 175.94 170.40 NA [8,] 295.93 265.47 231.41 214.09 195.68 180.81 175.47 169.90 NA [9,] 293.77 261.75 224.94 213.71 195.45 180.25 175.48 170.21 NA [10,] 291.02 256.51 222.19 211.54 193.65 179.84 173.76 170.55 NA [11,] 288.61 252.98 219.06 209.40 191.38 178.50 173.74 169.98 NA [12,] 284.55 251.17 217.83 207.33 189.71 178.11 173.65 169.34 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/1isns1426169130.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/20lxr1426169130.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/3y8cz1426169130.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/4nnq81426169130.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,] 172.00 171.500 170.410 171.500 171.430 170.69 170.400 169.900 170.210 [2,] 183.91 181.795 180.265 179.860 178.565 179.07 179.035 178.140 177.865 [3,] 212.58 209.820 207.050 205.945 206.400 206.87 206.870 204.885 204.580 [4,] 267.86 261.205 256.910 254.530 252.915 251.53 251.530 248.440 243.345 [5,] 299.81 299.010 296.820 296.670 296.950 296.80 296.800 295.930 293.770 [,10] [,11] [,12] [1,] 170.550 169.98 169.34 [2,] 176.800 176.12 175.88 [3,] 202.595 200.39 198.52 [4,] 239.350 236.02 234.50 [5,] 291.020 288.61 284.55 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 165.6843 165.4604 164.235 164.2333 164.867 166.3928 166.3733 165.6144 [2,] 259.4757 254.1796 249.865 247.6567 247.933 247.3472 247.3667 244.1556 [,9] [,10] [,11] [,12] [1,] 168.0019 167.6537 166.929 165.774 [2,] 241.1581 237.5363 233.851 231.266 $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(172, 183.91, 212.58, 267.86, 299.81, 171.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5fiy11426169130.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,] 288.610 251.17 217.830 209.40 189.710 178.110 173.650 169.340 NA [2,] 292.395 259.13 223.565 212.22 194.550 180.045 174.615 170.095 NA [3,] 296.735 267.15 235.910 213.91 198.430 181.865 175.735 170.480 NA [4,] 296.885 271.71 239.730 215.31 199.625 182.695 177.430 171.465 NA [5,] 299.810 284.55 251.170 217.83 202.750 185.490 178.110 172.000 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 294.6871 261.4122 228.537 212.5006 196.1153 180.6563 174.4511 169.8551 [2,] 298.7829 272.8878 243.283 215.3194 200.7447 183.0737 177.0189 171.1049 [,9] [1,] NA [2,] NA $out [1] 284.55 207.33 207.33 189.71 $group [1] 1 4 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(288.61, 292.395, 296.735, 296.885, 299.81, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ztan1426169130.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,] 40.91051 118.630 49.17000 [2,] 43.52343 122.015 53.76750 [3,] 45.73295 125.775 63.12875 [4,] 46.32781 126.405 66.34625 [5,] 48.46835 127.810 72.70500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 44.45385 123.7727 57.3915 [2,] 47.01204 127.7773 68.8660 $out [1] 115.21 $group [1] 2 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(40.9105146936579, 43.5234309343133, 45.7329465763855, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1isns1426169130.ps tmp/1isns1426169130.png",intern=TRUE)) character(0) > try(system("convert tmp/20lxr1426169130.ps tmp/20lxr1426169130.png",intern=TRUE)) character(0) > try(system("convert tmp/3y8cz1426169130.ps tmp/3y8cz1426169130.png",intern=TRUE)) character(0) > try(system("convert tmp/4nnq81426169130.ps tmp/4nnq81426169130.png",intern=TRUE)) character(0) > try(system("convert tmp/5fiy11426169130.ps tmp/5fiy11426169130.png",intern=TRUE)) character(0) > try(system("convert tmp/6ztan1426169130.ps tmp/6ztan1426169130.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.155 0.358 2.534