R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(3.875,3.863,3.876,3.878,3.881,3.883,3.884,3.885,3.895,3.903,3.911,3.929,3.946,3.965,3.992,4.010,4.015,4.020,4.037,4.059,4.083,4.102,4.126,4.145,4.162,4.169,4.178,4.174,4.168,4.170,4.159,4.159,4.143,4.159,4.167,4.176,4.185,4.195,4.210,4.226,4.250,4.259,4.270,4.277,4.286,4.303,4.320,4.336,4.352,4.371,4.392,4.415,4.442,4.457,4.472,4.474,4.461,4.453,4.446,4.450,4.459,4.474,4.492,4.509,4.526,4.541,4.550,4.562,4.555,4.554,4.551,4.553) > 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,] 3.875 3.946 4.162 4.185 4.352 4.459 NA [2,] 3.863 3.965 4.169 4.195 4.371 4.474 NA [3,] 3.876 3.992 4.178 4.210 4.392 4.492 NA [4,] 3.878 4.010 4.174 4.226 4.415 4.509 NA [5,] 3.881 4.015 4.168 4.250 4.442 4.526 NA [6,] 3.883 4.020 4.170 4.259 4.457 4.541 NA [7,] 3.884 4.037 4.159 4.270 4.472 4.550 NA [8,] 3.885 4.059 4.159 4.277 4.474 4.562 NA [9,] 3.895 4.083 4.143 4.286 4.461 4.555 NA [10,] 3.903 4.102 4.159 4.303 4.453 4.554 NA [11,] 3.911 4.126 4.167 4.320 4.446 4.551 NA [12,] 3.929 4.145 4.176 4.336 4.450 4.553 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/1lgv11385643056.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/2qk2z1385643056.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/359pz1385643056.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/4x0zx1385643056.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,] 3.8750 3.863 3.876 3.878 3.881 3.8830 3.8840 3.885 3.8950 3.903 3.9110 [2,] 3.9460 3.965 3.992 4.010 4.015 4.0200 4.0370 4.059 4.0830 4.102 4.1260 [3,] 4.1735 4.182 4.194 4.200 4.209 4.2145 4.2145 4.218 4.2145 4.231 4.2435 [4,] 4.3520 4.371 4.392 4.415 4.442 4.4570 4.4720 4.474 4.4610 4.453 4.4460 [5,] 4.4590 4.474 4.492 4.509 4.526 4.5410 4.5500 4.562 4.5550 4.554 4.5510 [,12] [1,] 3.929 [2,] 4.145 [3,] 4.256 [4,] 4.450 [5,] 4.553 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.911617 3.920117 3.935987 3.938762 3.933571 3.932621 3.933911 3.950312 [2,] 4.435383 4.443883 4.452013 4.461238 4.484429 4.496379 4.495089 4.485688 [,9] [,10] [,11] [,12] [1,] 3.970678 4.004594 4.03709 4.059265 [2,] 4.458322 4.457406 4.44991 4.452735 $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(3.875, 3.946, 4.1735, 4.352, 4.459, 3.863, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/59htk1385643056.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,] 3.8630 3.9460 4.1430 4.1850 4.3520 4.4590 NA [2,] 3.8770 4.0010 4.1590 4.2180 4.4035 4.5005 NA [3,] 3.8835 4.0285 4.1675 4.2645 4.4480 4.5455 NA [4,] 3.8990 4.0925 4.1720 4.2945 4.4590 4.5535 NA [5,] 3.9290 4.1450 4.1780 4.3360 4.4740 4.5620 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 3.873466 3.986766 4.161571 4.229608 4.422686 4.521326 NA [2,] 3.893534 4.070234 4.173429 4.299392 4.473314 4.569674 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(3.863, 3.877, 3.8835, 3.899, 3.929, 3.946, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6u54l1385643056.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,] 0.2253241 0.5840 0.268750 [2,] 0.2323834 0.6200 0.303625 [3,] 0.2386893 0.6425 0.313875 [4,] 0.2489857 0.6590 0.340750 [5,] 0.2549745 0.6770 0.354000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2311169 0.6247118 0.296942 [2,] 0.2462617 0.6602882 0.330808 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.225324136893202, 0.232383436860083, 0.23868933084078, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1lgv11385643056.ps tmp/1lgv11385643056.png",intern=TRUE)) character(0) > try(system("convert tmp/2qk2z1385643056.ps tmp/2qk2z1385643056.png",intern=TRUE)) character(0) > try(system("convert tmp/359pz1385643056.ps tmp/359pz1385643056.png",intern=TRUE)) character(0) > try(system("convert tmp/4x0zx1385643056.ps tmp/4x0zx1385643056.png",intern=TRUE)) character(0) > try(system("convert tmp/59htk1385643056.ps tmp/59htk1385643056.png",intern=TRUE)) character(0) > try(system("convert tmp/6u54l1385643056.ps tmp/6u54l1385643056.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.080 0.676 3.746