R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(530.3,527.76,521.41,1601.93,1577.49,1551.43,1551.43,1516.88,1485.95,1438.22,1385.06,1329.49,1329.49,1276.16,1242.34,1181.59,1160.21,1135.18,1135.18,1084.96,1077.35,1061.13,1029.98,1013.08,1013.08,996.04,975.02,951.89,944.4,932.47,932.47,920.44,900.18,886.9,869.74,859.03,859.03,844.99,834.82,825.62,816.92,813.21,813.21,811.03,804.16,788.62,778.76,765.91,765.91,753.85,742.22,732.11,729.94,731.22,731.22,729.11,726.94,720.52,709.36,703.21) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_meanplot.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)) > darr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > dx <- diff(x) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + darr[j,ari[j]] <- dx[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,] 530.30 1329.49 1013.08 859.03 765.91 NA [2,] 527.76 1276.16 996.04 844.99 753.85 NA [3,] 521.41 1242.34 975.02 834.82 742.22 NA [4,] 1601.93 1181.59 951.89 825.62 732.11 NA [5,] 1577.49 1160.21 944.40 816.92 729.94 NA [6,] 1551.43 1135.18 932.47 813.21 731.22 NA [7,] 1551.43 1135.18 932.47 813.21 731.22 NA [8,] 1516.88 1084.96 920.44 811.03 729.11 NA [9,] 1485.95 1077.35 900.18 804.16 726.94 NA [10,] 1438.22 1061.13 886.90 788.62 720.52 NA [11,] 1385.06 1029.98 869.74 778.76 709.36 NA [12,] 1329.49 1013.08 859.03 765.91 703.21 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] -2.54 -53.33 -17.04 -14.04 -12.06 NA [2,] -6.35 -33.82 -21.02 -10.17 -11.63 NA [3,] 1080.52 -60.75 -23.13 -9.20 -10.11 NA [4,] -24.44 -21.38 -7.49 -8.70 -2.17 NA [5,] -26.06 -25.03 -11.93 -3.71 1.28 NA [6,] 0.00 0.00 0.00 0.00 0.00 NA [7,] -34.55 -50.22 -12.03 -2.18 -2.11 NA [8,] -30.93 -7.61 -20.26 -6.87 -2.17 NA [9,] -47.73 -16.22 -13.28 -15.54 -6.42 NA [10,] -53.16 -31.15 -17.16 -9.86 -11.16 NA [11,] -55.57 -16.90 -10.71 -12.85 -6.15 NA [12,] 0.00 0.00 0.00 0.00 NA NA > arr.mean <- array(NA,dim=par1) > arr.median <- array(NA,dim=par1) > arr.midrange <- array(NA,dim=par1) > for (j in 1:par1) + { + arr.mean[j] <- mean(arr[j,],na.rm=TRUE) + arr.median[j] <- median(arr[j,],na.rm=TRUE) + arr.midrange[j] <- (quantile(arr[j,],0.75,na.rm=TRUE) + quantile(arr[j,],0.25,na.rm=TRUE)) / 2 + } > overall.mean <- mean(x) > overall.median <- median(x) > overall.midrange <- (quantile(x,0.75) + quantile(x,0.25)) / 2 > postscript(file="/var/wessaorg/rcomp/tmp/1zvkp1333573777.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.mean,type='b',ylab='mean',main='Mean Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.mean,0) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/24i8s1333573777.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.median,type='b',ylab='median',main='Median Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.median,0) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3f4dk1333573777.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(arr.midrange,type='b',ylab='midrange',main='Midrange Plot',xlab='Periodic Index') > mtext(paste('#blocks = ',np)) > abline(overall.midrange,0) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/4ja4e1333573777.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] [1,] 530.30 527.76 521.41 732.11 729.94 731.22 731.22 729.11 726.94 [2,] 765.91 753.85 742.22 825.62 816.92 813.21 813.21 811.03 804.16 [3,] 859.03 844.99 834.82 951.89 944.40 932.47 932.47 920.44 900.18 [4,] 1013.08 996.04 975.02 1181.59 1160.21 1135.18 1135.18 1084.96 1077.35 [5,] 1329.49 1276.16 1242.34 1601.93 1577.49 1551.43 1551.43 1084.96 1485.95 [,10] [,11] [,12] [1,] 720.52 709.36 703.21 [2,] 788.62 778.76 765.91 [3,] 886.90 869.74 859.03 [4,] 1061.13 1029.98 1013.08 [5,] 1438.22 1385.06 1329.49 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 684.3803 673.8592 670.3241 700.3625 701.8322 704.9668 704.9668 [2,] 1033.6797 1016.1208 999.3159 1203.4175 1186.9678 1159.9732 1159.9732 [,8] [,9] [,10] [,11] [,12] [1,] 726.8818 707.1446 694.3451 692.2286 684.3803 [2,] 1113.9982 1093.2154 1079.4549 1047.2514 1033.6797 $out [1] 1516.88 $group [1] 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(530.3, 765.91, 859.03, 1013.08, 1329.49, 527.76, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/55yn71333573777.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(t(darr)) > names(z) <- c(1:par1) > (boxplot(z,notch=TRUE,col='grey',xlab='Periodic Index',ylab='Value',main='Notched Box Plots - Differenced Periodic Subseries')) $stats [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -17.04 -33.82 -23.13 -24.44 -26.06 0 -50.22 -30.93 -16.22 -53.16 -16.90 [2,] -17.04 -21.02 -23.13 -21.38 -25.03 0 -34.55 -20.26 -16.22 -31.15 -16.90 [3,] -14.04 -11.63 -10.11 -8.70 -11.93 0 -12.03 -7.61 -15.54 -17.16 -12.85 [4,] -12.06 -10.17 -9.20 -7.49 -3.71 0 -2.18 -6.87 -13.28 -11.16 -10.71 [5,] -12.06 -6.35 -9.20 -2.17 1.28 0 -2.11 -2.17 -13.28 -9.86 -6.15 [,12] [1,] 0 [2,] 0 [3,] 0 [4,] 0 [5,] 0 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -17.55886 -19.296583 -19.9529029 -18.514639 -26.994658 0 -34.90256 [2,] -10.52114 -3.963417 -0.2670971 1.114639 3.134658 0 10.84256 [,8] [,9] [,10] [,11] [,12] [1,] -17.07134 -17.6174 -31.284884 -17.223838 0 [2,] 1.85134 -13.4626 -3.035116 -8.476162 0 $out [1] -2.54 -53.33 1080.52 -60.75 -47.73 -6.42 -55.57 $group [1] 1 1 3 3 9 9 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-17.0400000000001, -17.0400000000001, -14.04, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6q4uj1333573777.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,] 521.410 1013.080 859.030 765.91 709.360 NA [2,] 929.895 1069.240 893.540 796.39 723.730 NA [3,] 1462.085 1135.180 932.470 813.21 730.580 NA [4,] 1551.430 1211.965 963.455 830.22 737.165 NA [5,] 1601.930 1329.490 1013.080 859.03 753.850 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1178.599 1070.082 900.5813 797.7799 724.4522 NA [2,] 1745.571 1200.278 964.3587 828.6401 736.7078 NA $out [1] 765.91 703.21 $group [1] 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(521.41, 929.895, 1462.085, 1551.43, 1601.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7xri91333573777.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > z <- data.frame(cbind(arr.mean,arr.median,arr.midrange)) > names(z) <- list('mean','median','midrange') > (boxplot(z,notch=TRUE,col='grey',ylab='Overall Central Tendency',main='Notched Box Plots')) $stats [,1] [,2] [,3] [1,] 863.162 834.82 858.620 [2,] 916.853 859.03 889.495 [3,] 988.997 893.54 932.815 [4,] 1032.702 932.47 974.195 [5,] 1058.628 951.89 1003.605 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 936.1575 860.0435 894.1828 [2,] 1041.8365 927.0365 971.4472 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(863.162, 916.853, 988.997, 1032.702, 1058.628, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1zvkp1333573777.ps tmp/1zvkp1333573777.png",intern=TRUE)) character(0) > try(system("convert tmp/24i8s1333573777.ps tmp/24i8s1333573777.png",intern=TRUE)) character(0) > try(system("convert tmp/3f4dk1333573777.ps tmp/3f4dk1333573777.png",intern=TRUE)) character(0) > try(system("convert tmp/4ja4e1333573777.ps tmp/4ja4e1333573777.png",intern=TRUE)) character(0) > try(system("convert tmp/55yn71333573777.ps tmp/55yn71333573777.png",intern=TRUE)) character(0) > try(system("convert tmp/6q4uj1333573777.ps tmp/6q4uj1333573777.png",intern=TRUE)) character(0) > try(system("convert tmp/7xri91333573777.ps tmp/7xri91333573777.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.557 0.357 1.922