R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 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(45564.6,47295.5,46465.5,50679.5,47452.8,49415.4,48165.3,51814,49030.7,50820.8,49729.5,53501.6,50524.9,52095,51290.3,55064,52505.2,54318.3,53039.6,57607.6,54236.4,56586.4,55614,60085.9,56963.5,59152.8,57804.6,62541.5,59449.3,61704.7,60399,65724.7,62679.4,65526.5,64274.8,68769.1,63542.8,66198,64544.9,71041.8,66087.2,69005.8,66897,73702,68485.3,71457,69774.6,76479.7,71204.7,73783.9,71651,78541.6,72714.4,75258,73168.1,79701.6,73944.5,76401.2,73948.1,80583.3) > par1 = '4' > par1 <- '4' > #'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] 15 > 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] 15 15 15 15 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 45564.6 47452.8 49030.7 50524.9 52505.2 54236.4 56963.5 59449.3 62679.4 [2,] 47295.5 49415.4 50820.8 52095.0 54318.3 56586.4 59152.8 61704.7 65526.5 [3,] 46465.5 48165.3 49729.5 51290.3 53039.6 55614.0 57804.6 60399.0 64274.8 [4,] 50679.5 51814.0 53501.6 55064.0 57607.6 60085.9 62541.5 65724.7 68769.1 [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] 63542.8 66087.2 68485.3 71204.7 72714.4 73944.5 NA [2,] 66198.0 69005.8 71457.0 73783.9 75258.0 76401.2 NA [3,] 64544.9 66897.0 69774.6 71651.0 73168.1 73948.1 NA [4,] 71041.8 73702.0 76479.7 78541.6 79701.6 80583.3 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/1cx8l1463824259.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/2mcxt1463824259.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/3ph0i1463824259.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/4vnae1463824259.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] [1,] 45564.60 47295.50 46465.50 50679.50 [2,] 51515.05 53206.65 52164.95 56335.80 [3,] 59449.30 61704.70 60399.00 65724.70 [4,] 67286.25 70231.40 68335.80 75090.85 [5,] 73944.50 76401.20 73948.10 80583.30 $n [1] 15 15 15 15 $conf [,1] [,2] [,3] [,4] [1,] 53015.37 54759.38 53802.03 58073.5 [2,] 65883.23 68650.02 66995.97 73375.9 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5lxel1463824259.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,] 45564.60 47452.80 49030.70 50524.90 52505.20 54236.40 56963.50 59449.30 [2,] 46015.05 47809.05 49380.10 50907.60 52772.40 54925.20 57384.05 59924.15 [3,] 46880.50 48790.35 50275.15 51692.65 53678.95 56100.20 58478.70 61051.85 [4,] 48987.50 50614.70 52161.20 53579.50 55962.95 58336.15 60847.15 63714.70 [5,] 50679.50 51814.00 53501.60 55064.00 57607.60 60085.90 62541.50 65724.70 [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] 62679.40 63542.80 66087.2 68485.30 71204.70 72714.40 73944.50 NA [2,] 63477.10 64043.85 66492.1 69129.95 71427.85 72941.25 73946.30 NA [3,] 64900.65 65371.45 67951.4 70615.80 72717.45 74213.05 75174.65 NA [4,] 67147.80 68619.90 71353.9 73968.35 76162.75 77479.80 78492.25 NA [5,] 68769.10 71041.80 73702.0 76479.70 78541.60 79701.60 80583.30 NA $n [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 44532.26 46573.89 48078.08 49581.85 51158.42 53405.55 55742.85 58057.32 [2,] 49228.74 51006.81 52472.22 53803.45 56199.48 58794.85 61214.55 64046.38 [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [1,] 62000.8 61756.37 64110.58 66793.46 68976.88 70627.6 71583.35 NA [2,] 67800.5 68986.53 71792.22 74438.14 76458.02 77798.5 78765.95 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] NA Warning message: In bxp(list(stats = c(45564.6, 46015.05, 46880.5, 48987.5, 50679.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/69drx1463824259.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,] 9486.575 27482.60 15771.20 [2,] 9530.108 27931.25 15971.03 [3,] 9759.475 28742.80 16597.80 [4,] 10297.777 29504.75 17889.90 [5,] 10650.246 29903.80 18755.05 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 9153.017 27499.74 15081.89 [2,] 10365.933 29985.86 18113.71 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(9486.57477972098, 9530.1084092945, 9759.47506108305, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1cx8l1463824259.ps tmp/1cx8l1463824259.png",intern=TRUE)) character(0) > try(system("convert tmp/2mcxt1463824259.ps tmp/2mcxt1463824259.png",intern=TRUE)) character(0) > try(system("convert tmp/3ph0i1463824259.ps tmp/3ph0i1463824259.png",intern=TRUE)) character(0) > try(system("convert tmp/4vnae1463824259.ps tmp/4vnae1463824259.png",intern=TRUE)) character(0) > try(system("convert tmp/5lxel1463824259.ps tmp/5lxel1463824259.png",intern=TRUE)) character(0) > try(system("convert tmp/69drx1463824259.ps tmp/69drx1463824259.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.322 0.485 2.829