R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 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(143.7,149.3,121.7,81,68.1,92.3,107.7,114.4,98.6,106.7,73.9,85.9,118.4,144.2,118.4,82.6,68,99.8,93.4,107.9,101.1,100.4,76.7,89.1,105.3,124.8,111.9,89,88.6,84.5,91.1,118.1,103.6,92.6,70.2,70.2,114.3,125.3,98.9,65.4,66,71.2,84.6,102.6,91.8,97.4,64.1,62.3,96.2,104.9,90.3,65.2,57.8,70.5,93.2,74.2,91.1,85,58.9,68.3,98.1,110.5,77.6,55.1,49.8,58.5,86.5,88.8,94,65,52.2,70.9) > 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,] 143.7 118.4 105.3 114.3 96.2 98.1 NA [2,] 149.3 144.2 124.8 125.3 104.9 110.5 NA [3,] 121.7 118.4 111.9 98.9 90.3 77.6 NA [4,] 81.0 82.6 89.0 65.4 65.2 55.1 NA [5,] 68.1 68.0 88.6 66.0 57.8 49.8 NA [6,] 92.3 99.8 84.5 71.2 70.5 58.5 NA [7,] 107.7 93.4 91.1 84.6 93.2 86.5 NA [8,] 114.4 107.9 118.1 102.6 74.2 88.8 NA [9,] 98.6 101.1 103.6 91.8 91.1 94.0 NA [10,] 106.7 100.4 92.6 97.4 85.0 65.0 NA [11,] 73.9 76.7 70.2 64.1 58.9 52.2 NA [12,] 85.9 89.1 70.2 62.3 68.3 70.9 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/1urb21447947388.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/2nhni1447947388.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/3rfva1447947388.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/4vskr1447947388.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] [,12] [1,] 96.2 104.90 77.6 55.1 49.8 58.50 84.60 74.20 91.1 65.0 52.20 62.30 [2,] 98.1 110.50 90.3 65.2 57.8 70.50 86.50 88.80 91.8 85.0 58.90 68.30 [3,] 109.8 125.05 105.4 73.2 67.0 77.85 92.15 105.25 96.3 95.0 67.15 70.55 [4,] 118.4 144.20 118.4 82.6 68.1 92.30 93.40 114.40 101.1 100.4 73.90 85.90 [5,] 143.7 149.30 121.7 89.0 68.1 99.80 93.40 118.10 103.6 106.7 76.70 89.10 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 96.70584 103.3124 87.27459 61.97644 60.35617 63.7883 87.69928 88.73717 [2,] 122.89416 146.7876 123.52541 84.42356 73.64383 91.9117 96.60072 121.76283 [,9] [,10] [,11] [,12] [1,] 90.3012 85.0665 57.47452 59.19743 [2,] 102.2988 104.9335 76.82548 81.90257 $out [1] 88.6 107.7 $group [1] 5 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(96.2, 98.1, 109.8, 118.4, 143.7, 104.9, 110.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/55ty71447947388.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,] 68.10 68.00 70.20 62.30 57.80 49.80 NA [2,] 83.45 85.85 86.55 65.70 66.75 56.80 NA [3,] 102.65 100.10 91.85 88.20 79.60 74.25 NA [4,] 118.05 113.15 108.60 100.75 92.15 91.40 NA [5,] 149.30 144.20 124.80 125.30 104.90 110.50 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 86.86871 87.64829 81.79285 72.21346 68.01489 58.46871 NA [2,] 118.43129 112.55171 101.90715 104.18654 91.18511 90.03129 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(68.1, 83.45, 102.65, 118.05, 149.3, 68, 85.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6o2vj1447947388.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,] 5.162170 12.50 5.7000 [2,] 9.985248 25.65 10.4875 [3,] 13.906612 40.05 15.1625 [4,] 16.963386 44.00 20.1000 [5,] 17.663635 47.50 25.4000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 10.72384 31.68044 10.77817 [2,] 17.08939 48.41956 19.54683 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(5.1621700863106, 9.98524780181736, 13.906611681108, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1urb21447947388.ps tmp/1urb21447947388.png",intern=TRUE)) character(0) > try(system("convert tmp/2nhni1447947388.ps tmp/2nhni1447947388.png",intern=TRUE)) character(0) > try(system("convert tmp/3rfva1447947388.ps tmp/3rfva1447947388.png",intern=TRUE)) character(0) > try(system("convert tmp/4vskr1447947388.ps tmp/4vskr1447947388.png",intern=TRUE)) character(0) > try(system("convert tmp/55ty71447947388.ps tmp/55ty71447947388.png",intern=TRUE)) character(0) > try(system("convert tmp/6o2vj1447947388.ps tmp/6o2vj1447947388.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.279 0.349 2.652