R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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.25,2.25,2.45,2.5,2.5,2.64,2.75,2.93,3,3.17,3.25,3.39,3.5,3.5,3.65,3.75,3.75,3.9,4,4,4,4,4,4,4,4,4,4,4,4,4.18,4.25,4.25,3.97,3.42,2.75,2.31,2,1.66,1.31,1.09,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.14,1.25,1.25,1.4,1.5,1.5,1.5,1.32,1.11) > 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,] 2.25 3.50 4.00 2.31 1 1.00 NA [2,] 2.25 3.50 4.00 2.00 1 1.00 NA [3,] 2.45 3.65 4.00 1.66 1 1.00 NA [4,] 2.50 3.75 4.00 1.31 1 1.14 NA [5,] 2.50 3.75 4.00 1.09 1 1.25 NA [6,] 2.64 3.90 4.00 1.00 1 1.25 NA [7,] 2.75 4.00 4.18 1.00 1 1.40 NA [8,] 2.93 4.00 4.25 1.00 1 1.50 NA [9,] 3.00 4.00 4.25 1.00 1 1.50 NA [10,] 3.17 4.00 3.97 1.00 1 1.50 NA [11,] 3.25 4.00 3.42 1.00 1 1.32 NA [12,] 3.39 4.00 2.75 1.00 1 1.11 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.00 0.00 0.00 -0.31 0 0.00 NA [2,] 0.20 0.15 0.00 -0.34 0 0.00 NA [3,] 0.05 0.10 0.00 -0.35 0 0.14 NA [4,] 0.00 0.00 0.00 -0.22 0 0.11 NA [5,] 0.14 0.15 0.00 -0.09 0 0.00 NA [6,] 0.11 0.10 0.18 0.00 0 0.15 NA [7,] 0.18 0.00 0.07 0.00 0 0.10 NA [8,] 0.07 0.00 0.00 0.00 0 0.00 NA [9,] 0.17 0.00 -0.28 0.00 0 0.00 NA [10,] 0.08 0.00 -0.55 0.00 0 -0.18 NA [11,] 0.14 0.00 -0.67 0.00 0 -0.21 NA [12,] 0.11 0.00 -0.44 0.00 0 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/16kcj1350632144.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/2k5dm1350632144.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/3okms1350632144.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/4ekks1350632144.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,] 1.00 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.00 1.000 1.000 1.00 [2,] 1.00 1.000 1.000 1.140 1.090 1.000 1.000 1.000 1.00 1.000 1.000 1.00 [3,] 2.28 2.125 2.055 1.905 1.875 1.945 2.075 2.215 2.25 2.335 2.285 1.93 [4,] 3.50 3.500 3.650 3.750 3.750 3.900 4.000 4.000 4.00 3.970 3.420 3.39 [5,] 4.00 4.000 4.000 4.000 4.000 4.000 4.180 4.250 4.25 4.000 4.000 4.00 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.6674193 0.5124193 0.3456644 0.2214657 0.1592141 0.07440633 0.1399031 [2,] 3.8925807 3.7375807 3.7643356 3.5885343 3.5907859 3.81559367 4.0100969 [,8] [,9] [,10] [,11] [,12] [1,] 0.2799031 0.3149031 0.4192541 0.7240218 0.3883728 [2,] 4.1500969 4.1850969 4.2507459 3.8459782 3.4716272 $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(1, 1, 2.28, 3.5, 4, 1, 1, 2.125, 3.5, 4, 1, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5f55w1350632144.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 0.00 0.000 0 -0.09 0.000 0.000 0 0 -0.18 -0.21 0 [2,] 0 0.00 0.000 0 0.00 0.000 0.000 0 0 -0.18 -0.21 0 [3,] 0 0.00 0.025 0 0.00 0.105 0.035 0 0 0.00 0.00 0 [4,] 0 0.15 0.100 0 0.14 0.150 0.100 0 0 0.00 0.00 0 [5,] 0 0.20 0.140 0 0.15 0.180 0.180 0 0 0.08 0.14 0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0 -0.09675484 -0.03950323 0 -0.09030452 0.008245155 -0.02950323 0 [2,] 0 0.09675484 0.08950323 0 0.09030452 0.201754845 0.09950323 0 [,9] [,10] [,11] [,12] [1,] 0 -0.1161058 -0.1354568 0 [2,] 0 0.1161058 0.1354568 0 $out [1] -0.31 -0.34 -0.35 -0.22 0.11 0.07 0.17 -0.28 -0.55 -0.67 0.11 -0.44 $group [1] 1 2 3 4 4 8 9 9 10 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, 0, 0, 0, 0, 0, 0, 0, 0.15, 0.2, 0, 0, 0.0249999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6fh4z1350632144.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,] 2.250 3.50 3.970 1.000 1 1.000 NA [2,] 2.475 3.70 3.985 1.000 1 1.055 NA [3,] 2.695 3.95 4.000 1.000 1 1.250 NA [4,] 3.085 4.00 4.090 1.485 1 1.450 NA [5,] 3.390 4.00 4.180 2.000 1 1.500 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2.416775 3.813168 3.952109 0.7787882 1 1.069838 NA [2,] 2.973225 4.086832 4.047891 1.2212118 1 1.430162 NA $out [1] 4.25 4.25 3.42 2.75 2.31 $group [1] 3 3 3 3 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(2.25, 2.475, 2.695, 3.085, 3.39, 3.5, 3.7, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7to7n1350632144.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,] 2.208333 1.8750 2.128750 [2,] 2.287500 1.9375 2.243125 [3,] 2.315000 2.1000 2.296875 [4,] 2.414167 2.2650 2.411250 [5,] 2.458333 2.3350 2.447500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2.257226 1.950625 2.220192 [2,] 2.372774 2.249375 2.373558 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(2.20833333333333, 2.2875, 2.315, 2.41416666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/16kcj1350632144.ps tmp/16kcj1350632144.png",intern=TRUE)) character(0) > try(system("convert tmp/2k5dm1350632144.ps tmp/2k5dm1350632144.png",intern=TRUE)) character(0) > try(system("convert tmp/3okms1350632144.ps tmp/3okms1350632144.png",intern=TRUE)) character(0) > try(system("convert tmp/4ekks1350632144.ps tmp/4ekks1350632144.png",intern=TRUE)) character(0) > try(system("convert tmp/5f55w1350632144.ps tmp/5f55w1350632144.png",intern=TRUE)) character(0) > try(system("convert tmp/6fh4z1350632144.ps tmp/6fh4z1350632144.png",intern=TRUE)) character(0) > try(system("convert tmp/7to7n1350632144.ps tmp/7to7n1350632144.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.301 0.674 3.964