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.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 = '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.48 103.48 108.84 111.36 112.05 115.66 NA [2,] 103.93 103.93 109.62 111.74 112.52 116.33 NA [3,] 103.89 103.89 110.42 111.10 112.94 116.91 NA [4,] 104.40 104.40 110.67 111.33 113.33 117.20 NA [5,] 104.79 104.79 111.66 111.25 113.78 117.59 NA [6,] 104.77 106.12 112.28 111.04 113.77 117.95 NA [7,] 105.13 106.57 112.87 110.97 113.82 118.09 NA [8,] 105.26 106.44 112.18 111.31 113.89 117.99 NA [9,] 104.96 106.54 112.36 111.02 114.25 118.31 NA [10,] 104.75 107.10 112.16 111.07 114.41 118.49 NA [11,] 105.01 108.10 111.49 111.36 114.55 118.96 NA [12,] 105.10 108.40 111.25 111.54 115.00 119.01 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.45 0.45 0.78 0.38 0.47 0.67 NA [2,] -0.04 -0.04 0.80 -0.64 0.42 0.58 NA [3,] 0.51 0.51 0.25 0.23 0.39 0.29 NA [4,] 0.39 0.39 0.99 -0.08 0.45 0.39 NA [5,] -0.02 1.33 0.62 -0.21 -0.01 0.36 NA [6,] 0.36 0.45 0.59 -0.07 0.05 0.14 NA [7,] 0.13 -0.13 -0.69 0.34 0.07 -0.10 NA [8,] -0.30 0.10 0.18 -0.29 0.36 0.32 NA [9,] -0.21 0.56 -0.20 0.05 0.16 0.18 NA [10,] 0.26 1.00 -0.67 0.29 0.14 0.47 NA [11,] 0.09 0.30 -0.24 0.18 0.45 0.05 NA [12,] -1.62 0.44 0.11 0.51 0.66 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/fisher/rcomp/tmp/1srnt1356526921.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/fisher/rcomp/tmp/2vf9a1356526921.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/fisher/rcomp/tmp/3hh7p1356526921.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/fisher/rcomp/tmp/4hm0t1356526921.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.48 103.93 103.89 104.40 104.790 104.77 105.13 105.260 104.96 104.750 [2,] 103.48 103.93 103.89 104.40 104.790 106.12 106.57 106.440 106.54 107.100 [3,] 110.10 110.68 110.76 111.00 111.455 111.66 111.92 111.745 111.69 111.615 [4,] 112.05 112.52 112.94 113.33 113.780 113.77 113.82 113.890 114.25 114.410 [5,] 115.66 116.33 116.91 117.20 117.590 117.95 118.09 117.990 118.31 118.490 [,11] [,12] [1,] 105.010 105.100 [2,] 108.100 108.400 [3,] 111.425 111.395 [4,] 114.550 115.000 [5,] 118.960 119.010 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 104.5721 105.1392 104.9225 105.2399 105.6562 106.7255 107.2435 106.9395 [2,] 115.6279 116.2208 116.5975 116.7601 117.2538 116.5945 116.5965 116.5505 [,9] [,10] [,11] [,12] [1,] 106.7168 106.8998 107.2645 107.1378 [2,] 116.6632 116.3302 115.5855 115.6522 $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.48, 103.48, 110.1, 112.05, 115.66, 103.93, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/524um1356526921.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.38 -0.64 0.23 0.39 -0.210 -0.07 -0.130 -0.30 -0.210 0.140 -0.240 0.11 [2,] 0.45 -0.04 0.25 0.39 -0.020 0.05 -0.130 -0.29 -0.200 0.140 0.050 0.11 [3,] 0.46 0.19 0.34 0.39 0.175 0.25 -0.015 0.14 0.105 0.275 0.135 0.44 [4,] 0.67 0.58 0.51 0.45 0.620 0.45 0.130 0.32 0.180 0.470 0.300 0.51 [5,] 0.78 0.80 0.51 0.45 1.330 0.59 0.340 0.36 0.560 0.470 0.450 0.66 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.3180929 -0.20992 0.1722916 0.3512981 -0.2378207 -0.00801292 -0.1827084 [2,] 0.6019071 0.58992 0.5077084 0.4287019 0.5878207 0.50801292 0.1527084 [,8] [,9] [,10] [,11] [,12] [1,] -0.2534697 -0.1401123 0.06213934 -0.02625807 0.157361 [2,] 0.5334697 0.3501123 0.48786066 0.29625807 0.722639 $out [1] 0.99 -0.08 -0.69 1.00 -0.67 -1.62 $group [1] 4 4 7 10 10 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(0.379999999999995, 0.450000000000003, 0.460000000000001, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6xvt11356526921.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.480 103.480 108.840 110.970 112.050 115.660 NA [2,] 104.165 104.165 110.545 111.055 113.135 117.055 NA [3,] 104.780 106.280 111.575 111.280 113.800 117.970 NA [4,] 105.055 106.835 112.230 111.360 114.330 118.400 NA [5,] 105.260 108.400 112.870 111.740 115.000 119.010 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 104.3741 105.0622 110.8065 111.1409 113.255 117.3565 NA [2,] 105.1859 107.4978 112.3435 111.4191 114.345 118.5835 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(103.48, 104.165, 104.78, 105.055, 105.26, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/704zy1356526921.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,] 109.1450 110.100 108.3487 [2,] 110.0400 110.880 109.2000 [3,] 111.0833 111.440 110.4669 [4,] 111.2858 111.675 110.8444 [5,] 111.7167 111.920 111.6238 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 110.5151 111.0774 109.7169 [2,] 111.6516 111.8026 111.2169 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(109.145, 110.04, 111.083333333333, 111.285833333333, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1srnt1356526921.ps tmp/1srnt1356526921.png",intern=TRUE)) character(0) > try(system("convert tmp/2vf9a1356526921.ps tmp/2vf9a1356526921.png",intern=TRUE)) character(0) > try(system("convert tmp/3hh7p1356526921.ps tmp/3hh7p1356526921.png",intern=TRUE)) character(0) > try(system("convert tmp/4hm0t1356526921.ps tmp/4hm0t1356526921.png",intern=TRUE)) character(0) > try(system("convert tmp/524um1356526921.ps tmp/524um1356526921.png",intern=TRUE)) character(0) > try(system("convert tmp/6xvt11356526921.ps tmp/6xvt11356526921.png",intern=TRUE)) character(0) > try(system("convert tmp/704zy1356526921.ps tmp/704zy1356526921.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.868 0.988 4.877