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(130.65,130.39,130.37,128.53,126.7,126.7,126.7,126.82,127.26,126.87,126.57,126.39,126.39,126.13,125.98,123.02,122.49,121.83,121.83,121.73,122.23,121.91,122.03,122.14,122.14,122,121.37,119.04,118.55,118.55,118.55,118.54,118.45,118.49,118.47,118.08,118.08,117.94,117,115.46,113.8,113.71,113.71,113.71,113.47,113.37,113.21,113.15,113.15,113.04,112.46,111.46,110.92,110.84,110.84,110.84,110.86,110.71,110.75,110.82,110.82,110.72,110.49,108.95,108.1,108.16,108.16,108.16,108.14,107.72,107.56,107.2) > 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,] 130.65 126.39 122.14 118.08 113.15 110.82 NA [2,] 130.39 126.13 122.00 117.94 113.04 110.72 NA [3,] 130.37 125.98 121.37 117.00 112.46 110.49 NA [4,] 128.53 123.02 119.04 115.46 111.46 108.95 NA [5,] 126.70 122.49 118.55 113.80 110.92 108.10 NA [6,] 126.70 121.83 118.55 113.71 110.84 108.16 NA [7,] 126.70 121.83 118.55 113.71 110.84 108.16 NA [8,] 126.82 121.73 118.54 113.71 110.84 108.16 NA [9,] 127.26 122.23 118.45 113.47 110.86 108.14 NA [10,] 126.87 121.91 118.49 113.37 110.71 107.72 NA [11,] 126.57 122.03 118.47 113.21 110.75 107.56 NA [12,] 126.39 122.14 118.08 113.15 110.82 107.20 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.26 -0.26 -0.14 -0.14 -0.11 -0.10 NA [2,] -0.02 -0.15 -0.63 -0.94 -0.58 -0.23 NA [3,] -1.84 -2.96 -2.33 -1.54 -1.00 -1.54 NA [4,] -1.83 -0.53 -0.49 -1.66 -0.54 -0.85 NA [5,] 0.00 -0.66 0.00 -0.09 -0.08 0.06 NA [6,] 0.00 0.00 0.00 0.00 0.00 0.00 NA [7,] 0.12 -0.10 -0.01 0.00 0.00 0.00 NA [8,] 0.44 0.50 -0.09 -0.24 0.02 -0.02 NA [9,] -0.39 -0.32 0.04 -0.10 -0.15 -0.42 NA [10,] -0.30 0.12 -0.02 -0.16 0.04 -0.16 NA [11,] -0.18 0.11 -0.39 -0.06 0.07 -0.36 NA [12,] 0.00 0.00 0.00 0.00 0.00 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/1ivdj1362653714.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/2aqv81362653714.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/3iucg1362653714.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/4gghc1362653714.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] [1,] 110.82 110.72 110.490 108.95 108.100 108.16 108.16 108.160 108.14 107.72 [2,] 113.15 113.04 112.460 111.46 110.920 110.84 110.84 110.840 110.86 110.71 [3,] 120.11 119.97 119.185 117.25 116.175 116.13 116.13 116.125 115.96 115.93 [4,] 126.39 126.13 125.980 123.02 122.490 121.83 121.83 121.730 122.23 121.91 [5,] 130.65 130.39 130.370 128.53 126.700 126.70 126.70 126.820 127.26 126.87 [,11] [,12] [1,] 107.56 107.200 [2,] 110.75 110.820 [3,] 115.84 115.615 [4,] 122.03 122.140 [5,] 126.57 126.390 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 111.5698 111.5265 110.4642 109.7934 108.712 109.0411 109.0411 109.1006 [2,] 128.6502 128.4135 127.9058 124.7066 123.638 123.2189 123.2189 123.1494 [,9] [,10] [,11] [,12] [1,] 108.626 108.7056 108.564 108.3132 [2,] 123.294 123.1544 123.116 122.9168 $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(110.82, 113.15, 120.11, 126.39, 130.65, 110.72, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5qk7l1362653714.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.26 -0.940 -2.96 -1.830 -0.09 0 -0.01 -0.24 -0.420 -0.30 -0.39 0 [2,] -0.26 -0.630 -2.33 -1.660 -0.09 0 -0.01 -0.09 -0.390 -0.16 -0.36 0 [3,] -0.14 -0.405 -1.69 -0.695 -0.04 0 0.00 0.00 -0.235 -0.09 -0.12 0 [4,] -0.11 -0.150 -1.54 -0.530 0.00 0 0.00 0.44 -0.100 0.04 0.07 0 [5,] -0.10 -0.020 -1.00 -0.490 0.06 0 0.00 0.50 0.040 0.12 0.11 0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.23675484 -0.7146155 -2.199576 -1.4238865 -0.09805291 0 -0.006450323 [2,] -0.04324516 -0.0953845 -1.180424 0.0338865 0.01805291 0 0.006450323 [,8] [,9] [,10] [,11] [,12] [1,] -0.3418671 -0.42205937 -0.21900646 -0.3973639 0 [2,] 0.3418671 -0.04794063 0.03900646 0.1573639 0 $out [1] -0.66 0.12 -0.10 $group [1] 5 7 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.260000000000019, -0.260000000000005, -0.140000000000001, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6880e1362653714.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,] 126.390 121.730 118.080 113.15 110.71 107.20 NA [2,] 126.700 121.870 118.480 113.42 110.83 107.91 NA [3,] 126.845 122.185 118.550 113.71 110.85 108.16 NA [4,] 129.450 124.500 120.205 116.23 111.96 109.72 NA [5,] 130.650 126.390 122.140 118.08 113.15 110.82 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 125.5907 120.9854 117.7632 112.4283 110.3346 107.3344 NA [2,] 128.0993 123.3846 119.3368 114.9917 111.3654 108.9856 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(126.39, 126.7, 126.845, 129.45, 130.65, 121.73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7ifrb1362653714.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,] 116.2967 115.6150 116.2150 [2,] 116.5717 115.9450 116.2581 [3,] 116.6842 116.1300 116.3413 [4,] 118.6775 118.2175 118.2269 [5,] 120.2050 120.1100 119.8550 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 115.7237 115.0935 115.4433 [2,] 117.6447 117.1665 117.2392 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(116.296666666667, 116.571666666667, 116.684166666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1ivdj1362653714.ps tmp/1ivdj1362653714.png",intern=TRUE)) character(0) > try(system("convert tmp/2aqv81362653714.ps tmp/2aqv81362653714.png",intern=TRUE)) character(0) > try(system("convert tmp/3iucg1362653714.ps tmp/3iucg1362653714.png",intern=TRUE)) character(0) > try(system("convert tmp/4gghc1362653714.ps tmp/4gghc1362653714.png",intern=TRUE)) character(0) > try(system("convert tmp/5qk7l1362653714.ps tmp/5qk7l1362653714.png",intern=TRUE)) character(0) > try(system("convert tmp/6880e1362653714.ps tmp/6880e1362653714.png",intern=TRUE)) character(0) > try(system("convert tmp/7ifrb1362653714.ps tmp/7ifrb1362653714.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.751 0.589 4.344