R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(2048,2037,2149,2124,2205,2489,2573,2702,2718,2646,2712,2634,2614,2637,2649,2579,2505,2462,2467,2447,2656,2626,2483,2540,2503,2467,2513,2443,2293,2071,2030,2052,1864,1670,1811,1905,1863,2014,2198,2962,3047,3033,3504,3801,3858,3674,3721,3844,4117,4105,4435,4296,4203,4563,4621,4697,4591,4357,4503,4444,4291,4200,4139,3970,3862,3702,3570,3801,3896,3918,3813,3667) > 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,] 2048 2614 2503 1863 4117 4291 NA [2,] 2037 2637 2467 2014 4105 4200 NA [3,] 2149 2649 2513 2198 4435 4139 NA [4,] 2124 2579 2443 2962 4296 3970 NA [5,] 2205 2505 2293 3047 4203 3862 NA [6,] 2489 2462 2071 3033 4563 3702 NA [7,] 2573 2467 2030 3504 4621 3570 NA [8,] 2702 2447 2052 3801 4697 3801 NA [9,] 2718 2656 1864 3858 4591 3896 NA [10,] 2646 2626 1670 3674 4357 3918 NA [11,] 2712 2483 1811 3721 4503 3813 NA [12,] 2634 2540 1905 3844 4444 3667 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/1sow51357311768.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/2xhyp1357311768.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/3ql081357311768.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/41o9m1357311768.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,] 1863.0 2014 2149 2124.0 2205 2071 2030.0 2052.0 1864 1670 1811.0 1905.0 [2,] 2048.0 2037 2198 2443.0 2293 2462 2467.0 2447.0 2656 2626 2483.0 2540.0 [3,] 2558.5 2552 2581 2770.5 2776 2761 3038.5 3251.5 3288 3160 3216.5 3150.5 [4,] 4117.0 4105 4139 3970.0 3862 3702 3570.0 3801.0 3896 3918 3813.0 3844.0 [5,] 4291.0 4200 4435 4296.0 4203 4563 4621.0 4697.0 4591 4357 4503.0 4444.0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1223.928 1218.073 1328.992 1785.536 1763.944 1961.16 2327.029 2378.126 [2,] 3893.072 3885.927 3833.008 3755.464 3788.056 3560.84 3749.971 4124.874 [,9] [,10] [,11] [,12] [1,] 2488.16 2326.618 2358.607 2309.378 [2,] 4087.84 3993.382 4074.393 3991.622 $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(1863, 2048, 2558.5, 4117, 4291, 2014, 2037, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ylmu1357311768.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,] 2037.0 2447.0 1670.0 1863.0 4105.0 3570.0 NA [2,] 2136.5 2475.0 1884.5 2580.0 4249.5 3751.5 NA [3,] 2531.0 2559.5 2061.5 3275.5 4439.5 3879.0 NA [4,] 2674.0 2631.5 2455.0 3761.0 4577.0 4054.5 NA [5,] 2718.0 2656.0 2513.0 3858.0 4697.0 4291.0 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2285.843 2488.119 1801.291 2736.838 4290.125 3740.8 NA [2,] 2776.157 2630.881 2321.709 3814.162 4588.875 4017.2 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(2037, 2136.5, 2531, 2674, 2718, 2447, 2475, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6v5c11357311768.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,] 844.6487 1998.0 1060.000 [2,] 940.6803 2236.0 1220.500 [3,] 997.5013 2515.5 1245.375 [4,] 1008.1915 2666.0 1401.000 [5,] 1044.6465 2727.0 1593.500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 966.7089 2319.374 1163.048 [2,] 1028.2936 2711.626 1327.702 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(844.648664633211, 940.680251059232, 997.50127328366, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1sow51357311768.ps tmp/1sow51357311768.png",intern=TRUE)) character(0) > try(system("convert tmp/2xhyp1357311768.ps tmp/2xhyp1357311768.png",intern=TRUE)) character(0) > try(system("convert tmp/3ql081357311768.ps tmp/3ql081357311768.png",intern=TRUE)) character(0) > try(system("convert tmp/41o9m1357311768.ps tmp/41o9m1357311768.png",intern=TRUE)) character(0) > try(system("convert tmp/5ylmu1357311768.ps tmp/5ylmu1357311768.png",intern=TRUE)) character(0) > try(system("convert tmp/6v5c11357311768.ps tmp/6v5c11357311768.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.630 0.665 4.350