R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 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(3477,2685,2438,1692,4054,3946,3623,2455,2362,2791,2369,3438,3682,2801,2563,3108,2890,3940,4036,1514,3461,2980,2728,3891,3715,2843,1416,2657,1856,2441,3172,2813,3335,2608,5784,4726,3817,2755,2541,3154,2684,3732,4286,2394,1698,3945,2549,3943,3899,2783,2660,1848,4482,4157,4404,2686,2593,3254,2664,4203,3985,2861,2758,1968,4666,4226,4748,2767,2723,3297,2758,4338) > 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,] 3477 3682 3715 3817 3899 3985 NA [2,] 2685 2801 2843 2755 2783 2861 NA [3,] 2438 2563 1416 2541 2660 2758 NA [4,] 1692 3108 2657 3154 1848 1968 NA [5,] 4054 2890 1856 2684 4482 4666 NA [6,] 3946 3940 2441 3732 4157 4226 NA [7,] 3623 4036 3172 4286 4404 4748 NA [8,] 2455 1514 2813 2394 2686 2767 NA [9,] 2362 3461 3335 1698 2593 2723 NA [10,] 2791 2980 2608 3945 3254 3297 NA [11,] 2369 2728 5784 2549 2664 2758 NA [12,] 3438 3891 4726 3943 4203 4338 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/1jxxa1398779718.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/24hho1398779718.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/3lzly1398779718.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/4j58h1398779718.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,] 3477 2685 2438 1692.0 1856 3732 3172 2394.0 1698 2608 2369 3438 [2,] 3682 2755 2438 1848.0 2684 3732 3623 2394.0 2362 2791 2549 3891 [3,] 3766 2792 2552 2312.5 3472 3943 4161 2570.5 2658 3117 2696 4073 [4,] 3899 2843 2660 3108.0 4482 4157 4404 2767.0 3335 3297 2758 4338 [5,] 3985 2861 2758 3154.0 4666 4226 4748 2813.0 3461 3945 2758 4726 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3626.028 2735.237 2408.803 1499.759 2312.232 3668.861 3657.23 2329.903 [2,] 3905.972 2848.763 2695.197 3125.241 4631.768 4217.139 4664.77 2811.097 [,9] [,10] [,11] [,12] [1,] 2030.384 2790.614 2561.188 3784.671 [2,] 3285.616 3443.386 2830.812 4361.329 $out [1] 1416 2441 1514 5784 $group [1] 3 6 8 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3477, 3682, 3766, 3899, 3985, 2685, 2755, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5d1wp1398779718.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,] 1692.0 1514.0 1416.0 1698.0 1848.0 1968 NA [2,] 2403.5 2764.5 2524.5 2545.0 2662.0 2758 NA [3,] 2738.0 3044.0 2828.0 2954.5 3018.5 3079 NA [4,] 3550.0 3786.5 3525.0 3880.0 4180.0 4282 NA [5,] 4054.0 4036.0 4726.0 4286.0 4482.0 4748 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2215.074 2577.859 2371.665 2345.598 2326.13 2383.893 NA [2,] 3260.926 3510.141 3284.335 3563.402 3710.87 3774.107 NA $out [1] 5784 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1692, 2403.5, 2738, 3550, 4054, 1514, 2764.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6javb1398779718.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,] 179.6416 1288.0 70.500 [2,] 455.8769 1293.5 180.500 [3,] 530.8858 1402.0 368.875 [4,] 656.3635 1774.0 705.250 [5,] 660.3007 1785.0 1117.250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 439.4426 1182.841 129.533 [2,] 622.3291 1621.159 608.217 $out [1] 63.63332 1126.84669 1302.05054 508.00000 176.00000 2810.00000 3415.00000 [8] 1639.50000 $group [1] 1 1 1 2 2 2 2 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(179.641587612668, 455.876936115465, 530.885821530026, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1jxxa1398779718.ps tmp/1jxxa1398779718.png",intern=TRUE)) character(0) > try(system("convert tmp/24hho1398779718.ps tmp/24hho1398779718.png",intern=TRUE)) character(0) > try(system("convert tmp/3lzly1398779718.ps tmp/3lzly1398779718.png",intern=TRUE)) character(0) > try(system("convert tmp/4j58h1398779718.ps tmp/4j58h1398779718.png",intern=TRUE)) character(0) > try(system("convert tmp/5d1wp1398779718.ps tmp/5d1wp1398779718.png",intern=TRUE)) character(0) > try(system("convert tmp/6javb1398779718.ps tmp/6javb1398779718.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.969 0.715 4.711