R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(1143,1162,1169,1184,1169,1189,1192,1198,1168,1179,1173,1172,1125,1127,1123,1132,1114,1127,1129,1139,1117,1131,1132,1140,1105,1126,1129,1139,1123,1101,1110,1128,1101,1134,1139,1137,1141,1165,1146,1134,1141,1159,1166,1192,1171,1179,1181,1195,1167,1176,1181,1197,1194,1173,1179,1184,1193,1193,1193,1191,1222,1198,1218,1219,1260,1235,1256,1258,1295,1294,1318,1262) > 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] 72 > (np <- floor(n / par1)) [1] 18 > 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] 18 18 18 18 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 1143 1169 1168 1125 1114 1117 1105 1123 1101 1141 1141 1171 1167 1194 [2,] 1162 1189 1179 1127 1127 1131 1126 1101 1134 1165 1159 1179 1176 1173 [3,] 1169 1192 1173 1123 1129 1132 1129 1110 1139 1146 1166 1181 1181 1179 [4,] 1184 1198 1172 1132 1139 1140 1139 1128 1137 1134 1192 1195 1197 1184 [,15] [,16] [,17] [,18] [,19] [1,] 1193 1222 1260 1295 NA [2,] 1193 1198 1235 1294 NA [3,] 1193 1218 1256 1318 NA [4,] 1191 1219 1258 1262 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/1p85o1416674809.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/2lq171416674809.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/3dbok1416674809.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/4ujkb1416674809.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,] 1101 1101 1110 1128 [2,] 1123 1131 1132 1139 [3,] 1155 1169 1171 1184 [4,] 1193 1189 1192 1197 [5,] 1295 1235 1256 1262 $n [1] 18 18 18 18 $conf [,1] [,2] [,3] [,4] [1,] 1128.931 1147.4 1148.655 1162.4 [2,] 1181.069 1190.6 1193.345 1205.6 $out [1] 1294 1318 $group [1] 2 3 $names [1] "1" "2" "3" "4" Warning message: In bxp(list(stats = c(1101, 1123, 1155, 1193, 1295, 1101, 1131, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/557on1416674809.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] [,10] [1,] 1143.0 1169.0 1168.0 1123.0 1114.0 1117.0 1105.0 1101.0 1101.0 1134.0 [2,] 1152.5 1179.0 1170.0 1124.0 1120.5 1124.0 1115.5 1105.5 1117.5 1137.5 [3,] 1165.5 1190.5 1172.5 1126.0 1128.0 1131.5 1127.5 1116.5 1135.5 1143.5 [4,] 1176.5 1195.0 1176.0 1129.5 1134.0 1136.0 1134.0 1125.5 1138.0 1155.5 [5,] 1184.0 1198.0 1179.0 1132.0 1139.0 1140.0 1139.0 1128.0 1139.0 1165.0 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] 1141.0 1171 1167.0 1173.0 1191 1198.0 1235.0 1262.0 NA [2,] 1150.0 1175 1171.5 1176.0 1192 1208.0 1245.5 1278.0 NA [3,] 1162.5 1180 1178.5 1181.5 1193 1218.5 1257.0 1294.5 NA [4,] 1179.0 1188 1189.0 1189.0 1193 1220.5 1259.0 1306.5 NA [5,] 1192.0 1195 1197.0 1194.0 1193 1222.0 1260.0 1318.0 NA $n [1] 4 4 4 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] [,9] [1,] 1146.54 1177.86 1167.76 1121.655 1117.335 1122.02 1112.885 1100.7 1119.305 [2,] 1184.46 1203.14 1177.24 1130.345 1138.665 1140.98 1142.115 1132.3 1151.695 [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [1,] 1129.28 1139.59 1169.73 1164.675 1171.23 1192.21 1208.625 1246.335 [2,] 1157.72 1185.41 1190.27 1192.325 1191.77 1193.79 1228.375 1267.665 [,18] [,19] [1,] 1271.985 NA [2,] 1317.015 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] "16" "17" "18" NA Warning message: In bxp(list(stats = c(1143, 1152.5, 1165.5, 1176.5, 1184, 1169, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6zw6n1416674809.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,] 41.57099 134.0 54.750 [2,] 43.43889 163.5 55.125 [3,] 48.32490 193.5 56.500 [4,] 52.36158 201.0 60.750 [5,] 53.38016 208.0 64.000 $n [1] 4 4 4 $conf [,1] [,2] [,3] [1,] 41.27598 163.875 52.05625 [2,] 55.37383 223.125 60.94375 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(41.5709881867575, 43.4388927476256, 48.3249031639333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1p85o1416674809.ps tmp/1p85o1416674809.png",intern=TRUE)) character(0) > try(system("convert tmp/2lq171416674809.ps tmp/2lq171416674809.png",intern=TRUE)) character(0) > try(system("convert tmp/3dbok1416674809.ps tmp/3dbok1416674809.png",intern=TRUE)) character(0) > try(system("convert tmp/4ujkb1416674809.ps tmp/4ujkb1416674809.png",intern=TRUE)) character(0) > try(system("convert tmp/557on1416674809.ps tmp/557on1416674809.png",intern=TRUE)) character(0) > try(system("convert tmp/6zw6n1416674809.ps tmp/6zw6n1416674809.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.155 0.379 2.557