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(9.27,9.30,9.35,9.33,9.37,9.42,9.45,9.38,9.40,9.43,9.45,9.49,9.47,9.48,9.52,9.53,9.53,9.54,9.57,9.61,9.61,9.63,9.64,9.60,9.64,9.66,9.67,9.70,9.72,9.73,9.77,9.72,9.68,9.62,9.79,9.77,9.79,9.77,9.78,9.81,9.74,9.70,9.78,9.85,9.83,9.90,9.93,9.85,9.95,9.97,10.02,9.97,9.95,9.95,9.98,10.00,10.04,10.05,10.06,10.09,10.14,10.13,10.12,10.10,10.12,10.06,10.21,10.18,10.26,10.39,10.41,10.46) > 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,] 9.27 9.47 9.64 9.79 9.95 10.14 NA [2,] 9.30 9.48 9.66 9.77 9.97 10.13 NA [3,] 9.35 9.52 9.67 9.78 10.02 10.12 NA [4,] 9.33 9.53 9.70 9.81 9.97 10.10 NA [5,] 9.37 9.53 9.72 9.74 9.95 10.12 NA [6,] 9.42 9.54 9.73 9.70 9.95 10.06 NA [7,] 9.45 9.57 9.77 9.78 9.98 10.21 NA [8,] 9.38 9.61 9.72 9.85 10.00 10.18 NA [9,] 9.40 9.61 9.68 9.83 10.04 10.26 NA [10,] 9.43 9.63 9.62 9.90 10.05 10.39 NA [11,] 9.45 9.64 9.79 9.93 10.06 10.41 NA [12,] 9.49 9.60 9.77 9.85 10.09 10.46 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/fisher/rcomp/tmp/17aps1386280341.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/fisher/rcomp/tmp/2sm741386280341.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/fisher/rcomp/tmp/38csl1386280341.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/fisher/rcomp/tmp/47xt01386280341.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,] 9.270 9.300 9.350 9.330 9.37 9.420 9.450 9.380 9.400 9.430 9.45 [2,] 9.470 9.480 9.520 9.530 9.53 9.540 9.570 9.610 9.610 9.620 9.64 [3,] 9.715 9.715 9.725 9.755 9.73 9.715 9.775 9.785 9.755 9.765 9.86 [4,] 9.950 9.970 10.020 9.970 9.95 9.950 9.980 10.000 10.040 10.050 10.06 [5,] 10.140 10.130 10.120 10.100 10.12 10.060 10.210 10.180 10.260 10.390 10.41 [,12] [1,] 9.49 [2,] 9.60 [3,] 9.81 [4,] 10.09 [5,] 10.46 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9.405384 9.398934 9.402484 9.471186 9.459086 9.450537 9.510537 [2,] 10.024616 10.031066 10.047516 10.038814 10.000914 9.979463 10.039463 [,8] [,9] [,10] [,11] [,12] [1,] 9.533437 9.477636 9.487636 9.589086 9.493934 [2,] 10.036563 10.032364 10.042364 10.130914 10.126066 $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(9.27, 9.47, 9.715, 9.95, 10.14, 9.3, 9.48, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5i3991386280341.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,] 9.27 9.470 9.620 9.700 9.950 10.060 NA [2,] 9.34 9.525 9.665 9.775 9.960 10.120 NA [3,] 9.39 9.555 9.710 9.800 9.990 10.160 NA [4,] 9.44 9.610 9.750 9.850 10.045 10.325 NA [5,] 9.49 9.640 9.790 9.930 10.090 10.460 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9.344389 9.516231 9.671231 9.765792 9.951231 10.0665 NA [2,] 9.435611 9.593769 9.748769 9.834208 10.028769 10.2535 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(9.27, 9.34, 9.39, 9.44, 9.49, 9.47, 9.525, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/61w4j1386280341.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.2409703 0.640 0.31000 [2,] 0.2789165 0.765 0.32250 [3,] 0.2999918 0.815 0.35875 [4,] 0.3271880 0.915 0.39250 [5,] 0.3532516 0.970 0.40250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.2779749 0.746584 0.3268225 [2,] 0.3220087 0.883416 0.3906775 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(0.240970260959038, 0.278916491767581, 0.299991805716306, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17aps1386280341.ps tmp/17aps1386280341.png",intern=TRUE)) character(0) > try(system("convert tmp/2sm741386280341.ps tmp/2sm741386280341.png",intern=TRUE)) character(0) > try(system("convert tmp/38csl1386280341.ps tmp/38csl1386280341.png",intern=TRUE)) character(0) > try(system("convert tmp/47xt01386280341.ps tmp/47xt01386280341.png",intern=TRUE)) character(0) > try(system("convert tmp/5i3991386280341.ps tmp/5i3991386280341.png",intern=TRUE)) character(0) > try(system("convert tmp/61w4j1386280341.ps tmp/61w4j1386280341.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.119 1.320 6.413