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(2.7,3,-0.3,1.1,1.7,1.6,3,3.3,6.7,5.6,6,4.8,5.9,4.3,3.7,5.6,1.7,3.2,3.6,1.7,0.5,2.1,1.5,2.7,1.4,1.2,2.3,1.6,4.7,3.5,4.4,3.9,3.5,3,1.6,2.2,4.1,4.3,3.5,1.8,0.6,-0.4,-2.5,-1.6,-1.9,-1.6,-0.7,-1.1,0.3,1.3,3.3,2.4,2,3.9,4.2,4.9,5.8,4.8,4.4,5.3,2.1,2,-0.9,0.1,-0.5,-0.1,0.7,-0.4,-1.5,-0.3,1,0.4,0.3,1.8,3,2.2,3.4,3.4,3.1,4.5,4.6,5.7,4.3,4.5) > 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,] 2.7 5.9 1.4 4.1 0.3 2.1 0.3 NA [2,] 3.0 4.3 1.2 4.3 1.3 2.0 1.8 NA [3,] -0.3 3.7 2.3 3.5 3.3 -0.9 3.0 NA [4,] 1.1 5.6 1.6 1.8 2.4 0.1 2.2 NA [5,] 1.7 1.7 4.7 0.6 2.0 -0.5 3.4 NA [6,] 1.6 3.2 3.5 -0.4 3.9 -0.1 3.4 NA [7,] 3.0 3.6 4.4 -2.5 4.2 0.7 3.1 NA [8,] 3.3 1.7 3.9 -1.6 4.9 -0.4 4.5 NA [9,] 6.7 0.5 3.5 -1.9 5.8 -1.5 4.6 NA [10,] 5.6 2.1 3.0 -1.6 4.8 -0.3 5.7 NA [11,] 6.0 1.5 1.6 -0.7 4.4 1.0 4.3 NA [12,] 4.8 2.7 2.2 -1.1 5.3 0.4 4.5 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.3 -1.6 -0.2 0.2 1.0 -0.1 1.5 NA [2,] -3.3 -0.6 1.1 -0.8 2.0 -2.9 1.2 NA [3,] 1.4 1.9 -0.7 -1.7 -0.9 1.0 -0.8 NA [4,] 0.6 -3.9 3.1 -1.2 -0.4 -0.6 1.2 NA [5,] -0.1 1.5 -1.2 -1.0 1.9 0.4 0.0 NA [6,] 1.4 0.4 0.9 -2.1 0.3 0.8 -0.3 NA [7,] 0.3 -1.9 -0.5 0.9 0.7 -1.1 1.4 NA [8,] 3.4 -1.2 -0.4 -0.3 0.9 -1.1 0.1 NA [9,] -1.1 1.6 -0.5 0.3 -1.0 1.2 1.1 NA [10,] 0.4 -0.6 -1.4 0.9 -0.4 1.3 -1.4 NA [11,] -1.2 1.2 0.6 -0.4 0.9 -0.6 0.2 NA [12,] 1.1 -1.3 1.9 1.4 -3.2 -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/fisher/rcomp/tmp/1i4za1382097724.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/2c86l1382097724.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/38cc91382097724.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/4wd0m1382097724.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.30 1.20 -0.9 0.10 -0.50 -0.40 0.70 -1.60 -1.9 -1.6 -0.70 -1.10 [2,] 0.85 1.55 1.0 1.35 1.15 0.75 1.85 0.65 -0.5 0.9 1.25 1.30 [3,] 2.10 2.00 3.0 1.80 1.70 3.20 3.10 3.30 3.5 3.0 1.60 2.70 [4,] 3.40 3.65 3.4 2.30 2.70 3.45 3.90 4.20 5.2 5.2 4.35 4.65 [5,] 5.90 4.30 3.7 2.40 4.70 3.90 4.40 4.90 6.7 5.7 6.00 5.30 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.5771811 0.7459139 1.566759 1.232675 0.774365 1.587604 1.875773 1.179997 [2,] 3.6228189 3.2540861 4.433241 2.367325 2.625635 4.812396 4.324227 5.420003 [,9] [,10] [,11] [,12] [1,] 0.09605196 0.4321094 -0.25127 0.699434 [2,] 6.90394804 5.5678906 3.45127 4.700566 $out [1] 5.6 -2.5 $group [1] 4 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.3, 0.85, 2.1, 3.4, 5.9, 1.2, 1.55, 2, 3.65, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5p2al1382097724.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.20 -3.30 -1.70 -1.2 -1.20 -3.000000e-01 -1.9 -1.20 -1.10 -1.40 -1.20 [2,] -0.15 -1.85 -0.85 -0.9 -0.55 2.220446e-16 -0.8 -0.75 -0.75 -1.00 -0.50 [3,] 0.20 -0.60 -0.70 -0.4 0.00 4.000000e-01 0.3 -0.30 0.30 -0.40 0.20 [4,] 0.65 1.15 1.20 0.9 0.95 8.500000e-01 0.8 0.50 1.15 0.65 0.75 [5,] 1.50 2.00 1.90 3.1 1.90 1.400000e+00 1.4 0.90 1.60 1.30 1.20 [,12] [1,] -3.2 [2,] -1.3 [3,] 0.5 [4,] 1.4 [5,] 1.9 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.2777471 -2.391552 -1.9242269 -1.474931 -0.8957758 -0.1076063 -0.6554942 [2,] 0.6777471 1.191552 0.5242269 0.674931 0.8957758 0.9076063 1.2554942 [,8] [,9] [,10] [,11] [,12] [1,] -1.0464798 -0.8346493 -1.3853534 -0.5464798 -1.241587 [2,] 0.4464798 1.4346493 0.5853534 0.9464798 2.241587 $out [1] -1.6 -3.9 -2.1 3.4 $group [1] 1 4 6 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.2, -0.15, 0.2, 0.65, 1.5, -3.3, -1.85, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6aijq1382097724.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,] -0.30 0.50 1.20 -2.50 0.30 -1.50 0.3 NA [2,] 1.65 1.70 1.60 -1.60 2.20 -0.45 2.6 NA [3,] 3.00 2.95 2.65 -0.55 4.05 0.00 3.4 NA [4,] 5.20 4.00 3.70 2.65 4.85 0.85 4.5 NA [5,] 6.70 5.90 4.70 4.30 5.80 2.10 5.7 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1.380821 1.900955 1.692176 -2.488454 2.841317 -0.5929387 2.533397 NA [2,] 4.619179 3.999045 3.607824 1.388454 5.258683 0.5929387 4.266603 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(-0.3, 1.65, 3, 5.2, 6.7, 0.5, 1.7, 2.95, 4, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7sozu1382097724.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.942857 1.60 1.8250 [2,] 2.135714 1.90 2.1125 [3,] 2.378571 2.85 2.3875 [4,] 2.571429 3.15 2.8375 [5,] 2.757143 3.50 3.0500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.179839 2.279867 2.056823 [2,] 2.577304 3.420133 2.718177 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1.94285714285714, 2.13571428571429, 2.37857142857143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1i4za1382097724.ps tmp/1i4za1382097724.png",intern=TRUE)) character(0) > try(system("convert tmp/2c86l1382097724.ps tmp/2c86l1382097724.png",intern=TRUE)) character(0) > try(system("convert tmp/38cc91382097724.ps tmp/38cc91382097724.png",intern=TRUE)) character(0) > try(system("convert tmp/4wd0m1382097724.ps tmp/4wd0m1382097724.png",intern=TRUE)) character(0) > try(system("convert tmp/5p2al1382097724.ps tmp/5p2al1382097724.png",intern=TRUE)) character(0) > try(system("convert tmp/6aijq1382097724.ps tmp/6aijq1382097724.png",intern=TRUE)) character(0) > try(system("convert tmp/7sozu1382097724.ps tmp/7sozu1382097724.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.175 0.571 3.736