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(39.66,40.05,39.99,40.06,40.08,40.1,40.1,40.12,40.07,40.24,40.58,40.72,40.72,40.89,40.9,41.04,41.27,41.29,41.29,41.33,41.34,41.37,41.33,41.37,41.37,41.42,41.61,41.58,41.75,41.75,41.75,41.85,41.84,41.97,42.01,42.04,42.04,42.06,41.93,41.93,41.99,42.03,42.03,42.12,42.22,42.21,42.23,42.22,42.22,42.25,42.27,42.16,42.24,42.26,42.26,42.26,42.36,42.33,42.23,42.23,40.9,40.9,40.87,40.69,40.92,41.05,41.36,41.79,41.82,41.8,41.87,41.87) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 39.66 40.72 41.37 42.04 42.22 40.90 NA [2,] 40.05 40.89 41.42 42.06 42.25 40.90 NA [3,] 39.99 40.90 41.61 41.93 42.27 40.87 NA [4,] 40.06 41.04 41.58 41.93 42.16 40.69 NA [5,] 40.08 41.27 41.75 41.99 42.24 40.92 NA [6,] 40.10 41.29 41.75 42.03 42.26 41.05 NA [7,] 40.10 41.29 41.75 42.03 42.26 41.36 NA [8,] 40.12 41.33 41.85 42.12 42.26 41.79 NA [9,] 40.07 41.34 41.84 42.22 42.36 41.82 NA [10,] 40.24 41.37 41.97 42.21 42.33 41.80 NA [11,] 40.58 41.33 42.01 42.23 42.23 41.87 NA [12,] 40.72 41.37 42.04 42.22 42.23 41.87 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.39 0.17 0.05 0.02 0.03 0.00 NA [2,] -0.06 0.01 0.19 -0.13 0.02 -0.03 NA [3,] 0.07 0.14 -0.03 0.00 -0.11 -0.18 NA [4,] 0.02 0.23 0.17 0.06 0.08 0.23 NA [5,] 0.02 0.02 0.00 0.04 0.02 0.13 NA [6,] 0.00 0.00 0.00 0.00 0.00 0.31 NA [7,] 0.02 0.04 0.10 0.09 0.00 0.43 NA [8,] -0.05 0.01 -0.01 0.10 0.10 0.03 NA [9,] 0.17 0.03 0.13 -0.01 -0.03 -0.02 NA [10,] 0.34 -0.04 0.04 0.02 -0.10 0.07 NA [11,] 0.14 0.04 0.03 -0.01 0.00 0.00 NA [12,] 0.00 0.00 0.00 0.00 -1.33 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/1m50o1413473719.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/286y31413473719.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/3ap501413473719.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/4p52h1413473719.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] [1,] 39.660 40.05 39.990 40.06 40.08 40.10 41.290 41.33 40.07 40.240 40.58 [2,] 40.720 40.89 40.870 40.69 40.92 41.05 41.290 41.33 41.34 41.370 41.33 [3,] 41.135 41.16 41.255 41.31 41.51 41.52 41.555 41.82 41.83 41.885 41.94 [4,] 42.040 42.06 41.930 41.93 41.99 42.03 42.030 42.12 42.22 42.210 42.23 [5,] 42.220 42.25 42.270 42.16 42.24 42.26 42.260 42.26 42.36 42.330 42.23 [,12] [1,] 40.720 [2,] 41.370 [3,] 41.955 [4,] 42.220 [5,] 42.230 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 40.28356 40.40531 40.57127 40.51016 40.81982 40.88787 41.07768 41.31042 [2,] 41.98644 41.91469 41.93873 42.10984 42.20018 42.15213 42.03232 42.32958 [,9] [,10] [,11] [,12] [1,] 41.26237 41.34317 41.35947 41.40672 [2,] 42.39763 42.42683 42.52053 42.50328 $out [1] 40.10 40.12 $group [1] 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(39.66, 40.72, 41.135, 42.04, 42.22, 40.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5tg0t1413473719.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,] 0.00 -0.13 -0.180 0.020 0.00 0 0.000 -0.05 -0.03 -0.10 -0.010 0 [2,] 0.02 -0.06 -0.110 0.060 0.02 0 0.020 -0.01 -0.02 -0.04 0.000 0 [3,] 0.04 -0.01 -0.015 0.125 0.02 0 0.065 0.02 0.01 0.03 0.015 0 [4,] 0.17 0.02 0.070 0.230 0.04 0 0.100 0.10 0.13 0.07 0.040 0 [5,] 0.39 0.02 0.140 0.230 0.04 0 0.100 0.10 0.17 0.07 0.040 0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.05675484 -0.06160258 -0.1311058 0.01534451 0.007099354 0 0.01339742 [2,] 0.13675484 0.04160258 0.1011058 0.23465549 0.032900646 0 0.11660258 [,8] [,9] [,10] [,11] [,12] [1,] -0.05095355 -0.08675484 -0.04095355 -0.01080129 0 [2,] 0.09095355 0.10675484 0.10095355 0.04080129 0 $out [1] 0.19 0.13 0.31 0.43 0.34 0.14 -1.33 $group [1] 2 5 6 7 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0, 0.0200000000000031, 0.0400000000000027, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6zk531413473719.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] [1,] 39.990 40.720 41.370 41.930 42.220 40.690 NA [2,] 40.055 40.970 41.595 42.010 42.230 40.900 NA [3,] 40.090 41.290 41.750 42.050 42.255 41.205 NA [4,] 40.180 41.335 41.910 42.215 42.265 41.810 NA [5,] 40.240 41.370 42.040 42.230 42.270 41.870 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 40.03299 41.12352 41.60633 41.9565 42.23904 40.78994 NA [2,] 40.14701 41.45648 41.89367 42.1435 42.27096 41.62006 NA $out [1] 39.66 40.58 40.72 42.16 42.36 42.33 $group [1] 1 1 1 5 5 5 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(39.99, 40.055, 40.09, 40.18, 40.24, 40.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7wm1l1413473719.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,] 41.15167 41.1350 41.31000 [2,] 41.26167 41.2825 41.38000 [3,] 41.43917 41.5375 41.58438 [4,] 41.63083 41.8575 41.80313 [5,] 41.74167 41.9550 41.83500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 41.27079 41.27524 41.39138 [2,] 41.60755 41.79976 41.77737 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(41.1516666666667, 41.2616666666667, 41.4391666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1m50o1413473719.ps tmp/1m50o1413473719.png",intern=TRUE)) character(0) > try(system("convert tmp/286y31413473719.ps tmp/286y31413473719.png",intern=TRUE)) character(0) > try(system("convert tmp/3ap501413473719.ps tmp/3ap501413473719.png",intern=TRUE)) character(0) > try(system("convert tmp/4p52h1413473719.ps tmp/4p52h1413473719.png",intern=TRUE)) character(0) > try(system("convert tmp/5tg0t1413473719.ps tmp/5tg0t1413473719.png",intern=TRUE)) character(0) > try(system("convert tmp/6zk531413473719.ps tmp/6zk531413473719.png",intern=TRUE)) character(0) > try(system("convert tmp/7wm1l1413473719.ps tmp/7wm1l1413473719.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.552 0.452 3.022