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(132,133.7,127,128.7,127.3,136.7,133.8,137.2,147.4,137.6,123.6,117.4,113.7,106.8,103.3,96.3,96.2,94.7,94.6,95.7,106.7,100.2,94.2,97.6,94.3,98,93.6,86.3,90.7,81.8,87.6,73.8,63.3,59.1,52.9,54.6,52.4,67.5,90.4,126,144.3,167.8,166.2,156,137,129.3,118,114.7,112.8,115.7,103.9,96.9,88.8,93,86.3,82.3,82.4,76.6,72.7,67.5,77.3,73.7,73,78.2,90.7,91.5,86.3,86.8,86.1,77.1,75.7,78.7,71.5,69.6,73.6,78.1,78.3,71.5,68.7,61.2,64.7,64.6,56.3,54.5,49.5,54,59.2,52.4,52.8,47.8,45.2,47.1,42.6,42.1,39.4,39.6) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 132.0 113.7 94.3 52.4 112.8 77.3 71.5 49.5 NA [2,] 133.7 106.8 98.0 67.5 115.7 73.7 69.6 54.0 NA [3,] 127.0 103.3 93.6 90.4 103.9 73.0 73.6 59.2 NA [4,] 128.7 96.3 86.3 126.0 96.9 78.2 78.1 52.4 NA [5,] 127.3 96.2 90.7 144.3 88.8 90.7 78.3 52.8 NA [6,] 136.7 94.7 81.8 167.8 93.0 91.5 71.5 47.8 NA [7,] 133.8 94.6 87.6 166.2 86.3 86.3 68.7 45.2 NA [8,] 137.2 95.7 73.8 156.0 82.3 86.8 61.2 47.1 NA [9,] 147.4 106.7 63.3 137.0 82.4 86.1 64.7 42.6 NA [10,] 137.6 100.2 59.1 129.3 76.6 77.1 64.6 42.1 NA [11,] 123.6 94.2 52.9 118.0 72.7 75.7 56.3 39.4 NA [12,] 117.4 97.6 54.6 114.7 67.5 78.7 54.5 39.6 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/1h9381356619384.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/2ts8z1356619384.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/3rkre1356619384.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/46wot1356619384.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,] 49.50 54.00 59.2 52.40 52.80 47.80 45.20 47.10 42.60 42.10 39.4 [2,] 61.95 68.55 73.3 78.15 83.55 76.65 77.50 67.50 64.00 61.85 54.6 [3,] 85.80 85.85 92.0 91.30 90.70 92.25 86.95 84.55 84.25 76.85 74.2 [4,] 113.25 111.25 103.6 111.45 111.75 115.70 114.20 116.45 121.85 114.75 106.1 [5,] 132.00 133.70 127.0 128.70 144.30 167.80 166.20 156.00 147.40 137.60 123.6 [,12] [1,] 39.60 [2,] 54.55 [3,] 73.10 [4,] 106.15 [5,] 117.40 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 57.14308 61.99717 75.07398 72.69814 74.94708 70.43611 66.44885 [2,] 114.45692 109.70283 108.92602 109.90186 106.45292 114.06389 107.45115 [,8] [,9] [,10] [,11] [,12] [1,] 57.20583 51.93416 47.2993 45.43136 44.2755 [2,] 111.89417 116.56584 106.4007 102.96864 101.9245 $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(49.5, 61.95, 85.8, 113.25, 132, 54, 68.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5y0pa1356619384.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] [,9] [1,] 117.40 94.20 52.90 52.40 67.50 73.00 54.50 39.40 NA [2,] 127.15 95.20 61.20 102.55 79.45 76.40 62.90 42.35 NA [3,] 132.85 96.95 84.05 127.65 87.55 78.45 69.15 47.45 NA [4,] 136.95 105.00 92.15 150.15 100.40 86.55 72.55 52.60 NA [5,] 147.40 113.70 98.00 167.80 115.70 91.50 78.30 59.20 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 128.3802 92.48015 69.9335 105.9393 77.99456 73.82052 64.74857 42.77491 [2,] 137.3198 101.41985 98.1665 149.3607 97.10544 83.07948 73.55143 52.12509 [,9] [1,] NA [2,] NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(117.4, 127.15, 132.85, 136.95, 147.4, 94.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/65z3c1356619384.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,] 21.56989 67.80 17.8000 [2,] 28.02997 78.75 25.9875 [3,] 30.40600 87.85 37.6875 [4,] 36.84892 106.85 45.5000 [5,] 37.68942 121.00 49.9250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 26.38362 75.0334 28.78772 [2,] 34.42838 100.6666 46.58728 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(21.5698864160199, 28.0299687016554, 30.4060006558046, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1h9381356619384.ps tmp/1h9381356619384.png",intern=TRUE)) character(0) > try(system("convert tmp/2ts8z1356619384.ps tmp/2ts8z1356619384.png",intern=TRUE)) character(0) > try(system("convert tmp/3rkre1356619384.ps tmp/3rkre1356619384.png",intern=TRUE)) character(0) > try(system("convert tmp/46wot1356619384.ps tmp/46wot1356619384.png",intern=TRUE)) character(0) > try(system("convert tmp/5y0pa1356619384.ps tmp/5y0pa1356619384.png",intern=TRUE)) character(0) > try(system("convert tmp/65z3c1356619384.ps tmp/65z3c1356619384.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.170 0.411 3.618