R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-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(462.23,464.79,465.22,468.52,469.02,469.15,469.15,469.15,469.15,469.41,469.45,469.45,469.93,477.19,478.97,480.44,480.56,481.8,483.24,483.45,483.53,483.59,483.59,483.59,492.36,495.71,499.29,499.78,500,500,500.29,500.42,500.61,498.9,499.06,496.61,498.41,501.26,505.4,506.07,506.2,507.14,507.14,507.28,507.34,507.48,506.97,506.97,510.1,515.84,519,520.1,521.26,521.04,521.12,521.12,521.1,521.16,521.14,521.13,522.17,531.39,532.12,533.34,535.72,536.25,536.25,536.68,536.76,536.79,536.99,536.99,542.38,544.1,546.96,547.04,550.27,550.32,551.17,552.83,552.35,552.44,552.47,548.78) > par1 = '12' > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 462.23 469.93 492.36 498.41 510.10 522.17 542.38 NA [2,] 464.79 477.19 495.71 501.26 515.84 531.39 544.10 NA [3,] 465.22 478.97 499.29 505.40 519.00 532.12 546.96 NA [4,] 468.52 480.44 499.78 506.07 520.10 533.34 547.04 NA [5,] 469.02 480.56 500.00 506.20 521.26 535.72 550.27 NA [6,] 469.15 481.80 500.00 507.14 521.04 536.25 550.32 NA [7,] 469.15 483.24 500.29 507.14 521.12 536.25 551.17 NA [8,] 469.15 483.45 500.42 507.28 521.12 536.68 552.83 NA [9,] 469.15 483.53 500.61 507.34 521.10 536.76 552.35 NA [10,] 469.41 483.59 498.90 507.48 521.16 536.79 552.44 NA [11,] 469.45 483.59 499.06 506.97 521.14 536.99 552.47 NA [12,] 469.45 483.59 496.61 506.97 521.13 536.99 548.78 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2.56 7.26 3.35 2.85 5.74 9.22 1.72 NA [2,] 0.43 1.78 3.58 4.14 3.16 0.73 2.86 NA [3,] 3.30 1.47 0.49 0.67 1.10 1.22 0.08 NA [4,] 0.50 0.12 0.22 0.13 1.16 2.38 3.23 NA [5,] 0.13 1.24 0.00 0.94 -0.22 0.53 0.05 NA [6,] 0.00 1.44 0.29 0.00 0.08 0.00 0.85 NA [7,] 0.00 0.21 0.13 0.14 0.00 0.43 1.66 NA [8,] 0.00 0.08 0.19 0.06 -0.02 0.08 -0.48 NA [9,] 0.26 0.06 -1.71 0.14 0.06 0.03 0.09 NA [10,] 0.04 0.00 0.16 -0.51 -0.02 0.20 0.03 NA [11,] 0.00 0.00 -2.45 0.00 -0.01 0.00 -3.69 NA [12,] 0.48 8.77 1.80 3.13 1.04 5.39 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/1vx0n1381745775.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/22lvs1381745775.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/3kzbd1381745775.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/4zavp1381745775.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,] 462.230 464.790 465.22 468.52 469.02 469.150 469.150 469.150 469.15 [2,] 481.145 486.450 489.13 490.11 490.28 490.900 491.765 491.935 492.07 [3,] 498.410 501.260 505.40 506.07 506.20 507.140 507.140 507.280 507.34 [4,] 516.135 523.615 525.56 526.72 528.49 528.645 528.685 528.900 528.93 [5,] 542.380 544.100 546.96 547.04 550.27 550.320 551.170 552.830 552.35 [,10] [,11] [,12] [1,] 469.410 469.450 469.45 [2,] 491.245 491.325 490.10 [3,] 507.480 506.970 506.97 [4,] 528.975 529.065 529.06 [5,] 552.440 552.470 548.78 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 477.5145 479.0657 483.6446 484.2071 483.3816 484.5993 485.092 485.2051 [2,] 519.3055 523.4543 527.1554 527.9329 529.0184 529.6807 529.188 529.3549 [,9] [,10] [,11] [,12] [1,] 485.3278 484.9483 484.4323 483.7037 [2,] 529.3522 530.0117 529.5077 530.2363 $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(462.23, 481.145, 498.41, 516.135, 542.38, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5e3wr1381745775.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] [,12] [1,] 1.720 0.430 0.080 0.120 -0.220 0.00 0.000 -0.02 0.030 -0.02 -2.45 0.480 [2,] 2.705 1.255 0.580 0.175 0.025 0.00 0.065 -0.01 0.045 -0.01 -1.23 1.040 [3,] 3.350 2.860 1.100 0.500 0.130 0.08 0.140 0.06 0.060 0.03 0.00 2.465 [4,] 6.500 3.370 1.345 1.770 0.735 0.57 0.320 0.08 0.115 0.10 0.00 5.390 [5,] 9.220 4.140 1.470 3.230 1.240 0.85 0.430 0.19 0.140 0.20 0.00 8.770 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.083687 1.596956 0.6431543 -0.4525083 -0.2940005 -0.2603948 -0.01228189 [2,] 5.616313 4.123044 1.5568457 1.4525083 0.5540005 0.4203948 0.29228189 [,8] [,9] [,10] [,11] [,12] [1,] 0.006253452 0.01819713 -0.03569023 -0.7345362 -0.3408905 [2,] 0.113746548 0.10180287 0.09569023 0.7345362 5.2708905 $out [1] 3.30 1.44 1.66 -0.48 0.26 -1.71 -0.51 -3.69 $group [1] 3 6 7 8 9 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1.72000000000003, 2.70499999999998, 3.34999999999997, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/62gdp1381745775.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,] 464.79 477.190 495.710 505.400 519.000 531.390 542.380 NA [2,] 466.87 479.705 497.755 505.735 519.550 532.730 547.000 NA [3,] 469.15 482.520 499.535 506.970 521.110 536.250 550.295 NA [4,] 469.28 483.560 500.145 507.210 521.135 536.775 552.395 NA [5,] 469.45 483.590 500.610 507.480 521.260 536.990 552.830 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 468.0508 480.7617 498.4449 506.2972 520.3871 534.405 547.8343 NA [2,] 470.2492 484.2783 500.6251 507.6428 521.8329 538.095 552.7557 NA $out [1] 462.23 469.93 492.36 498.41 501.26 510.10 515.84 522.17 $group [1] 1 2 3 4 4 5 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(464.79, 466.87, 469.15, 469.28, 469.45, 477.19, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/762i61381745775.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,] 504.3257 505.400 505.0325 [2,] 507.3036 505.735 507.8800 [3,] 509.2300 506.970 509.6762 [4,] 509.9600 507.210 510.2100 [5,] 510.1329 507.480 510.5000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 508.0184 506.2972 508.6135 [2,] 510.4416 507.6428 510.7390 $out [1] 499.6543 498.4100 501.2600 498.6400 $group [1] 1 2 2 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(504.325714285714, 507.303571428571, 509.23, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1vx0n1381745775.ps tmp/1vx0n1381745775.png",intern=TRUE)) character(0) > try(system("convert tmp/22lvs1381745775.ps tmp/22lvs1381745775.png",intern=TRUE)) character(0) > try(system("convert tmp/3kzbd1381745775.ps tmp/3kzbd1381745775.png",intern=TRUE)) character(0) > try(system("convert tmp/4zavp1381745775.ps tmp/4zavp1381745775.png",intern=TRUE)) character(0) > try(system("convert tmp/5e3wr1381745775.ps tmp/5e3wr1381745775.png",intern=TRUE)) character(0) > try(system("convert tmp/62gdp1381745775.ps tmp/62gdp1381745775.png",intern=TRUE)) character(0) > try(system("convert tmp/762i61381745775.ps tmp/762i61381745775.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.662 1.010 5.655