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(950,775,805,680,705,755,715,860,900,1010,925,650,1060,1050,1025,1085,1160,1310,1445,1445,1615,1650,1255,1175,1300,1280,1390,1340,1110,1325,1265,1150,1430,1655,1570,1345,1430,1260,1495,1125,895,1085,870,1185,1455,1540,1615,1200,1260,1095,1160,1095,1300,1215,1245,1350,1300,1280,1270,1065,1340,1265,1155,930,880,925,980,1015,1040,1365,1160,1115,1630,1225,1200,1265,1140,1270,1445,1305,1665,1830,1690,1520) > 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,] 950 1060 1300 1430 1260 1340 1630 NA [2,] 775 1050 1280 1260 1095 1265 1225 NA [3,] 805 1025 1390 1495 1160 1155 1200 NA [4,] 680 1085 1340 1125 1095 930 1265 NA [5,] 705 1160 1110 895 1300 880 1140 NA [6,] 755 1310 1325 1085 1215 925 1270 NA [7,] 715 1445 1265 870 1245 980 1445 NA [8,] 860 1445 1150 1185 1350 1015 1305 NA [9,] 900 1615 1430 1455 1300 1040 1665 NA [10,] 1010 1650 1655 1540 1280 1365 1830 NA [11,] 925 1255 1570 1615 1270 1160 1690 NA [12,] 650 1175 1345 1200 1065 1115 1520 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/1c5co1426172718.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/2f1i71426172718.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/3wc5s1426172718.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/4q25s1426172718.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] [,12] [1,] 950 1050.0 805 930.0 705.0 755 715 860.0 900 1010.0 925.0 1065.0 [2,] 1160 1072.5 1090 1007.5 887.5 1005 925 1082.5 1170 1322.5 1207.5 1090.0 [3,] 1300 1225.0 1160 1095.0 1110.0 1215 1245 1185.0 1430 1540.0 1270.0 1175.0 [4,] 1385 1262.5 1295 1195.0 1150.0 1290 1355 1327.5 1535 1652.5 1592.5 1272.5 [5,] 1630 1280.0 1495 1340.0 1300.0 1325 1445 1445.0 1665 1830.0 1690.0 1520.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,] 1165.634 1111.535 1037.577 983.028 953.2392 1044.803 988.2109 1038.69 [2,] 1434.366 1338.465 1282.423 1206.972 1266.7608 1385.197 1501.7891 1331.31 [,9] [,10] [,11] [,12] [1,] 1212.028 1342.929 1040.084 1066.014 [2,] 1647.972 1737.071 1499.916 1283.986 $out [1] 775 680 650 $group [1] 2 4 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(950, 1160, 1300, 1385, 1630, 1050, 1072.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5cciu1426172718.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,] 650.0 1025.0 1110.0 870 1065.0 880.0 1140.0 NA [2,] 710.0 1072.5 1272.5 1105 1127.5 955.0 1245.0 NA [3,] 790.0 1215.0 1332.5 1230 1252.5 1077.5 1375.0 NA [4,] 912.5 1445.0 1410.0 1475 1290.0 1212.5 1647.5 NA [5,] 1010.0 1650.0 1570.0 1615 1350.0 1365.0 1830.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 697.6384 1045.1 1269.785 1061.241 1178.383 960.0525 1191.417 NA [2,] 882.3616 1384.9 1395.215 1398.759 1326.617 1194.9475 1558.583 NA $out [1] 1655 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(650, 710, 790, 912.5, 1010, 1025, 1072.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6dtqt1426172718.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,] 182.6068 505 182.50 [2,] 211.3612 590 197.50 [3,] 226.5602 685 253.75 [4,] 277.7603 765 347.50 [5,] 286.2961 870 430.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 196.2751 605.1813 185.334 [2,] 256.8453 764.8187 322.166 $out numeric(0) $group numeric(0) $names [1] "S.D." "Range" "IQR" Warning message: In bxp(list(stats = c(182.606785457819, 211.361156509572, 226.56022547649, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1c5co1426172718.ps tmp/1c5co1426172718.png",intern=TRUE)) character(0) > try(system("convert tmp/2f1i71426172718.ps tmp/2f1i71426172718.png",intern=TRUE)) character(0) > try(system("convert tmp/3wc5s1426172718.ps tmp/3wc5s1426172718.png",intern=TRUE)) character(0) > try(system("convert tmp/4q25s1426172718.ps tmp/4q25s1426172718.png",intern=TRUE)) character(0) > try(system("convert tmp/5cciu1426172718.ps tmp/5cciu1426172718.png",intern=TRUE)) character(0) > try(system("convert tmp/6dtqt1426172718.ps tmp/6dtqt1426172718.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.255 0.436 2.720