R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 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(105.95,108.55,110.81,111.54,110.38,106.67,106.45,105.44,105.37,103.72,106.57,108.54,110.36,106.64,103.45,101.36,101.9,100.86,100.37,100.16,99.5,99.52,99.2,99.35,99.37,99.85,99.76,100.07,99.77,99.93,99.16,99.4,99.81,99.67,99.37,99.49,99.28,99.33,99.19,98.11,99.12,99.06,97.41,98.45,100.33,103.18,103.06,103.48,102.8,103.92,103.9,103.96,103.62,103.83,104.09,104.07,103.22,104.01,104.01,104.24,102.93,104.73,106.48,119.5,122.45,125.29,126.56,126.38,127.95,128.23,128.7,127.86) > 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,] 105.95 110.36 99.37 99.28 102.80 102.93 NA [2,] 108.55 106.64 99.85 99.33 103.92 104.73 NA [3,] 110.81 103.45 99.76 99.19 103.90 106.48 NA [4,] 111.54 101.36 100.07 98.11 103.96 119.50 NA [5,] 110.38 101.90 99.77 99.12 103.62 122.45 NA [6,] 106.67 100.86 99.93 99.06 103.83 125.29 NA [7,] 106.45 100.37 99.16 97.41 104.09 126.56 NA [8,] 105.44 100.16 99.40 98.45 104.07 126.38 NA [9,] 105.37 99.50 99.81 100.33 103.22 127.95 NA [10,] 103.72 99.52 99.67 103.18 104.01 128.23 NA [11,] 106.57 99.20 99.37 103.06 104.01 128.70 NA [12,] 108.54 99.35 99.49 103.48 104.24 127.86 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/1a3kq1463866648.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/2m4aa1463866648.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/3pam11463866648.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/4slet1463866648.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,] 99.280 99.330 99.190 98.11 99.12 99.060 97.41 98.450 99.500 [2,] 99.370 99.850 99.760 100.07 99.77 99.930 99.16 99.400 99.810 [3,] 102.865 104.325 103.675 102.66 102.76 102.345 102.23 102.115 101.775 [4,] 105.950 106.640 106.480 111.54 110.38 106.670 106.45 105.440 105.370 [5,] 110.360 108.550 110.810 119.50 122.45 106.670 106.45 105.440 105.370 [,10] [,11] [,12] [1,] 99.52 99.200 99.35 [2,] 99.67 99.370 99.49 [3,] 103.45 103.535 103.86 [4,] 104.01 106.570 108.54 [5,] 104.01 106.570 108.54 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 98.62069 99.94523 99.34038 95.26148 95.91621 97.99748 97.52771 [2,] 107.10931 108.70477 108.00962 110.05852 109.60379 106.69252 106.93229 [,8] [,9] [,10] [,11] [,12] [1,] 98.219 98.18862 100.6506 98.89077 98.02246 [2,] 106.011 105.36138 106.2494 108.17923 109.69754 $out [1] 125.29 126.56 126.38 127.95 128.23 128.70 127.86 $group [1] 6 7 8 9 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(99.28, 99.37, 102.865, 105.95, 110.36, 99.33, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/597b21463866648.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.720 99.200 99.160 97.410 103.620 102.930 NA [2,] 105.695 99.510 99.385 98.755 103.725 112.990 NA [3,] 106.620 100.615 99.715 99.235 103.940 125.835 NA [4,] 109.465 102.675 99.830 101.695 104.040 127.905 NA [5,] 111.540 106.640 100.070 103.480 104.240 128.700 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 104.9005 99.17142 99.51203 97.89405 103.7963 119.0322 NA [2,] 108.3395 102.05858 99.91797 100.57595 104.0837 132.6378 NA $out [1] 110.36 102.80 103.22 $group [1] 2 5 5 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(103.72, 105.695, 106.62, 109.465, 111.54, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6bceq1463866648.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,] 3.662860 9.220 3.3900 [2,] 6.263996 16.505 5.0600 [3,] 10.202846 27.080 5.5725 [4,] 10.819378 28.610 6.6875 [5,] 11.085102 29.500 8.3875 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 8.125106 21.55883 4.830186 [2,] 12.280587 32.60117 6.314814 $out [1] 9.2525 $group [1] 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(3.66286044870217, 6.26399636697081, 10.2028461917131, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1a3kq1463866648.ps tmp/1a3kq1463866648.png",intern=TRUE)) character(0) > try(system("convert tmp/2m4aa1463866648.ps tmp/2m4aa1463866648.png",intern=TRUE)) character(0) > try(system("convert tmp/3pam11463866648.ps tmp/3pam11463866648.png",intern=TRUE)) character(0) > try(system("convert tmp/4slet1463866648.ps tmp/4slet1463866648.png",intern=TRUE)) character(0) > try(system("convert tmp/597b21463866648.ps tmp/597b21463866648.png",intern=TRUE)) character(0) > try(system("convert tmp/6bceq1463866648.ps tmp/6bceq1463866648.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.126 0.422 2.569