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(99.7,107.5,107.5,114.5,118.7,117.8,111.7,112.3,104.9,102.4,100.3,106.6,94.2,96.9,94.7,104.9,108.3,104.7,108.3,105.2,99.2,99.3,92.3,98.6,88.4,89.5,90.5,103.5,105.1,107.1,111.6,104.6,103.3,104.6,94.1,97.7,92.4,89.5,100.1,109.6,105.5,108.9,108.8,103.9,104.3,102.1,96.6,101.4,90.4,91.8,100.4,105.3,105.1,107.6,103.7,102.7,99.2,95.6,96.3,104.1) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 99.7 94.2 88.4 92.4 90.4 NA [2,] 107.5 96.9 89.5 89.5 91.8 NA [3,] 107.5 94.7 90.5 100.1 100.4 NA [4,] 114.5 104.9 103.5 109.6 105.3 NA [5,] 118.7 108.3 105.1 105.5 105.1 NA [6,] 117.8 104.7 107.1 108.9 107.6 NA [7,] 111.7 108.3 111.6 108.8 103.7 NA [8,] 112.3 105.2 104.6 103.9 102.7 NA [9,] 104.9 99.2 103.3 104.3 99.2 NA [10,] 102.4 99.3 104.6 102.1 95.6 NA [11,] 100.3 92.3 94.1 96.6 96.3 NA [12,] 106.6 98.6 97.7 101.4 104.1 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/1ouvz1398689781.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/2gh3o1398689781.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/3dcjx1398689781.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/4tuvb1398689781.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,] 88.4 89.5 90.5 103.5 105.1 104.7 103.7 102.7 99.2 95.6 92.3 97.7 [2,] 90.4 89.5 94.7 104.9 105.1 107.1 108.3 103.9 99.2 99.3 94.1 98.6 [3,] 92.4 91.8 100.1 105.3 105.5 107.6 108.8 104.6 103.3 102.1 96.3 101.4 [4,] 94.2 96.9 100.4 109.6 108.3 108.9 111.6 105.2 104.3 102.4 96.6 104.1 [5,] 99.7 107.5 107.5 114.5 108.3 108.9 111.7 105.2 104.9 104.6 100.3 106.6 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 89.71493 86.57118 96.07239 101.979 103.2389 106.3281 106.4682 103.6814 [2,] 95.08507 97.02882 104.12761 108.621 107.7611 108.8719 111.1318 105.5186 [,9] [,10] [,11] [,12] [1,] 99.69635 99.90955 94.53351 97.51371 [2,] 106.90365 104.29045 98.06649 105.28629 $out [1] 118.7 117.8 112.3 $group [1] 5 6 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(88.4, 90.4, 92.4, 94.2, 99.7, 89.5, 89.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5kje11398689781.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] [1,] 99.70 92.30 88.40 89.50 90.40 NA [2,] 103.65 95.80 92.30 98.35 95.95 NA [3,] 107.50 99.25 103.40 103.00 101.55 NA [4,] 113.40 105.05 104.85 107.15 104.60 NA [5,] 118.70 108.30 111.60 109.60 107.60 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 103.053 95.03101 97.67586 98.98626 97.60468 NA [2,] 111.947 103.46899 109.12414 107.01374 105.49532 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(99.7, 103.65, 107.5, 113.4, 118.7, 92.3, 95.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/689qi1398689781.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,] 2.779748 5.70 1.30 [2,] 3.361644 8.45 2.80 [3,] 4.051024 10.30 3.55 [4,] 5.433333 13.35 5.30 [5,] 7.592628 18.00 7.40 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3.106113 8.065077 2.409733 [2,] 4.995936 12.534923 4.690267 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.77974819003449, 3.36164391313551, 4.0510243487204, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ouvz1398689781.ps tmp/1ouvz1398689781.png",intern=TRUE)) character(0) > try(system("convert tmp/2gh3o1398689781.ps tmp/2gh3o1398689781.png",intern=TRUE)) character(0) > try(system("convert tmp/3dcjx1398689781.ps tmp/3dcjx1398689781.png",intern=TRUE)) character(0) > try(system("convert tmp/4tuvb1398689781.ps tmp/4tuvb1398689781.png",intern=TRUE)) character(0) > try(system("convert tmp/5kje11398689781.ps tmp/5kje11398689781.png",intern=TRUE)) character(0) > try(system("convert tmp/689qi1398689781.ps tmp/689qi1398689781.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.078 0.749 4.849