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(103.48,103.93,103.89,104.4,104.79,104.77,105.13,105.26,104.96,104.75,105.01,105.1,103.48,103.93,103.89,104.4,104.79,106.12,106.57,106.44,106.54,107.1,108.1,108.4,108.84,109.62,110.42,110.67,111.66,112.28,112.87,112.18,112.36,112.16,111.49,111.25,111.36,111.74,111.1,111.33,111.25,111.04,110.97,111.31,111.02,111.07,111.36,111.54,112.05,112.52,112.94,113.33,113.78,113.77,113.82,113.89,114.25,114.41,114.55,115,115.66,116.33,116.91,117.2,117.59,117.95,118.09,117.99,118.31,118.49,118.96,119.01) > par1 = '6' > par1 <- '6' > #'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] 12 > 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] 12 12 12 12 12 12 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 103.48 105.13 103.48 106.57 108.84 112.87 111.36 110.97 112.05 113.82 [2,] 103.93 105.26 103.93 106.44 109.62 112.18 111.74 111.31 112.52 113.89 [3,] 103.89 104.96 103.89 106.54 110.42 112.36 111.10 111.02 112.94 114.25 [4,] 104.40 104.75 104.40 107.10 110.67 112.16 111.33 111.07 113.33 114.41 [5,] 104.79 105.01 104.79 108.10 111.66 111.49 111.25 111.36 113.78 114.55 [6,] 104.77 105.10 106.12 108.40 112.28 111.25 111.04 111.54 113.77 115.00 [,11] [,12] [,13] [1,] 115.66 118.09 NA [2,] 116.33 117.99 NA [3,] 116.91 118.31 NA [4,] 117.20 118.49 NA [5,] 117.59 118.96 NA [6,] 117.95 119.01 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 0.45 0.13 0.45 -0.13 0.78 -0.69 0.38 0.34 0.47 0.07 0.67 -0.10 [2,] -0.04 -0.30 -0.04 0.10 0.80 0.18 -0.64 -0.29 0.42 0.36 0.58 0.32 [3,] 0.51 -0.21 0.51 0.56 0.25 -0.20 0.23 0.05 0.39 0.16 0.29 0.18 [4,] 0.39 0.26 0.39 1.00 0.99 -0.67 -0.08 0.29 0.45 0.14 0.39 0.47 [5,] -0.02 0.09 1.33 0.30 0.62 -0.24 -0.21 0.18 -0.01 0.45 0.36 0.05 [6,] 0.36 -1.62 0.45 0.44 0.59 0.11 -0.07 0.51 0.05 0.66 0.14 NA [,13] [1,] NA [2,] NA [3,] NA [4,] NA [5,] NA [6,] 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/1sx681350968604.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/2k2011350968604.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/3tfc41350968604.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/4ze7x1350968604.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] [1,] 103.480 103.930 103.890 104.400 104.790 104.770 [2,] 105.850 105.850 105.750 105.925 106.555 107.260 [3,] 111.165 111.525 111.060 111.200 111.425 111.395 [4,] 113.345 113.205 113.595 113.870 114.165 114.385 [5,] 118.090 117.990 118.310 118.490 118.960 119.010 $n [1] 12 12 12 12 12 12 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 107.7465 108.1703 107.4818 107.5762 107.954 108.1452 [2,] 114.5835 114.8797 114.6382 114.8238 114.896 114.6448 $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" Warning message: In bxp(list(stats = c(103.48, 105.85, 111.165, 113.345, 118.09, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5itjw1350968604.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] [1,] -0.690 -0.640 -0.210 -0.08 -0.240 -0.07 [2,] -0.015 -0.165 0.105 0.20 -0.015 0.08 [3,] 0.360 0.140 0.240 0.39 0.135 0.36 [4,] 0.460 0.390 0.450 0.46 0.405 0.48 [5,] 0.780 0.800 0.560 0.47 0.620 0.66 $n [1] 12 12 12 12 12 11 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.1433493 -0.1131392 0.08264318 0.2714123 -0.05656482 0.1694448 [2,] 0.5766507 0.3931392 0.39735682 0.5085877 0.32656482 0.5505552 $out [1] 1.00 0.99 -0.67 1.33 -1.62 $group [1] 4 4 4 5 6 $names [1] "1" "2" "3" "4" "5" "6" Warning message: In bxp(list(stats = c(-0.689999999999998, -0.0150000000000006, 0.359999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6p3xi1350968604.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] [1,] 103.480 104.750 103.480 106.440 108.840 111.25 111.04 110.97 112.050 [2,] 103.890 104.960 103.890 106.540 109.620 111.49 111.10 111.02 112.520 [3,] 104.165 105.055 104.165 106.835 110.545 112.17 111.29 111.19 113.135 [4,] 104.770 105.130 104.790 108.100 111.660 112.36 111.36 111.36 113.770 [5,] 104.790 105.260 106.120 108.400 112.280 112.87 111.74 111.54 113.780 [,10] [,11] [,12] [,13] [1,] 113.82 115.660 117.99 NA [2,] 113.89 116.330 118.09 NA [3,] 114.33 117.055 118.40 NA [4,] 114.55 117.590 118.96 NA [5,] 115.00 117.950 119.01 NA $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 103.5974 104.9453 103.5845 105.8287 109.2291 111.6088 111.1223 110.9707 [2,] 104.7326 105.1647 104.7455 107.8413 111.8609 112.7312 111.4577 111.4093 [,9] [,10] [,11] [,12] [,13] [1,] 112.3287 113.9043 116.2423 117.8388 NA [2,] 113.9413 114.7557 117.8677 118.9612 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" NA Warning message: In bxp(list(stats = c(103.48, 103.89, 104.165, 104.77, 104.79, 104.75, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7q4pn1350968604.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,] 110.1933 111.0600 109.5037 [2,] 110.4283 111.1650 109.6587 [3,] 110.6625 111.2975 109.8812 [4,] 111.1108 111.4250 110.6500 [5,] 111.3525 111.5250 110.9538 $n [1] 6 6 6 $conf [,1] [,2] [,3] [1,] 110.2223 111.1298 109.2419 [2,] 111.1027 111.4652 110.5206 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(110.193333333333, 110.428333333333, 110.6625, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1sx681350968604.ps tmp/1sx681350968604.png",intern=TRUE)) character(0) > try(system("convert tmp/2k2011350968604.ps tmp/2k2011350968604.png",intern=TRUE)) character(0) > try(system("convert tmp/3tfc41350968604.ps tmp/3tfc41350968604.png",intern=TRUE)) character(0) > try(system("convert tmp/4ze7x1350968604.ps tmp/4ze7x1350968604.png",intern=TRUE)) character(0) > try(system("convert tmp/5itjw1350968604.ps tmp/5itjw1350968604.png",intern=TRUE)) character(0) > try(system("convert tmp/6p3xi1350968604.ps tmp/6p3xi1350968604.png",intern=TRUE)) character(0) > try(system("convert tmp/7q4pn1350968604.ps tmp/7q4pn1350968604.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.430 0.628 4.051