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(1.5,1.6,1.8,1.5,1.3,1.6,1.6,1.8,1.8,1.6,1.8,2,1.3,1.1,1,1.2,1.2,1.3,1.3,1.4,1.1,0.9,1,1.1,1.4,1.5,1.8,1.8,1.8,1.7,1.5,1.1,1.3,1.6,1.9,1.9,2,2.2,2.2,2,2.3,2.6,3.2,3.2,3.1,2.8,2.3,1.9,1.9,2,2,1.8,1.6,1.4,0.2,0.3,0.4,0.7,1,1.1,0.8,0.8,1,1.1,1,0.8,1.6,1.5,1.6,1.6,1.6,1.9,2,1.9,2,2.1,2.3,2.3,2.6,2.6,2.7,2.6,2.6,2.4,2.5,2.5,2.5,2.4,2.1,2.1,2.3,2.3,2.3,2.9,2.8,2.9,3,3,2.9,2.6,2.8,2.9,3.1,2.8,2.4,1.6,1.5,1.7) > 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] 108 > (np <- floor(n / par1)) [1] 9 > 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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2 0.3 -0.3 0.3 0.0 -0.1 0.6 -0.8 NA [10,] 0.2 0.1 0.3 -0.5 0.3 0.0 0.0 -0.1 -0.1 NA [11,] 0.2 0.1 0.0 -0.4 0.1 0.3 -0.2 0.1 0.2 NA [12,] -0.7 0.3 0.1 0.0 -0.3 0.1 0.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/1kt2u1413213910.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/2qpqp1413213910.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/3otie1413213910.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/4x4871413213910.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] [,12] [1,] 0.8 0.8 1.8 1.1 1.0 0.8 0.2 0.3 0.4 0.7 1.0 1.7 [2,] 1.4 1.5 1.8 1.5 1.3 1.4 1.5 1.4 1.3 1.6 1.5 1.7 [3,] 1.9 1.9 2.0 1.8 1.8 1.7 1.6 1.8 1.8 1.6 1.8 1.9 [4,] 2.0 2.2 2.2 2.1 2.3 2.3 2.6 2.6 2.4 2.6 2.3 2.0 [5,] 2.5 3.0 2.5 2.6 2.8 2.9 3.2 3.2 3.1 2.9 2.8 2.4 $n [1] 9 9 9 9 9 9 9 9 9 9 9 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1.584 1.531333 1.789333 1.484 1.273333 1.226 1.020667 1.168 1.220667 [2,] 2.216 2.268667 2.210667 2.116 2.326667 2.174 2.179333 2.432 2.379333 [,10] [,11] [,12] [1,] 1.073333 1.378667 1.742 [2,] 2.126667 2.221333 2.058 $out [1] 3.0 1.0 1.0 2.9 1.1 1.1 2.9 $group [1] 1 3 3 3 12 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.8, 1.4, 1.9, 2, 2.5, 0.8, 1.5, 1.9, 2.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/51qk51413213910.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.1 -0.1 -0.3 -0.3 -0.2 -0.2 -0.4 -0.4 -0.8 -0.5 -0.2 -0.30 [2,] 0.0 0.0 -0.2 -0.2 -0.1 0.0 -0.1 -0.1 -0.2 -0.1 0.0 -0.15 [3,] 0.0 0.0 -0.1 0.0 0.0 0.2 0.0 0.0 -0.1 0.0 0.1 0.10 [4,] 0.1 0.2 0.1 0.2 0.1 0.3 0.1 0.1 0.3 0.2 0.2 0.10 [5,] 0.2 0.3 0.2 0.3 0.3 0.6 0.2 0.2 0.6 0.3 0.3 0.30 $n [1] 9 9 9 9 9 9 9 9 9 9 9 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.05266667 -0.1053333 -0.258 -0.2106667 -0.1053333 0.042 -0.1053333 [2,] 0.05266667 0.1053333 0.058 0.2106667 0.1053333 0.358 0.1053333 [,8] [,9] [,10] [,11] [,12] [1,] -0.1053333 -0.3633333 -0.158 -0.005333333 -0.03965359 [2,] 0.1053333 0.1633333 0.158 0.205333333 0.23965359 $out [1] -0.2 -1.2 0.8 -0.4 -0.7 $group [1] 1 6 6 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.1, 0, 0, 0.1, 0.2, -0.1, 0, 0, 0.2, 0.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/69q2h1413213910.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] [,10] [1,] 1.30 0.90 1.10 1.90 0.20 0.8 1.90 2.10 1.50 NA [2,] 1.55 1.05 1.45 2.10 0.55 0.9 2.05 2.30 2.05 NA [3,] 1.60 1.15 1.65 2.30 1.25 1.3 2.35 2.45 2.80 NA [4,] 1.80 1.30 1.80 2.95 1.85 1.6 2.60 2.65 2.95 NA [5,] 2.00 1.40 1.90 3.20 2.00 1.9 2.70 2.90 3.10 NA $n [1] 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.485973 1.035973 1.490363 1.912309 0.6570613 0.9807253 2.099141 2.290363 [2,] 1.714027 1.264027 1.809637 2.687691 1.8429387 1.6192747 2.600859 2.609637 [,9] [,10] [1,] 2.389504 NA [2,] 3.210496 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" NA Warning message: In bxp(list(stats = c(1.3, 1.55, 1.6, 1.8, 2, 0.9, 1.05, 1.15, 1.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7hv1c1413213910.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,] 1.811111 1.60 1.700 [2,] 1.827778 1.75 1.825 [3,] 1.850000 1.80 1.850 [4,] 1.883333 1.90 2.000 [5,] 1.933333 2.00 2.100 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1.824661 1.731584 1.770181 [2,] 1.875339 1.868416 1.929819 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1.81111111111111, 1.82777777777778, 1.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1kt2u1413213910.ps tmp/1kt2u1413213910.png",intern=TRUE)) character(0) > try(system("convert tmp/2qpqp1413213910.ps tmp/2qpqp1413213910.png",intern=TRUE)) character(0) > try(system("convert tmp/3otie1413213910.ps tmp/3otie1413213910.png",intern=TRUE)) character(0) > try(system("convert tmp/4x4871413213910.ps tmp/4x4871413213910.png",intern=TRUE)) character(0) > try(system("convert tmp/51qk51413213910.ps tmp/51qk51413213910.png",intern=TRUE)) character(0) > try(system("convert tmp/69q2h1413213910.ps tmp/69q2h1413213910.png",intern=TRUE)) character(0) > try(system("convert tmp/7hv1c1413213910.ps tmp/7hv1c1413213910.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.459 0.459 2.940