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(167.8,166.2,156,149.3,147.4,144.3,143.5,142.6,137.8,137.6,137.2,137,137,136.7,136.3,135.1,134.6,133.8,133.7,133.5,133.4,133.3,133.3,133.3,132,131.4,130.9,129.9,129.5,129.3,128.7,128,127.9,127.3,127,126.2,126,125.5,124.6,123.6,122.3,118,117.4,115.7,114.7,114.7,113.7,112.8,106.8,106.7,103.9,103.3,100.2,98,97.6,96.9,96.3,96.2,95.7,94.7,94.6,94.3,94.2,93.6,93,91.5,90.7,90.7,90.4,88.8,87.6,86.8,86.3,86.3,86.3,86.1,82.4,82.3,81.8,78.7,78.2,77.3,77.1,76.6,75.7,73.8,73.7,73,72.7,67.5,67.5,63.3,59.1,54.6,52.9,52.4) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 167.8 137.0 132.0 126.0 106.8 94.6 86.3 75.7 NA [2,] 166.2 136.7 131.4 125.5 106.7 94.3 86.3 73.8 NA [3,] 156.0 136.3 130.9 124.6 103.9 94.2 86.3 73.7 NA [4,] 149.3 135.1 129.9 123.6 103.3 93.6 86.1 73.0 NA [5,] 147.4 134.6 129.5 122.3 100.2 93.0 82.4 72.7 NA [6,] 144.3 133.8 129.3 118.0 98.0 91.5 82.3 67.5 NA [7,] 143.5 133.7 128.7 117.4 97.6 90.7 81.8 67.5 NA [8,] 142.6 133.5 128.0 115.7 96.9 90.7 78.7 63.3 NA [9,] 137.8 133.4 127.9 114.7 96.3 90.4 78.2 59.1 NA [10,] 137.6 133.3 127.3 114.7 96.2 88.8 77.3 54.6 NA [11,] 137.2 133.3 127.0 113.7 95.7 87.6 77.1 52.9 NA [12,] 137.0 133.3 126.2 112.8 94.7 86.8 76.6 52.4 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -1.6 -0.3 -0.6 -0.5 -0.1 -0.3 0.0 -1.9 NA [2,] -10.2 -0.4 -0.5 -0.9 -2.8 -0.1 0.0 -0.1 NA [3,] -6.7 -1.2 -1.0 -1.0 -0.6 -0.6 -0.2 -0.7 NA [4,] -1.9 -0.5 -0.4 -1.3 -3.1 -0.6 -3.7 -0.3 NA [5,] -3.1 -0.8 -0.2 -4.3 -2.2 -1.5 -0.1 -5.2 NA [6,] -0.8 -0.1 -0.6 -0.6 -0.4 -0.8 -0.5 0.0 NA [7,] -0.9 -0.2 -0.7 -1.7 -0.7 0.0 -3.1 -4.2 NA [8,] -4.8 -0.1 -0.1 -1.0 -0.6 -0.3 -0.5 -4.2 NA [9,] -0.2 -0.1 -0.6 0.0 -0.1 -1.6 -0.9 -4.5 NA [10,] -0.4 0.0 -0.3 -1.0 -0.5 -1.2 -0.2 -1.7 NA [11,] -0.2 0.0 -0.8 -0.9 -1.0 -0.8 -0.5 -0.5 NA [12,] 0.0 -1.3 -0.2 -6.0 -0.1 -0.5 -0.9 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/15jhf1424708847.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/278di1424708847.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/3s6on1424708847.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/4hhrx1424708847.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,] 75.70 73.80 73.70 73.00 72.70 67.50 67.50 63.30 59.10 54.60 [2,] 90.45 90.30 90.25 89.85 87.70 86.90 86.25 84.70 84.30 83.05 [3,] 116.40 116.10 114.25 113.45 111.25 108.00 107.50 106.30 105.50 105.45 [4,] 134.50 134.05 133.60 132.50 132.05 131.55 131.20 130.75 130.65 130.30 [5,] 167.80 166.20 156.00 149.30 147.40 144.30 143.50 142.60 137.80 137.60 [,11] [,12] [1,] 52.90 52.40 [2,] 82.35 81.70 [3,] 104.70 103.75 [4,] 130.15 129.75 [5,] 137.20 137.00 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 91.79304 91.66062 90.03407 89.6251 86.47545 83.05787 82.39028 [2,] 141.00696 140.53938 138.46593 137.2749 136.02455 132.94213 132.60972 [,8] [,9] [,10] [,11] [,12] [1,] 80.57581 79.60822 79.05547 77.99823 76.90858 [2,] 132.02419 131.39178 131.84453 131.40177 130.59142 $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(75.7, 90.45, 116.4, 134.5, 167.8, 73.8, 90.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5uhxn1424708847.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.9 -2.80 -1.20 -3.70 -5.20 -0.80 -4.20 -4.80 -1.60 -1.70 -1.00 -1.30 [2,] -1.1 -1.85 -1.10 -2.50 -3.70 -0.70 -2.40 -2.60 -1.25 -1.10 -0.85 -1.10 [3,] -0.4 -0.45 -0.85 -0.95 -1.85 -0.55 -0.80 -0.55 -0.40 -0.45 -0.65 -0.50 [4,] -0.2 -0.10 -0.60 -0.45 -0.50 -0.25 -0.45 -0.20 -0.10 -0.25 -0.35 -0.15 [5,] 0.0 0.00 -0.20 -0.30 -0.10 0.00 0.00 -0.10 0.00 0.00 0.00 0.00 $n [1] 8 8 8 8 8 8 8 8 8 8 8 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.9027529 -1.4275751 -1.1293072 -2.0951594 -3.63756594 -0.8013765 [2,] 0.1027529 0.5275751 -0.5706928 0.1951594 -0.06243406 -0.2986235 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -1.889298 -1.8906745 -1.0424065 -0.9248222 -0.9293072 -1.06732467 [2,] 0.289298 0.7906745 0.2424065 0.0248222 -0.3706928 0.06732467 $out [1] -10.2 -6.7 -4.5 -6.0 $group [1] 2 3 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-1.90000000000001, -1.10000000000001, -0.400000000000006, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6a7851424708847.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] [,9] [1,] 137.00 133.30 126.2 112.8 94.70 86.8 76.60 52.40 NA [2,] 137.70 133.35 127.6 114.7 96.25 89.6 77.75 56.85 NA [3,] 143.90 133.75 129.0 117.7 97.80 91.1 82.05 67.50 NA [4,] 152.65 135.70 130.4 124.1 103.60 93.9 86.20 73.35 NA [5,] 167.80 137.00 132.0 126.0 106.80 94.6 86.30 75.70 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 137.0812 132.6781 127.7229 113.4126 94.44762 89.13874 78.1959 59.97424 [2,] 150.7188 134.8219 130.2771 121.9874 101.15238 93.06126 85.9041 75.02576 [,9] [1,] NA [2,] NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(137, 137.7, 143.9, 152.65, 167.8, 133.3, 133.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7e0cr1424708847.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,] 102.4750 103.750 106.1125 [2,] 104.2250 105.475 107.8375 [3,] 107.8500 107.750 109.5125 [4,] 112.4875 113.850 111.8500 [5,] 115.7750 116.400 112.8875 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 104.0814 103.9301 107.6824 [2,] 111.6186 111.5699 111.3426 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(102.475, 104.225, 107.85, 112.4875, 115.775, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/15jhf1424708847.ps tmp/15jhf1424708847.png",intern=TRUE)) character(0) > try(system("convert tmp/278di1424708847.ps tmp/278di1424708847.png",intern=TRUE)) character(0) > try(system("convert tmp/3s6on1424708847.ps tmp/3s6on1424708847.png",intern=TRUE)) character(0) > try(system("convert tmp/4hhrx1424708847.ps tmp/4hhrx1424708847.png",intern=TRUE)) character(0) > try(system("convert tmp/5uhxn1424708847.ps tmp/5uhxn1424708847.png",intern=TRUE)) character(0) > try(system("convert tmp/6a7851424708847.ps tmp/6a7851424708847.png",intern=TRUE)) character(0) > try(system("convert tmp/7e0cr1424708847.ps tmp/7e0cr1424708847.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.462 0.465 2.945