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(120.6,119.9,119.48,117.45,118.37,117.07,114.98,112.59,111.7,112.04,110.79,109.82,109.11,109.84,109.31,108.29,107.42,106.71,105.11,104.43,105.55,106.12,105.78,105.33,104.63,104.62,105.57,107.5,107.52,107.76,106.74,106.21,105.77,105.27,104.35,103.52,102.28,100.93,101.04,99.95,99.55,99.56,99.01,98.64,98.98,100.8,100.32,100.72,280.8,280.4,280.4,280.3,281,280.9,279.7,283.1,290.6,291.6,291.7,291.8,291.7,291.5,291.7,293.4,293.1,293.1,292.6,292.1,292.2,292,292.1,293.4,292.2,292.1,291.6,290.9,290.9,290.8,290.5,290,290.2,290.1,291,291.8) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 120.60 109.11 104.63 102.28 280.8 291.7 292.2 NA [2,] 119.90 109.84 104.62 100.93 280.4 291.5 292.1 NA [3,] 119.48 109.31 105.57 101.04 280.4 291.7 291.6 NA [4,] 117.45 108.29 107.50 99.95 280.3 293.4 290.9 NA [5,] 118.37 107.42 107.52 99.55 281.0 293.1 290.9 NA [6,] 117.07 106.71 107.76 99.56 280.9 293.1 290.8 NA [7,] 114.98 105.11 106.74 99.01 279.7 292.6 290.5 NA [8,] 112.59 104.43 106.21 98.64 283.1 292.1 290.0 NA [9,] 111.70 105.55 105.77 98.98 290.6 292.2 290.2 NA [10,] 112.04 106.12 105.27 100.80 291.6 292.0 290.1 NA [11,] 110.79 105.78 104.35 100.32 291.7 292.1 291.0 NA [12,] 109.82 105.33 103.52 100.72 291.8 293.4 291.8 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/1k7nj1385985850.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/2crkt1385985850.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/3rayd1385985850.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/47oiq1385985850.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] [1,] 102.28 100.93 101.04 99.950 99.55 99.560 99.010 98.64 98.98 100.800 [2,] 106.87 107.23 107.44 107.895 107.47 107.235 105.925 105.32 105.66 105.695 [3,] 120.60 119.90 119.48 117.450 118.37 117.070 114.980 112.59 111.70 112.040 [4,] 286.25 285.95 286.00 285.600 285.95 285.850 285.100 286.55 290.40 290.850 [5,] 292.20 292.10 291.70 293.400 293.10 293.100 292.600 292.10 292.20 292.000 [,11] [,12] [1,] 100.320 100.720 [2,] 105.065 104.425 [3,] 110.790 109.820 [4,] 291.350 291.800 [5,] 292.100 293.400 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 13.47716 13.1713 12.84685 11.32744 11.78462 10.404 7.979581 [2,] 227.72284 226.6287 226.11315 223.57256 224.95538 223.736 221.980419 [,8] [,9] [,10] [,11] [,12] [1,] 4.362368 1.376252 1.468421 -0.4563967 -2.077327 [2,] 220.817632 222.023748 222.611579 222.0363967 221.717327 $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(102.28, 106.87, 120.6, 286.25, 292.2, 100.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/57ire1385985850.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] [1,] 109.820 104.430 103.520 98.640 279.70 291.50 290.00 NA [2,] 111.870 105.440 104.625 99.280 280.40 291.85 290.35 NA [3,] 116.025 106.415 105.670 100.135 280.95 292.15 290.90 NA [4,] 118.925 108.700 107.120 100.865 291.10 293.10 291.70 NA [5,] 120.600 109.840 107.760 102.280 291.80 293.40 292.20 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 112.8072 104.9281 104.532 99.41207 276.0697 291.5799 290.2843 NA [2,] 119.2428 107.9019 106.808 100.85793 285.8303 292.7201 291.5157 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(109.82, 111.87, 116.025, 118.925, 120.6, 104.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/680ns1385985850.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,] 95.94049 189.920 177.7050 [2,] 96.20295 191.185 178.5875 [3,] 96.85034 192.950 179.2775 [4,] 99.13006 193.500 184.9475 [5,] 100.25319 193.590 187.3750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 95.51527 191.8941 176.3767 [2,] 98.18542 194.0059 182.1783 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(95.9404863890705, 96.2029498402222, 96.85034444912, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1k7nj1385985850.ps tmp/1k7nj1385985850.png",intern=TRUE)) character(0) > try(system("convert tmp/2crkt1385985850.ps tmp/2crkt1385985850.png",intern=TRUE)) character(0) > try(system("convert tmp/3rayd1385985850.ps tmp/3rayd1385985850.png",intern=TRUE)) character(0) > try(system("convert tmp/47oiq1385985850.ps tmp/47oiq1385985850.png",intern=TRUE)) character(0) > try(system("convert tmp/57ire1385985850.ps tmp/57ire1385985850.png",intern=TRUE)) character(0) > try(system("convert tmp/680ns1385985850.ps tmp/680ns1385985850.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.502 1.155 6.656