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(5.06,5.05,5.05,5.04,5.06,5.07,5.09,5.08,5.09,5.09,5.09,5.1,5.12,5.14,5.14,5.14,5.13,5.15,5.16,5.17,5.17,5.18,5.21,5.19,5.22,5.24,5.21,5.24,5.28,5.3,5.32,5.32,5.29,5.3,5.32,5.31,5.35,5.36,5.33,5.35,5.35,5.35,5.37,5.39,5.4,5.39,5.4,5.4,5.4,5.38,5.32,5.36,5.35,5.39,5.4,5.41,5.36,5.38,5.41,5.35,5.4,5.41,5.42,5.41,5.41,5.42,5.4,5.42,5.41,5.34,5.46,5.45,5.47,5.48,5.43,5.5,5.51,5.51,5.52,5.55,5.55,5.48,5.61,5.59,5.68,5.71,5.68,5.7,5.76,5.78,5.77,5.85,5.82,5.84,5.89,5.84) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 5.06 5.12 5.22 5.35 5.40 5.40 5.47 5.68 NA [2,] 5.05 5.14 5.24 5.36 5.38 5.41 5.48 5.71 NA [3,] 5.05 5.14 5.21 5.33 5.32 5.42 5.43 5.68 NA [4,] 5.04 5.14 5.24 5.35 5.36 5.41 5.50 5.70 NA [5,] 5.06 5.13 5.28 5.35 5.35 5.41 5.51 5.76 NA [6,] 5.07 5.15 5.30 5.35 5.39 5.42 5.51 5.78 NA [7,] 5.09 5.16 5.32 5.37 5.40 5.40 5.52 5.77 NA [8,] 5.08 5.17 5.32 5.39 5.41 5.42 5.55 5.85 NA [9,] 5.09 5.17 5.29 5.40 5.36 5.41 5.55 5.82 NA [10,] 5.09 5.18 5.30 5.39 5.38 5.34 5.48 5.84 NA [11,] 5.09 5.21 5.32 5.40 5.41 5.46 5.61 5.89 NA [12,] 5.10 5.19 5.31 5.40 5.35 5.45 5.59 5.84 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/1rb441416770097.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/2s8aq1416770097.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/3hs9n1416770097.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/4uif71416770097.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,] 5.060 5.050 5.050 5.040 5.060 5.070 5.090 5.080 5.09 5.090 5.090 5.100 [2,] 5.170 5.190 5.175 5.190 5.205 5.225 5.240 5.245 5.23 5.240 5.265 5.250 [3,] 5.375 5.370 5.325 5.355 5.350 5.370 5.385 5.400 5.38 5.360 5.405 5.375 [4,] 5.435 5.445 5.425 5.455 5.460 5.465 5.460 5.485 5.48 5.435 5.535 5.520 [5,] 5.680 5.710 5.680 5.700 5.760 5.780 5.770 5.550 5.82 5.480 5.890 5.840 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 5.226967 5.227553 5.185346 5.206967 5.207553 5.235933 5.262105 5.265933 [2,] 5.523033 5.512447 5.464654 5.503033 5.492447 5.504067 5.507895 5.534067 [,9] [,10] [,11] [,12] [1,] 5.240346 5.25107 5.254174 5.224174 [2,] 5.519654 5.46893 5.555826 5.525826 $out [1] 5.85 5.84 $group [1] 8 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(5.06, 5.17, 5.375, 5.435, 5.68, 5.05, 5.19, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/58b2s1416770097.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] [,8] [,9] [1,] 5.040 5.120 5.210 5.330 5.320 5.400 5.43 5.680 NA [2,] 5.055 5.140 5.240 5.350 5.355 5.405 5.48 5.705 NA [3,] 5.075 5.155 5.295 5.365 5.380 5.410 5.51 5.775 NA [4,] 5.090 5.175 5.315 5.395 5.400 5.420 5.55 5.840 NA [5,] 5.100 5.210 5.320 5.400 5.410 5.420 5.61 5.890 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 5.059036 5.139036 5.260792 5.344475 5.359475 5.403158 5.478073 5.713426 [2,] 5.090964 5.170964 5.329208 5.385525 5.400525 5.416842 5.541927 5.836574 [,9] [1,] NA [2,] NA $out [1] 5.34 5.46 5.45 $group [1] 6 6 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(5.04, 5.055, 5.075, 5.09, 5.1, 5.12, 5.14, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6xu141416770097.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.1960867 0.620 0.14250 [2,] 0.2066282 0.660 0.17500 [3,] 0.2185463 0.705 0.19875 [4,] 0.2294219 0.745 0.21500 [5,] 0.2455279 0.800 0.23000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2081500 0.6662309 0.1805057 [2,] 0.2289427 0.7437691 0.2169943 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.196086715511276, 0.206628163466984, 0.218546333149168, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1rb441416770097.ps tmp/1rb441416770097.png",intern=TRUE)) character(0) > try(system("convert tmp/2s8aq1416770097.ps tmp/2s8aq1416770097.png",intern=TRUE)) character(0) > try(system("convert tmp/3hs9n1416770097.ps tmp/3hs9n1416770097.png",intern=TRUE)) character(0) > try(system("convert tmp/4uif71416770097.ps tmp/4uif71416770097.png",intern=TRUE)) character(0) > try(system("convert tmp/58b2s1416770097.ps tmp/58b2s1416770097.png",intern=TRUE)) character(0) > try(system("convert tmp/6xu141416770097.ps tmp/6xu141416770097.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.099 0.375 2.490