R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(94.67,94.6,93.9,93.41,93.37,93.35,93.08,93.05,92.61,92.37,92.24,91.95,92.63,92.7,92.47,92.58,92.55,92.56,89.92,89.96,90.03,90.31,90.8,90.36,90.31,93.8,93.95,93.99,94.44,94.15,91.91,91.86,93.12,93.47,93.57,94.57,95.85,96.62,95.69,95.39,95.14,95.07,94.21,95.4,95.1,94.89,95.43,94.88,96.03,96.37,96.04,95.72,95.74,95.78,93.66,95.29,94.33,95.66,95.2,94.61,96.21,96.27,95.12,95.55,93.51,92.86,92.45,93.34,92.01,91.77,92.19,91.97) > 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,] 94.67 92.63 90.31 95.85 96.03 96.21 NA [2,] 94.60 92.70 93.80 96.62 96.37 96.27 NA [3,] 93.90 92.47 93.95 95.69 96.04 95.12 NA [4,] 93.41 92.58 93.99 95.39 95.72 95.55 NA [5,] 93.37 92.55 94.44 95.14 95.74 93.51 NA [6,] 93.35 92.56 94.15 95.07 95.78 92.86 NA [7,] 93.08 89.92 91.91 94.21 93.66 92.45 NA [8,] 93.05 89.96 91.86 95.40 95.29 93.34 NA [9,] 92.61 90.03 93.12 95.10 94.33 92.01 NA [10,] 92.37 90.31 93.47 94.89 95.66 91.77 NA [11,] 92.24 90.80 93.57 95.43 95.20 92.19 NA [12,] 91.95 90.36 94.57 94.88 94.61 91.97 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/1my421426153503.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/2739j1426153503.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/3m29r1426153503.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/4vgjw1426153503.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] [1,] 90.31 92.700 92.470 92.58 92.550 92.56 89.920 89.960 90.030 90.31 90.800 [2,] 92.63 93.800 93.900 93.41 93.370 92.86 91.910 91.860 92.010 91.77 92.190 [3,] 95.26 95.435 94.535 94.69 93.975 93.75 92.765 93.195 92.865 92.92 92.905 [4,] 96.03 96.370 95.690 95.55 95.140 95.07 93.660 95.290 94.330 94.89 95.200 [5,] 96.21 96.620 96.040 95.72 95.740 95.78 94.210 95.400 95.100 95.66 95.430 [,12] [1,] 90.36 [2,] 91.95 [3,] 93.27 [4,] 94.61 [5,] 94.88 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 93.06689 93.77727 93.38039 93.30963 92.83329 92.32448 91.63619 90.98254 [2,] 97.45311 97.09273 95.68961 96.07037 95.11671 95.17552 93.89381 95.40746 [,9] [,10] [,11] [,12] [1,] 91.36853 90.9075 90.96345 91.55421 [2,] 94.36147 94.9325 94.84655 94.98579 $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(90.31, 92.63, 95.26, 96.03, 96.21, 92.7, 93.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5l7d11426153503.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,] 91.950 89.920 90.310 94.210 93.660 91.770 NA [2,] 92.490 90.170 92.515 94.980 94.905 92.100 NA [3,] 93.215 91.635 93.685 95.265 95.690 93.100 NA [4,] 93.655 92.570 94.070 95.560 95.905 95.335 NA [5,] 94.670 92.700 94.570 95.850 96.370 96.270 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 92.68364 90.54034 92.97575 95.00046 95.23389 91.62449 NA [2,] 93.74636 92.72966 94.39425 95.52954 96.14611 94.57551 NA $out [1] 96.62 $group [1] 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(91.95, 92.49, 93.215, 93.655, 94.67, 89.92, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6wyau1426153503.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,] 1.197209 3.140 1.47000 [2,] 1.320747 3.395 1.74625 [3,] 1.701223 4.405 2.15000 [4,] 1.940323 5.210 2.63000 [5,] 2.361683 5.900 2.84500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.418630 3.577166 1.746916 [2,] 1.983816 5.232834 2.553084 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(1.19720925489239, 1.32074677436324, 1.70122312586954, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1my421426153503.ps tmp/1my421426153503.png",intern=TRUE)) character(0) > try(system("convert tmp/2739j1426153503.ps tmp/2739j1426153503.png",intern=TRUE)) character(0) > try(system("convert tmp/3m29r1426153503.ps tmp/3m29r1426153503.png",intern=TRUE)) character(0) > try(system("convert tmp/4vgjw1426153503.ps tmp/4vgjw1426153503.png",intern=TRUE)) character(0) > try(system("convert tmp/5l7d11426153503.ps tmp/5l7d11426153503.png",intern=TRUE)) character(0) > try(system("convert tmp/6wyau1426153503.ps tmp/6wyau1426153503.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.116 0.368 2.503