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(4309,4303,4177,4117,4065,3983,4091,4067,4024,3868,3800,3804,3862,3792,3674,3560,3489,3412,3674,3672,3463,3429,3400,3533,3578,3544,3435,3352,3213,3235,3460,3385,3283,3295,3331,3520,3668,3714,3691,3604,3581,3675,3833,3810,3663,3704,3810,4053,4152,4139,4055,3928,3821,3811,3999,3954,3724,3731,3697,3818,3897,3888,3754,3647,3564,3498,3704,3678,3599,3507,3484,2612,2926,2918,2833,2791,2762,2728,2831,2839,2775,2540,2625,2669) > 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,] 4309 3862 3578 3668 4152 3897 2926 NA [2,] 4303 3792 3544 3714 4139 3888 2918 NA [3,] 4177 3674 3435 3691 4055 3754 2833 NA [4,] 4117 3560 3352 3604 3928 3647 2791 NA [5,] 4065 3489 3213 3581 3821 3564 2762 NA [6,] 3983 3412 3235 3675 3811 3498 2728 NA [7,] 4091 3674 3460 3833 3999 3704 2831 NA [8,] 4067 3672 3385 3810 3954 3678 2839 NA [9,] 4024 3463 3283 3663 3724 3599 2775 NA [10,] 3868 3429 3295 3704 3731 3507 2540 NA [11,] 3800 3400 3331 3810 3697 3484 2625 NA [12,] 3804 3533 3520 4053 3818 2612 2669 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/1ushr1385823662.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/2pec81385823662.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/3n46l1385823663.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/4qhph1385823663.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,] 3578.0 3544.0 3435.0 3352.0 3213 2728.0 3460 3385.0 3283.0 3295.0 3331.0 [2,] 3623.0 3629.0 3554.5 3456.0 3351 3323.5 3567 3528.5 3373.0 3362.0 3365.5 [3,] 3862.0 3792.0 3691.0 3604.0 3564 3498.0 3704 3678.0 3599.0 3507.0 3484.0 [4,] 4024.5 4013.5 3904.5 3787.5 3701 3743.0 3916 3882.0 3693.5 3717.5 3748.5 [5,] 4309.0 4303.0 4177.0 4117.0 4065 3983.0 4091 4067.0 4024.0 3868.0 3810.0 [,12] [1,] 2612.0 [2,] 3094.5 [3,] 3533.0 [4,] 3811.0 [5,] 4053.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3622.231 3562.383 3481.986 3406.034 3354.986 3247.481 3495.583 3466.896 [2,] 4101.769 4021.617 3900.014 3801.966 3773.014 3748.519 3912.417 3889.104 [,9] [,10] [,11] [,12] [1,] 3407.603 3294.701 3255.279 3105.118 [2,] 3790.397 3719.299 3712.721 3960.882 $out [1] 2926 2918 2833 2791 2762 2831 2839 2775 2540 2625 $group [1] 1 2 3 4 5 7 8 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3578, 3623, 3862, 4024.5, 4309, 3544, 3629, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/56kka1385823663.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,] 3800.0 3400.0 3213.0 3581.0 3697.0 3484.0 2540.0 NA [2,] 3925.5 3446.0 3289.0 3665.5 3771.0 3502.5 2698.5 NA [3,] 4066.0 3546.5 3368.5 3697.5 3874.5 3623.0 2783.0 NA [4,] 4147.0 3674.0 3490.0 3810.0 4027.0 3729.0 2836.0 NA [5,] 4309.0 3862.0 3578.0 3833.0 4152.0 3897.0 2926.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3964.972 3442.508 3276.823 3631.593 3757.737 3519.692 2720.285 NA [2,] 4167.028 3650.492 3460.177 3763.407 3991.263 3726.308 2845.715 NA $out [1] 4053 2612 $group [1] 4 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(3800, 3925.5, 4066, 4147, 4309, 3400, 3446, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6zb6z1385823663.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,] 394.7716 1185.0 320.5 [2,] 413.2313 1252.0 349.5 [3,] 423.1694 1314.5 354.5 [4,] 445.9620 1363.5 393.0 [5,] 451.0435 1441.0 419.5 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 408.2407 1263.644 334.6594 [2,] 438.0981 1365.356 374.3406 $out [1] 569.43 716.50 $group [1] 1 3 $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(394.77160364902, 413.23125162737, 423.169387948631, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ushr1385823662.ps tmp/1ushr1385823662.png",intern=TRUE)) character(0) > try(system("convert tmp/2pec81385823662.ps tmp/2pec81385823662.png",intern=TRUE)) character(0) > try(system("convert tmp/3n46l1385823663.ps tmp/3n46l1385823663.png",intern=TRUE)) character(0) > try(system("convert tmp/4qhph1385823663.ps tmp/4qhph1385823663.png",intern=TRUE)) character(0) > try(system("convert tmp/56kka1385823663.ps tmp/56kka1385823663.png",intern=TRUE)) character(0) > try(system("convert tmp/6zb6z1385823663.ps tmp/6zb6z1385823663.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.428 0.882 5.288