R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(103.48,103.93,103.89,104.4,104.79,104.77,105.13,105.26,104.96,104.75,105.01,105.1,103.48,103.93,103.89,104.4,104.79,106.12,106.57,106.44,106.54,107.1,108.1,108.4,108.84,109.62,110.42,110.67,111.66,112.28,112.87,112.18,112.36,112.16,111.49,111.25,111.36,111.74,111.1,111.33,111.25,111.04,110.97,111.31,111.02,111.07,111.36,111.54,112.05,112.52,112.94,113.33,113.78,113.77,113.82,113.89,114.25,114.41,114.55,115,115.66,116.33,116.91,117.2,117.59,117.95,118.09,117.99,118.31,118.49,118.96,119.01) > 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,] 103.48 103.48 108.84 111.36 112.05 115.66 NA [2,] 103.93 103.93 109.62 111.74 112.52 116.33 NA [3,] 103.89 103.89 110.42 111.10 112.94 116.91 NA [4,] 104.40 104.40 110.67 111.33 113.33 117.20 NA [5,] 104.79 104.79 111.66 111.25 113.78 117.59 NA [6,] 104.77 106.12 112.28 111.04 113.77 117.95 NA [7,] 105.13 106.57 112.87 110.97 113.82 118.09 NA [8,] 105.26 106.44 112.18 111.31 113.89 117.99 NA [9,] 104.96 106.54 112.36 111.02 114.25 118.31 NA [10,] 104.75 107.10 112.16 111.07 114.41 118.49 NA [11,] 105.01 108.10 111.49 111.36 114.55 118.96 NA [12,] 105.10 108.40 111.25 111.54 115.00 119.01 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/1brgx1354188797.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/2ga2f1354188797.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/39cr71354188797.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/4u4ms1354188797.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] [1,] 103.48 103.93 103.89 104.40 104.790 104.77 105.13 105.260 104.96 104.750 [2,] 103.48 103.93 103.89 104.40 104.790 106.12 106.57 106.440 106.54 107.100 [3,] 110.10 110.68 110.76 111.00 111.455 111.66 111.92 111.745 111.69 111.615 [4,] 112.05 112.52 112.94 113.33 113.780 113.77 113.82 113.890 114.25 114.410 [5,] 115.66 116.33 116.91 117.20 117.590 117.95 118.09 117.990 118.31 118.490 [,11] [,12] [1,] 105.010 105.100 [2,] 108.100 108.400 [3,] 111.425 111.395 [4,] 114.550 115.000 [5,] 118.960 119.010 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 104.5721 105.1392 104.9225 105.2399 105.6562 106.7255 107.2435 106.9395 [2,] 115.6279 116.2208 116.5975 116.7601 117.2538 116.5945 116.5965 116.5505 [,9] [,10] [,11] [,12] [1,] 106.7168 106.8998 107.2645 107.1378 [2,] 116.6632 116.3302 115.5855 115.6522 $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(103.48, 103.48, 110.1, 112.05, 115.66, 103.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5e9k91354188797.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,] 103.480 103.480 108.840 110.970 112.050 115.660 NA [2,] 104.165 104.165 110.545 111.055 113.135 117.055 NA [3,] 104.780 106.280 111.575 111.280 113.800 117.970 NA [4,] 105.055 106.835 112.230 111.360 114.330 118.400 NA [5,] 105.260 108.400 112.870 111.740 115.000 119.010 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 104.3741 105.0622 110.8065 111.1409 113.255 117.3565 NA [2,] 105.1859 107.4978 112.3435 111.4191 114.345 118.5835 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(103.48, 104.165, 104.78, 105.055, 105.26, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/648mc1354188797.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,] 4.738166 12.180 4.8700 [2,] 4.874623 12.765 5.7800 [3,] 4.920522 12.990 6.0825 [4,] 5.002459 13.545 6.9100 [5,] 5.144354 13.950 7.0575 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 4.862215 12.63424 5.567099 [2,] 4.978829 13.34576 6.597901 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(4.73816596022835, 4.87462265569372, 4.92052157153548, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1brgx1354188797.ps tmp/1brgx1354188797.png",intern=TRUE)) character(0) > try(system("convert tmp/2ga2f1354188797.ps tmp/2ga2f1354188797.png",intern=TRUE)) character(0) > try(system("convert tmp/39cr71354188797.ps tmp/39cr71354188797.png",intern=TRUE)) character(0) > try(system("convert tmp/4u4ms1354188797.ps tmp/4u4ms1354188797.png",intern=TRUE)) character(0) > try(system("convert tmp/5e9k91354188797.ps tmp/5e9k91354188797.png",intern=TRUE)) character(0) > try(system("convert tmp/648mc1354188797.ps tmp/648mc1354188797.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.279 0.541 3.804