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(103.51,104.35,104.51,105.25,105.2,105.87,107.63,107.77,106.58,106.32,106.3,106.38,106.42,107.35,107.58,108.2,108.29,108.76,110.69,110.56,108.81,108.81,108.81,109.74,109.57,110.44,111.2,111.44,111.83,112.87,115.07,115.35,113.81,114.66,114.51,115.11,114.54,115.39,115.65,116.46,116.18,116.63,118.84,118.77,117.83,117.66,117.36,118,117.34,118.04,118.17,118.82,119,118.89,121.4,121.01,120.21,120.39,120.09,120.76,120.33,120.84,121.49,122.29,121.91,122.46,124.94,124.6,123.09,123.25,123.01,123.82) > 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,] 103.51 106.42 109.57 114.54 117.34 120.33 NA [2,] 104.35 107.35 110.44 115.39 118.04 120.84 NA [3,] 104.51 107.58 111.20 115.65 118.17 121.49 NA [4,] 105.25 108.20 111.44 116.46 118.82 122.29 NA [5,] 105.20 108.29 111.83 116.18 119.00 121.91 NA [6,] 105.87 108.76 112.87 116.63 118.89 122.46 NA [7,] 107.63 110.69 115.07 118.84 121.40 124.94 NA [8,] 107.77 110.56 115.35 118.77 121.01 124.60 NA [9,] 106.58 108.81 113.81 117.83 120.21 123.09 NA [10,] 106.32 108.81 114.66 117.66 120.39 123.25 NA [11,] 106.30 108.81 114.51 117.36 120.09 123.01 NA [12,] 106.38 109.74 115.11 118.00 120.76 123.82 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.84 0.93 0.87 0.85 0.70 0.51 NA [2,] 0.16 0.23 0.76 0.26 0.13 0.65 NA [3,] 0.74 0.62 0.24 0.81 0.65 0.80 NA [4,] -0.05 0.09 0.39 -0.28 0.18 -0.38 NA [5,] 0.67 0.47 1.04 0.45 -0.11 0.55 NA [6,] 1.76 1.93 2.20 2.21 2.51 2.48 NA [7,] 0.14 -0.13 0.28 -0.07 -0.39 -0.34 NA [8,] -1.19 -1.75 -1.54 -0.94 -0.80 -1.51 NA [9,] -0.26 0.00 0.85 -0.17 0.18 0.16 NA [10,] -0.02 0.00 -0.15 -0.30 -0.30 -0.24 NA [11,] 0.08 0.93 0.60 0.64 0.67 0.81 NA [12,] 0.04 -0.17 -0.57 -0.66 -0.43 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/1sgxw1358027805.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/2ze0l1358027805.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/3b0961358027805.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/455j91358027805.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,] 103.510 104.350 104.510 105.25 105.200 105.87 107.630 107.77 106.58 106.32 [2,] 106.420 107.350 107.580 108.20 108.290 108.76 110.690 110.56 108.81 108.81 [3,] 112.055 112.915 113.425 113.95 114.005 114.75 116.955 117.06 115.82 116.16 [4,] 117.340 118.040 118.170 118.82 119.000 118.89 121.400 121.01 120.21 120.39 [5,] 120.330 120.840 121.490 122.29 121.910 122.46 124.940 124.60 123.09 123.25 [,11] [,12] [1,] 106.300 106.380 [2,] 108.810 109.740 [3,] 115.935 116.555 [4,] 120.090 120.760 [5,] 123.010 123.820 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 105.0112 106.0196 106.5941 107.0998 107.0967 108.2158 110.0467 110.3194 [2,] 119.0988 119.8104 120.2559 120.8002 120.9133 121.2842 123.8633 123.8006 [,9] [,10] [,11] [,12] [1,] 108.4666 108.6905 108.659 109.4467 [2,] 123.1734 123.6295 123.211 123.6633 $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(103.51, 106.42, 112.055, 117.34, 120.33, 104.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/52kj21358027805.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.510 0.130 0.620 -0.38 0.45 1.760 -0.39 -1.75 -0.26 -0.300 0.600 -0.66 [2,] 0.700 0.160 0.620 -0.28 0.45 1.930 -0.34 -1.54 -0.17 -0.300 0.600 -0.57 [3,] 0.845 0.245 0.695 0.02 0.51 2.205 -0.10 -1.35 0.08 -0.195 0.655 -0.43 [4,] 0.870 0.650 0.800 0.18 0.67 2.480 0.14 -0.94 0.18 -0.020 0.810 -0.17 [5,] 0.930 0.760 0.810 0.39 0.67 2.510 0.28 -0.80 0.18 0.000 0.930 0.04 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.7353445 -0.07106583 0.5788942 -0.2767149 0.3680929 1.850232 -0.4096155 [2,] 0.9546555 0.56106583 0.8111058 0.3167149 0.6519071 2.559768 0.2096155 [,8] [,9] [,10] [,11] [,12] [1,] -1.7370194 -0.1457613 -0.37560904 0.5195432 -0.712639 [2,] -0.9629806 0.3057613 -0.01439096 0.7904568 -0.147361 $out [1] 0.24 1.04 -0.11 0.85 0.08 $group [1] 3 5 5 9 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.510000000000005, 0.700000000000003, 0.844999999999992, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/66bm81358027805.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,] 103.510 106.420 109.570 114.540 117.340 120.330 NA [2,] 104.855 107.890 111.320 115.915 118.495 121.700 NA [3,] 106.085 108.785 113.340 116.995 119.545 122.735 NA [4,] 106.480 109.275 114.865 117.915 120.575 123.535 NA [5,] 107.770 110.690 115.350 118.840 121.400 124.940 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 105.3438 108.1533 111.7231 116.0828 118.5963 121.898 NA [2,] 106.8262 109.4167 114.9569 117.9072 120.4937 123.572 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(103.51, 104.855, 106.085, 106.48, 107.77, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7yyul1358027805.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,] 111.9517 112.0550 111.9237 [2,] 113.4175 113.6875 113.3162 [3,] 114.6300 115.2850 114.4387 [4,] 115.4083 116.3575 115.2831 [5,] 116.4283 117.0600 116.2725 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 113.722 114.0672 113.5416 [2,] 115.538 116.5028 115.3359 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(111.951666666667, 113.4175, 114.63, 115.408333333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1sgxw1358027805.ps tmp/1sgxw1358027805.png",intern=TRUE)) character(0) > try(system("convert tmp/2ze0l1358027805.ps tmp/2ze0l1358027805.png",intern=TRUE)) character(0) > try(system("convert tmp/3b0961358027805.ps tmp/3b0961358027805.png",intern=TRUE)) character(0) > try(system("convert tmp/455j91358027805.ps tmp/455j91358027805.png",intern=TRUE)) character(0) > try(system("convert tmp/52kj21358027805.ps tmp/52kj21358027805.png",intern=TRUE)) character(0) > try(system("convert tmp/66bm81358027805.ps tmp/66bm81358027805.png",intern=TRUE)) character(0) > try(system("convert tmp/7yyul1358027805.ps tmp/7yyul1358027805.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.281 0.552 3.836