R version 2.15.2 (2012-10-26) -- "Trick or Treat" 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(0.75,0.75,0.77,0.78,0.79,1.01,1.16,1.14,1.12,1.1,1.1,1.1,1.1,1.09,1.09,1.1,1.1,1.17,1.15,1.04,0.94,0.88,0.85,0.85,0.85,0.84,0.83,0.8,0.78,1.02,1.19,1.1,0.96,0.87,0.83,0.82,0.81,0.78,0.79,0.8,0.79,0.97,1.01,0.92,0.87,0.84,0.81,0.81,0.83,0.83,0.85,0.88,0.89,1.21,1.32,1.33,1.23,1.16,1.12,1.06,1.08,1.09,1.03,1.04,1.05,1.19,1.14,1.05,0.95,0.87,0.86,0.85) > 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,] 0.75 1.10 0.85 0.81 0.83 1.08 NA [2,] 0.75 1.09 0.84 0.78 0.83 1.09 NA [3,] 0.77 1.09 0.83 0.79 0.85 1.03 NA [4,] 0.78 1.10 0.80 0.80 0.88 1.04 NA [5,] 0.79 1.10 0.78 0.79 0.89 1.05 NA [6,] 1.01 1.17 1.02 0.97 1.21 1.19 NA [7,] 1.16 1.15 1.19 1.01 1.32 1.14 NA [8,] 1.14 1.04 1.10 0.92 1.33 1.05 NA [9,] 1.12 0.94 0.96 0.87 1.23 0.95 NA [10,] 1.10 0.88 0.87 0.84 1.16 0.87 NA [11,] 1.10 0.85 0.83 0.81 1.12 0.86 NA [12,] 1.10 0.85 0.82 0.81 1.06 0.85 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.00 -0.01 -0.01 -0.03 0.00 0.01 NA [2,] 0.02 0.00 -0.01 0.01 0.02 -0.06 NA [3,] 0.01 0.01 -0.03 0.01 0.03 0.01 NA [4,] 0.01 0.00 -0.02 -0.01 0.01 0.01 NA [5,] 0.22 0.07 0.24 0.18 0.32 0.14 NA [6,] 0.15 -0.02 0.17 0.04 0.11 -0.05 NA [7,] -0.02 -0.11 -0.09 -0.09 0.01 -0.09 NA [8,] -0.02 -0.10 -0.14 -0.05 -0.10 -0.10 NA [9,] -0.02 -0.06 -0.09 -0.03 -0.07 -0.08 NA [10,] 0.00 -0.03 -0.04 -0.03 -0.04 -0.01 NA [11,] 0.00 0.00 -0.01 0.00 -0.06 -0.01 NA [12,] 0.00 0.00 -0.01 0.02 0.02 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/1nuge1356636988.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/2gq3g1356636988.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/3ldbz1356636988.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/4ywkn1356636988.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.75 0.750 0.77 0.78 0.78 0.970 1.140 0.920 0.870 0.840 0.810 0.81 [2,] 0.81 0.780 0.79 0.80 0.79 1.010 1.140 1.040 0.940 0.870 0.830 0.82 [3,] 0.84 0.835 0.84 0.84 0.84 1.095 1.155 1.075 0.955 0.875 0.855 0.85 [4,] 1.08 1.090 1.03 1.04 1.05 1.190 1.190 1.140 1.120 1.100 1.100 1.06 [5,] 1.10 1.090 1.09 1.10 1.10 1.210 1.190 1.140 1.230 1.160 1.120 1.10 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.6658413 0.63504 0.6851922 0.6851922 0.6722916 0.9788942 1.122748 [2,] 1.0141587 1.03496 0.9948078 0.9948078 1.0077084 1.2111058 1.187252 [,8] [,9] [,10] [,11] [,12] [1,] 1.010497 0.8388942 0.7266426 0.6808413 0.6951922 [2,] 1.139503 1.0711058 1.0233574 1.0291587 1.0048078 $out [1] 1.01 1.32 1.33 $group [1] 7 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.75, 0.81, 0.84, 1.08, 1.1, 0.75, 0.78, 0.835, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5ujem1356636988.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.010 -0.010 0.01 -0.020 0.07 -0.050 -0.11 -0.14 -0.090 -0.04 -0.010 [2,] -0.010 -0.010 0.01 -0.010 0.14 -0.020 -0.09 -0.10 -0.080 -0.04 -0.010 [3,] -0.005 0.005 0.01 0.005 0.20 0.075 -0.09 -0.10 -0.065 -0.03 -0.005 [4,] 0.000 0.020 0.01 0.010 0.24 0.150 -0.02 -0.05 -0.030 -0.01 0.000 [5,] 0.010 0.020 0.01 0.010 0.32 0.170 0.01 -0.02 -0.020 0.00 0.000 [,12] [1,] -0.01 [2,] 0.00 [3,] 0.00 [4,] 0.02 [5,] 0.02 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.011450323 -0.01435097 0.01 -0.007900646 0.1354968 -0.03465549 [2,] 0.001450323 0.02435097 0.01 0.017900646 0.2645032 0.18465549 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.13515226 -0.13225161 -0.09725161 -0.04935097 -0.011450323 -0.01413195 [2,] -0.04484774 -0.06774839 -0.03274839 -0.01064903 0.001450323 0.01413195 $out [1] -0.03 -0.06 -0.03 0.03 -0.06 $group [1] 1 2 3 3 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.01, -0.01, -0.005, 0, 0.01, -0.01, -0.01, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6v38z1356636988.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,] 0.750 0.85 0.780 0.780 0.830 0.850 NA [2,] 0.775 0.91 0.825 0.795 0.865 0.910 NA [3,] 1.055 1.09 0.845 0.810 1.090 1.045 NA [4,] 1.110 1.10 0.990 0.895 1.220 1.085 NA [5,] 1.160 1.17 1.190 1.010 1.330 1.190 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.9022043 1.00334 0.7697424 0.7643893 0.9280821 0.9651813 NA [2,] 1.2077957 1.17666 0.9202576 0.8556107 1.2519179 1.1248187 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(0.75, 0.775, 1.055, 1.11, 1.16, 0.85, 0.91, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/71c4j1356636988.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,] 0.8933333 0.8350 0.892500 [2,] 0.9000000 0.8400 0.905000 [3,] 0.9216667 0.8525 0.928125 [4,] 1.0533333 1.0150 1.048750 [5,] 1.1616667 1.1550 1.162500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 0.8517303 0.7726813 0.8625597 [2,] 0.9916030 0.9323187 0.9936903 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(0.893333333333333, 0.9, 0.921666666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1nuge1356636988.ps tmp/1nuge1356636988.png",intern=TRUE)) character(0) > try(system("convert tmp/2gq3g1356636988.ps tmp/2gq3g1356636988.png",intern=TRUE)) character(0) > try(system("convert tmp/3ldbz1356636988.ps tmp/3ldbz1356636988.png",intern=TRUE)) character(0) > try(system("convert tmp/4ywkn1356636988.ps tmp/4ywkn1356636988.png",intern=TRUE)) character(0) > try(system("convert tmp/5ujem1356636988.ps tmp/5ujem1356636988.png",intern=TRUE)) character(0) > try(system("convert tmp/6v38z1356636988.ps tmp/6v38z1356636988.png",intern=TRUE)) character(0) > try(system("convert tmp/71c4j1356636988.ps tmp/71c4j1356636988.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.466 0.566 4.046