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(102.9,103.2,103.1,103.6,104.2,104.9,104.5,103.9,102.8,100.8,99,97.8,96.4,96.1,96,95.6,95.7,95.7,95.5,95.1,95.1,94.6,95,95,95.8,96.1,96.5,96.8,97.7,98.9,100,101.1,102,103.8,104.9,106.3,108.9,110.4,111.3,112.2,112.9,113,113.4,112.4,112.4,112.2,112.6,112.7,113.8,114.1,114.7,115.3,115.6,116.2,117.5,118.5,119.3,120,120.1,119.8,119.9,119.8,119.3,119,118.9,119,119.3,119.2,118.6,117,117.4,117.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] 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,] 102.9 96.4 95.8 108.9 113.8 119.9 NA [2,] 103.2 96.1 96.1 110.4 114.1 119.8 NA [3,] 103.1 96.0 96.5 111.3 114.7 119.3 NA [4,] 103.6 95.6 96.8 112.2 115.3 119.0 NA [5,] 104.2 95.7 97.7 112.9 115.6 118.9 NA [6,] 104.9 95.7 98.9 113.0 116.2 119.0 NA [7,] 104.5 95.5 100.0 113.4 117.5 119.3 NA [8,] 103.9 95.1 101.1 112.4 118.5 119.2 NA [9,] 102.8 95.1 102.0 112.4 119.3 118.6 NA [10,] 100.8 94.6 103.8 112.2 120.0 117.0 NA [11,] 99.0 95.0 104.9 112.6 120.1 117.4 NA [12,] 97.8 95.0 106.3 112.7 119.8 117.4 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.3 -0.3 0.3 1.5 0.3 -0.1 NA [2,] -0.1 -0.1 0.4 0.9 0.6 -0.5 NA [3,] 0.5 -0.4 0.3 0.9 0.6 -0.3 NA [4,] 0.6 0.1 0.9 0.7 0.3 -0.1 NA [5,] 0.7 0.0 1.2 0.1 0.6 0.1 NA [6,] -0.4 -0.2 1.1 0.4 1.3 0.3 NA [7,] -0.6 -0.4 1.1 -1.0 1.0 -0.1 NA [8,] -1.1 0.0 0.9 0.0 0.8 -0.6 NA [9,] -2.0 -0.5 1.8 -0.2 0.7 -1.6 NA [10,] -1.8 0.4 1.1 0.4 0.1 0.4 NA [11,] -1.2 0.0 1.4 0.1 -0.3 0.0 NA [12,] -1.4 0.8 2.6 1.1 0.1 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/1xghe1412791767.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/2iyor1412791767.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/39uw31412791767.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/4e8y01412791767.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,] 95.8 96.1 96.0 95.6 95.70 95.70 95.50 95.10 95.1 94.6 95.00 [2,] 96.4 96.1 96.5 96.8 97.70 98.90 100.00 101.10 102.0 100.8 99.00 [3,] 105.9 106.8 107.2 107.9 108.55 108.95 108.95 108.15 107.6 108.0 108.75 [4,] 113.8 114.1 114.7 115.3 115.60 116.20 117.50 118.50 118.6 117.0 117.40 [5,] 119.9 119.8 119.3 119.0 118.90 119.00 119.30 119.20 119.3 120.0 120.10 [,12] [1,] 95.0 [2,] 97.8 [3,] 109.5 [4,] 117.4 [5,] 119.8 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 94.67644 95.18942 95.46041 95.9669 97.00392 97.79094 97.66193 [2,] 117.12356 118.41058 118.93959 119.8331 120.09608 120.10906 120.23807 [,8] [,9] [,10] [,11] [,12] [1,] 96.92644 96.89246 97.55048 96.88141 96.85737 [2,] 119.37356 118.30754 118.44952 120.61859 122.14263 $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(95.8, 96.4, 105.9, 113.8, 119.9, 96.1, 96.1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5tw7a1412791767.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.3 -0.50 -0.4 -0.10 0.00 -0.40 -1.00 -1.1 -2.00 0.1 -0.3 0.1 [2,] -0.1 -0.10 -0.3 0.10 0.10 -0.20 -0.60 -0.6 -1.60 0.1 -0.3 0.1 [3,] 0.3 0.15 0.4 0.45 0.35 0.35 -0.25 0.0 -0.35 0.4 0.0 0.8 [4,] 0.3 0.60 0.6 0.70 0.70 1.10 1.00 0.8 0.70 0.4 0.1 1.1 [5,] 0.3 0.90 0.9 0.90 1.20 1.30 1.10 0.9 1.80 0.4 0.1 1.1 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.04198708 -0.3015226 -0.1805291 0.06298062 -0.03701938 -0.488542 [2,] 0.55801292 0.6015226 0.9805291 0.83701938 0.73701938 1.188542 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -1.2820517 -0.9030452 -1.833574 0.2064903 -0.2580129 0.09340252 [2,] 0.7820517 0.9030452 1.133574 0.5935097 0.2580129 1.50659748 $out [1] 1.5 -1.8 1.1 -1.2 1.4 -1.4 2.6 $group [1] 1 10 10 11 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.300000000000011, -0.100000000000009, 0.299999999999997, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6qgzi1412791767.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,] 99.00 94.60 95.80 110.40 113.80 117.0 NA [2,] 101.80 95.05 96.65 111.75 115.00 118.0 NA [3,] 103.15 95.55 99.45 112.40 116.85 119.0 NA [4,] 104.05 95.85 102.90 112.80 119.55 119.3 NA [5,] 104.90 96.40 106.30 113.40 120.10 119.9 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 102.1238 95.18511 96.59933 111.9211 114.7747 118.4071 NA [2,] 104.1762 95.91489 102.30067 112.8789 118.9253 119.5929 NA $out [1] 97.8 108.9 $group [1] 1 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(99, 101.8, 103.15, 104.05, 104.9, 94.6, 95.05, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7wa4m1412791767.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,] 106.2833 105.900 105.3000 [2,] 106.9500 107.400 106.2562 [3,] 108.0083 108.075 107.9875 [4,] 108.2667 108.850 108.7375 [5,] 108.3667 109.500 109.6250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 107.4078 107.4136 106.8558 [2,] 108.6089 108.7364 109.1192 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(106.283333333333, 106.95, 108.008333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1xghe1412791767.ps tmp/1xghe1412791767.png",intern=TRUE)) character(0) > try(system("convert tmp/2iyor1412791767.ps tmp/2iyor1412791767.png",intern=TRUE)) character(0) > try(system("convert tmp/39uw31412791767.ps tmp/39uw31412791767.png",intern=TRUE)) character(0) > try(system("convert tmp/4e8y01412791767.ps tmp/4e8y01412791767.png",intern=TRUE)) character(0) > try(system("convert tmp/5tw7a1412791767.ps tmp/5tw7a1412791767.png",intern=TRUE)) character(0) > try(system("convert tmp/6qgzi1412791767.ps tmp/6qgzi1412791767.png",intern=TRUE)) character(0) > try(system("convert tmp/7wa4m1412791767.ps tmp/7wa4m1412791767.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.472 0.439 2.954