R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing 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(3.96,3.97,3.96,3.95,3.94,3.94,3.95,3.93,3.94,3.92,3.95,3.94,3.95,3.92,3.92,3.92,3.92,3.9,3.92,3.94,3.96,3.95,3.96,3.97,3.99,4,4.05,4.08,4.09,4.12,4.14,4.15,4.15,4.15,4.15,4.2,4.22,4.22,4.22,4.23,4.3,4.29,4.32,4.31,4.35,4.34,4.35,4.38,4.39,4.38,4.34,4.33,4.33,4.33,4.33,4.32,4.35,4.35,4.35,4.36,4.38,4.41,4.43,4.42,4.43,4.43,4.42,4.46,4.44,4.41,4.41,4.46,4.5,4.58,4.61,4.65,4.55,4.63,4.69,4.72,4.71,4.74,4.77,4.78) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.96 3.95 3.99 4.22 4.39 4.38 4.50 NA [2,] 3.97 3.92 4.00 4.22 4.38 4.41 4.58 NA [3,] 3.96 3.92 4.05 4.22 4.34 4.43 4.61 NA [4,] 3.95 3.92 4.08 4.23 4.33 4.42 4.65 NA [5,] 3.94 3.92 4.09 4.30 4.33 4.43 4.55 NA [6,] 3.94 3.90 4.12 4.29 4.33 4.43 4.63 NA [7,] 3.95 3.92 4.14 4.32 4.33 4.42 4.69 NA [8,] 3.93 3.94 4.15 4.31 4.32 4.46 4.72 NA [9,] 3.94 3.96 4.15 4.35 4.35 4.44 4.71 NA [10,] 3.92 3.95 4.15 4.34 4.35 4.41 4.74 NA [11,] 3.95 3.96 4.15 4.35 4.35 4.41 4.77 NA [12,] 3.94 3.97 4.20 4.38 4.36 4.46 4.78 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.01 -0.03 0.01 0.00 -0.01 0.03 0.08 NA [2,] -0.01 0.00 0.05 0.00 -0.04 0.02 0.03 NA [3,] -0.01 0.00 0.03 0.01 -0.01 -0.01 0.04 NA [4,] -0.01 0.00 0.01 0.07 0.00 0.01 -0.10 NA [5,] 0.00 -0.02 0.03 -0.01 0.00 0.00 0.08 NA [6,] 0.01 0.02 0.02 0.03 0.00 -0.01 0.06 NA [7,] -0.02 0.02 0.01 -0.01 -0.01 0.04 0.03 NA [8,] 0.01 0.02 0.00 0.04 0.03 -0.02 -0.01 NA [9,] -0.02 -0.01 0.00 -0.01 0.00 -0.03 0.03 NA [10,] 0.03 0.01 0.00 0.01 0.00 0.00 0.03 NA [11,] -0.01 0.01 0.05 0.03 0.01 0.05 0.01 NA [12,] 0.01 0.02 0.02 0.01 0.02 0.04 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/1hys91381947226.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/2ommg1381947226.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/3c6ql1381947226.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/4zmf81381947226.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,] 3.950 3.920 3.920 3.920 3.920 3.90 3.920 3.930 3.940 3.92 3.950 3.940 [2,] 3.975 3.985 4.005 4.015 4.015 4.03 4.045 4.045 4.055 4.05 4.055 4.085 [3,] 4.220 4.220 4.220 4.230 4.300 4.29 4.320 4.310 4.350 4.34 4.350 4.360 [4,] 4.385 4.395 4.385 4.375 4.380 4.38 4.375 4.390 4.395 4.38 4.380 4.420 [5,] 4.500 4.580 4.610 4.650 4.550 4.63 4.690 4.720 4.710 4.74 4.770 4.780 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.975155 3.975155 3.99307 4.015014 4.082028 4.080986 4.122929 4.103972 [2,] 4.464845 4.464845 4.44693 4.444986 4.517972 4.499014 4.517071 4.516028 [,9] [,10] [,11] [,12] [1,] 4.146957 4.142929 4.155915 4.159943 [2,] 4.553043 4.537071 4.544085 4.560057 $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(3.95, 3.975, 4.22, 4.385, 4.5, 3.92, 3.985, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5csl81381947226.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.030 -0.040 -0.01 -0.010 -0.020 -0.010 -0.020 -0.020 -0.030 0.00 -0.01 [2,] -0.005 -0.005 -0.01 -0.005 -0.005 0.005 -0.010 -0.005 -0.015 0.00 0.01 [3,] 0.010 0.000 0.00 0.000 0.000 0.020 0.010 0.010 -0.010 0.01 0.01 [4,] 0.020 0.025 0.02 0.010 0.015 0.025 0.025 0.025 0.000 0.02 0.04 [5,] 0.030 0.050 0.04 0.010 0.030 0.030 0.040 0.040 0.000 0.03 0.05 [,12] [1,] 0.01 [2,] 0.01 [3,] 0.02 [4,] 0.02 [5,] 0.02 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.004929597 -0.01791552 -0.01791552 -0.008957758 -0.01194368 0.008056323 [2,] 0.024929597 0.01791552 0.01791552 0.008957758 0.01194368 0.031943677 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.01090144 -0.007915516 -0.018957758 -0.001943677 -0.007915516 0.01354968 [2,] 0.03090144 0.027915516 -0.001042242 0.021943677 0.027915516 0.02645032 $out [1] 0.08 0.07 -0.10 0.08 0.06 0.03 0.04 $group [1] 1 4 4 5 6 9 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0300000000000002, -0.00499999999999989, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6wgw81381947226.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] [1,] 3.920 3.900 3.990 4.220 4.320 4.380 4.500 NA [2,] 3.940 3.920 4.065 4.225 4.330 4.410 4.595 NA [3,] 3.945 3.930 4.130 4.305 4.345 4.425 4.670 NA [4,] 3.955 3.955 4.150 4.345 4.355 4.435 4.730 NA [5,] 3.970 3.970 4.200 4.380 4.390 4.460 4.780 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3.938158 3.914036 4.091231 4.250267 4.333597 4.413597 4.608426 NA [2,] 3.951842 3.945964 4.168769 4.359733 4.356403 4.436403 4.731574 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(3.92, 3.94, 3.945, 3.955, 3.97, 3.9, 3.92, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7wdsf1381947226.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,] 4.198571 4.220 4.1800 [2,] 4.220714 4.225 4.1950 [3,] 4.243571 4.305 4.2075 [4,] 4.268571 4.345 4.2175 [5,] 4.298571 4.360 4.2250 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 4.221743 4.250267 4.197238 [2,] 4.265399 4.359733 4.217762 $out [1] 4.2525 $group [1] 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(4.19857142857143, 4.22071428571429, 4.24357142857143, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1hys91381947226.ps tmp/1hys91381947226.png",intern=TRUE)) character(0) > try(system("convert tmp/2ommg1381947226.ps tmp/2ommg1381947226.png",intern=TRUE)) character(0) > try(system("convert tmp/3c6ql1381947226.ps tmp/3c6ql1381947226.png",intern=TRUE)) character(0) > try(system("convert tmp/4zmf81381947226.ps tmp/4zmf81381947226.png",intern=TRUE)) character(0) > try(system("convert tmp/5csl81381947226.ps tmp/5csl81381947226.png",intern=TRUE)) character(0) > try(system("convert tmp/6wgw81381947226.ps tmp/6wgw81381947226.png",intern=TRUE)) character(0) > try(system("convert tmp/7wdsf1381947226.ps tmp/7wdsf1381947226.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.017 0.533 3.543