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(120.6,119.9,119.48,117.45,118.37,117.07,114.98,112.59,111.7,112.04,110.79,109.82,109.11,109.84,109.31,108.29,107.42,106.71,105.11,104.43,105.55,106.12,105.78,105.33,104.63,104.62,105.57,107.5,107.52,107.76,106.74,106.21,105.77,105.27,104.35,103.52,102.28,100.93,101.04,99.95,99.55,99.56,99.01,98.64,98.98,100.8,100.32,100.72,280.8,280.4,280.4,280.3,281,280.9,279.7,283.1,290.6,291.6,291.7,291.8,291.7,291.5,291.7,293.4,293.1,293.1,292.6,292.1,292.2,292,292.1,293.4,292.2,292.1,291.6,290.9,290.9,290.8,290.5,290,290.2,290.1,291,291.8) > 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,] 120.60 109.11 104.63 102.28 280.8 291.7 292.2 NA [2,] 119.90 109.84 104.62 100.93 280.4 291.5 292.1 NA [3,] 119.48 109.31 105.57 101.04 280.4 291.7 291.6 NA [4,] 117.45 108.29 107.50 99.95 280.3 293.4 290.9 NA [5,] 118.37 107.42 107.52 99.55 281.0 293.1 290.9 NA [6,] 117.07 106.71 107.76 99.56 280.9 293.1 290.8 NA [7,] 114.98 105.11 106.74 99.01 279.7 292.6 290.5 NA [8,] 112.59 104.43 106.21 98.64 283.1 292.1 290.0 NA [9,] 111.70 105.55 105.77 98.98 290.6 292.2 290.2 NA [10,] 112.04 106.12 105.27 100.80 291.6 292.0 290.1 NA [11,] 110.79 105.78 104.35 100.32 291.7 292.1 291.0 NA [12,] 109.82 105.33 103.52 100.72 291.8 293.4 291.8 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -0.70 0.73 -0.01 -1.35 -0.4 -0.2 -0.1 NA [2,] -0.42 -0.53 0.95 0.11 0.0 0.2 -0.5 NA [3,] -2.03 -1.02 1.93 -1.09 -0.1 1.7 -0.7 NA [4,] 0.92 -0.87 0.02 -0.40 0.7 -0.3 0.0 NA [5,] -1.30 -0.71 0.24 0.01 -0.1 0.0 -0.1 NA [6,] -2.09 -1.60 -1.02 -0.55 -1.2 -0.5 -0.3 NA [7,] -2.39 -0.68 -0.53 -0.37 3.4 -0.5 -0.5 NA [8,] -0.89 1.12 -0.44 0.34 7.5 0.1 0.2 NA [9,] 0.34 0.57 -0.50 1.82 1.0 -0.2 -0.1 NA [10,] -1.25 -0.34 -0.92 -0.48 0.1 0.1 0.9 NA [11,] -0.97 -0.45 -0.83 0.40 0.1 1.3 0.8 NA [12,] -0.71 -0.70 -1.24 180.08 -0.1 -1.2 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/fisher/rcomp/tmp/1ubxw1384789345.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/fisher/rcomp/tmp/2r2nb1384789345.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/fisher/rcomp/tmp/3o8ys1384789345.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/fisher/rcomp/tmp/4a6j81384789345.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] [1,] 102.28 100.93 101.04 99.950 99.55 99.560 99.010 98.64 98.98 100.800 [2,] 106.87 107.23 107.44 107.895 107.47 107.235 105.925 105.32 105.66 105.695 [3,] 120.60 119.90 119.48 117.450 118.37 117.070 114.980 112.59 111.70 112.040 [4,] 286.25 285.95 286.00 285.600 285.95 285.850 285.100 286.55 290.40 290.850 [5,] 292.20 292.10 291.70 293.400 293.10 293.100 292.600 292.10 292.20 292.000 [,11] [,12] [1,] 100.320 100.720 [2,] 105.065 104.425 [3,] 110.790 109.820 [4,] 291.350 291.800 [5,] 292.100 293.400 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 13.47716 13.1713 12.84685 11.32744 11.78462 10.404 7.979581 [2,] 227.72284 226.6287 226.11315 223.57256 224.95538 223.736 221.980419 [,8] [,9] [,10] [,11] [,12] [1,] 4.362368 1.376252 1.468421 -0.4563967 -2.077327 [2,] 220.817632 222.023748 222.611579 222.0363967 221.717327 $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(102.28, 106.87, 120.6, 286.25, 292.2, 100.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5nlfq1384789345.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,] -0.700 -0.530 -2.030 -0.87 -0.710 -2.090 -0.680 -0.89 -0.500 -1.25 -0.97 [2,] -0.550 -0.460 -1.055 -0.35 -0.405 -1.400 -0.605 -0.17 -0.150 -0.70 -0.64 [3,] -0.200 0.000 -0.700 0.00 -0.100 -1.020 -0.500 0.20 0.340 -0.34 0.10 [4,] -0.055 0.155 0.800 0.36 0.005 -0.525 -0.435 0.73 0.785 0.10 0.60 [5,] -0.010 0.950 1.930 0.92 0.240 -0.300 -0.370 1.12 1.820 0.90 1.30 [,12] [1,] -1.240 [2,] -1.200 [3,] -0.705 [4,] -0.100 [5,] -0.100 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.49560601 -0.3672681 -1.8077761 -0.4240005 -0.3448454 -1.5425359 [2,] 0.09560601 0.3672681 0.4077761 0.4240005 0.1448454 -0.4974641 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.6015213 -0.3374655 -0.2183669 -0.8177471 -0.640508 -1.414535529 [2,] -0.3984787 0.7374655 0.8983669 0.1377471 0.840508 0.004535529 $out [1] 0.73 -1.35 -1.30 -2.39 3.40 7.50 180.08 $group [1] 1 1 5 7 7 8 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.699999999999989, -0.550000000000011, -0.199999999999989, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6kfo41384789345.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,] 109.820 104.430 103.520 98.640 279.70 291.50 290.00 NA [2,] 111.870 105.440 104.625 99.280 280.40 291.85 290.35 NA [3,] 116.025 106.415 105.670 100.135 280.95 292.15 290.90 NA [4,] 118.925 108.700 107.120 100.865 291.10 293.10 291.70 NA [5,] 120.600 109.840 107.760 102.280 291.80 293.40 292.20 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 112.8072 104.9281 104.532 99.41207 276.0697 291.5799 290.2843 NA [2,] 119.2428 107.9019 106.808 100.85793 285.8303 292.7201 291.5157 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(109.82, 111.87, 116.025, 118.925, 120.6, 104.43, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7a5bk1384789345.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,] 185.0000 109.820 195.5125 [2,] 185.0643 111.870 196.5513 [3,] 185.2986 116.025 196.7150 [4,] 185.5021 118.925 198.0712 [5,] 185.9029 120.600 198.2725 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 185.0989 112.8072 196.0217 [2,] 185.4983 119.2428 197.4083 $out [1] 184.0914 183.8671 $group [1] 1 1 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(185, 185.064285714286, 185.298571428571, 185.502142857143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ubxw1384789345.ps tmp/1ubxw1384789345.png",intern=TRUE)) character(0) > try(system("convert tmp/2r2nb1384789345.ps tmp/2r2nb1384789345.png",intern=TRUE)) character(0) > try(system("convert tmp/3o8ys1384789345.ps tmp/3o8ys1384789345.png",intern=TRUE)) character(0) > try(system("convert tmp/4a6j81384789345.ps tmp/4a6j81384789345.png",intern=TRUE)) character(0) > try(system("convert tmp/5nlfq1384789345.ps tmp/5nlfq1384789345.png",intern=TRUE)) character(0) > try(system("convert tmp/6kfo41384789345.ps tmp/6kfo41384789345.png",intern=TRUE)) character(0) > try(system("convert tmp/7a5bk1384789345.ps tmp/7a5bk1384789345.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.925 0.852 4.760