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(98.4,98.1,97.5,97.7,98.2,98.9,99.9,100.9,101.8,102.1,103.1,103.4,105.5,106.7,106.9,107.2,107.7,107.3,107.2,107.1,106.6,106.6,106.5,106.7,106.3,108.9,109.9,110.8,110.5,111.2,111.4,112.2,113.2,114,114.2,114.6,115.9,116.1,116.4,116.7,117.9,118.1,118.3,118.8,118.4,118,117.9,117.9,117.9,117.3,117.8,117.8,117.8,117.6,117.3,116.3,114.3,113.8,113.5,114.7) > 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,] 98.4 105.5 106.3 115.9 117.9 NA [2,] 98.1 106.7 108.9 116.1 117.3 NA [3,] 97.5 106.9 109.9 116.4 117.8 NA [4,] 97.7 107.2 110.8 116.7 117.8 NA [5,] 98.2 107.7 110.5 117.9 117.8 NA [6,] 98.9 107.3 111.2 118.1 117.6 NA [7,] 99.9 107.2 111.4 118.3 117.3 NA [8,] 100.9 107.1 112.2 118.8 116.3 NA [9,] 101.8 106.6 113.2 118.4 114.3 NA [10,] 102.1 106.6 114.0 118.0 113.8 NA [11,] 103.1 106.5 114.2 117.9 113.5 NA [12,] 103.4 106.7 114.6 117.9 114.7 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/1a7r71448021303.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/2koxj1448021303.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/3gn6y1448021303.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/4ij9p1448021303.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,] 98.4 98.1 97.5 97.7 98.2 98.9 99.9 100.9 101.8 102.1 103.1 103.4 [2,] 105.5 106.7 106.9 107.2 107.7 107.3 107.2 107.1 106.6 106.6 106.5 106.7 [3,] 106.3 108.9 109.9 110.8 110.5 111.2 111.4 112.2 113.2 113.8 113.5 114.6 [4,] 115.9 116.1 116.4 116.7 117.8 117.6 117.3 116.3 114.3 114.0 114.2 114.7 [5,] 117.9 117.3 117.8 117.8 117.9 118.1 118.3 118.8 118.4 118.0 117.9 117.9 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 98.95139 102.258 103.1873 104.0873 103.3634 103.922 104.2634 105.6993 [2,] 113.64861 115.542 116.6127 117.5127 117.6366 118.478 118.5366 118.7007 [,9] [,10] [,11] [,12] [1,] 107.7592 108.5712 108.0592 108.9472 [2,] 118.6408 119.0288 118.9408 120.2528 $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(98.4, 105.5, 106.3, 115.9, 117.9, 98.1, 106.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5m3sh1448021303.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,] 97.50 106.5 106.3 115.90 113.5 NA [2,] 98.15 106.6 110.2 116.55 114.5 NA [3,] 99.40 106.8 111.3 117.90 117.3 NA [4,] 101.95 107.2 113.6 118.20 117.8 NA [5,] 103.40 107.7 114.6 118.80 117.9 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 97.66679 106.5263 109.7492 117.1474 115.7948 NA [2,] 101.13321 107.0737 112.8508 118.6526 118.8052 NA $out [1] 105.5 $group [1] 2 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(97.5, 98.15, 99.4, 101.95, 103.4, 106.5, 106.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6fo4j1448021303.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,] 6.057062 14.50 7.40 [2,] 6.506513 16.25 7.85 [3,] 7.689938 18.80 9.45 [4,] 8.093121 19.60 10.10 [5,] 8.173433 20.30 10.40 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 6.966276 17.27204 8.42376 [2,] 8.413600 20.32796 10.47624 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(6.05706199406941, 6.50651318226631, 7.68993795584806, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1a7r71448021303.ps tmp/1a7r71448021303.png",intern=TRUE)) character(0) > try(system("convert tmp/2koxj1448021303.ps tmp/2koxj1448021303.png",intern=TRUE)) character(0) > try(system("convert tmp/3gn6y1448021303.ps tmp/3gn6y1448021303.png",intern=TRUE)) character(0) > try(system("convert tmp/4ij9p1448021303.ps tmp/4ij9p1448021303.png",intern=TRUE)) character(0) > try(system("convert tmp/5m3sh1448021303.ps tmp/5m3sh1448021303.png",intern=TRUE)) character(0) > try(system("convert tmp/6fo4j1448021303.ps tmp/6fo4j1448021303.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.139 0.372 2.531