R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(103.4,103.49,103.51,103.27,103.35,103.34,103.07,103.08,103.1,103.13,103.13,103.18,103.2,103.21,103,102.46,102.52,102.55,102.78,102.81,102.81,102.68,102.72,102.73,102.87,102.93,103.2,102.62,102.18,101.19,100.91,100.72,100.86,100.89,100.47,100.45,100.64,100.63,100.66,100.38,99.68,99.71,99.63,99.63,99.71,99.77,99.76,99.79,98.13,98.13,97.87,97.72,97.72,97.6,97.31,97.31,97.44,96.94,96.94,96.94) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 103.40 103.20 102.87 100.64 98.13 NA [2,] 103.49 103.21 102.93 100.63 98.13 NA [3,] 103.51 103.00 103.20 100.66 97.87 NA [4,] 103.27 102.46 102.62 100.38 97.72 NA [5,] 103.35 102.52 102.18 99.68 97.72 NA [6,] 103.34 102.55 101.19 99.71 97.60 NA [7,] 103.07 102.78 100.91 99.63 97.31 NA [8,] 103.08 102.81 100.72 99.63 97.31 NA [9,] 103.10 102.81 100.86 99.71 97.44 NA [10,] 103.13 102.68 100.89 99.77 96.94 NA [11,] 103.13 102.72 100.47 99.76 96.94 NA [12,] 103.18 102.73 100.45 99.79 96.94 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/17t8k1447703438.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/2gzon1447703438.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/3e0qx1447703438.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/4lmkz1447703438.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,] 98.13 98.13 97.87 97.72 97.72 97.60 97.31 97.31 97.44 96.94 [2,] 100.64 100.63 100.66 100.38 99.68 99.71 99.63 99.63 99.71 99.77 [3,] 102.87 102.93 103.00 102.46 102.18 101.19 100.91 100.72 100.86 100.89 [4,] 103.20 103.21 103.20 102.62 102.52 102.55 102.78 102.81 102.81 102.68 [5,] 103.40 103.49 103.51 103.27 103.35 103.34 103.07 103.08 103.10 103.13 [,11] [,12] [1,] 96.94 96.94 [2,] 99.76 99.79 [3,] 100.47 100.45 [4,] 102.72 102.73 [5,] 103.13 103.18 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 101.0611 101.107 101.2052 100.8772 100.1733 99.18326 98.68422 98.47302 [2,] 104.6789 104.753 104.7948 104.0428 104.1867 103.19674 103.13578 102.96698 [,9] [,10] [,11] [,12] [1,] 98.66955 98.8338 98.37847 98.3726 [2,] 103.05045 102.9462 102.56153 102.5274 $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(98.13, 100.64, 102.87, 103.2, 103.4, 98.13, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5bqhb1447703438.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] [1,] 103.070 102.460 100.450 99.630 96.940 NA [2,] 103.115 102.615 100.790 99.695 97.125 NA [3,] 103.225 102.755 101.050 99.765 97.520 NA [4,] 103.375 102.905 102.745 100.505 97.795 NA [5,] 103.510 103.210 103.200 100.660 98.130 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 103.1064 102.6227 100.1583 99.39555 97.21441 NA [2,] 103.3436 102.8873 101.9417 100.13445 97.82559 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(103.07, 103.115, 103.225, 103.375, 103.51, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6ts001447703438.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,] 2.256318 5.27 2.240 [2,] 2.289874 5.59 2.570 [3,] 2.356450 5.70 2.875 [4,] 2.444287 5.98 3.030 [5,] 2.513259 6.24 3.180 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.286021 5.522118 2.665191 [2,] 2.426879 5.877882 3.084809 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(2.25631779676534, 2.28987358247451, 2.35645022972907, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17t8k1447703438.ps tmp/17t8k1447703438.png",intern=TRUE)) character(0) > try(system("convert tmp/2gzon1447703438.ps tmp/2gzon1447703438.png",intern=TRUE)) character(0) > try(system("convert tmp/3e0qx1447703438.ps tmp/3e0qx1447703438.png",intern=TRUE)) character(0) > try(system("convert tmp/4lmkz1447703438.ps tmp/4lmkz1447703438.png",intern=TRUE)) character(0) > try(system("convert tmp/5bqhb1447703438.ps tmp/5bqhb1447703438.png",intern=TRUE)) character(0) > try(system("convert tmp/6ts001447703438.ps tmp/6ts001447703438.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.375 0.469 2.857