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(1103,1125,1150,1187,1248,1172,1092,5255,5297,5461,5729,5795,5411,5503,5583,5763,5840,5907,5836,5756,5916,6056,6469,6603,6247,6342,6431) > 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] 27 > (np <- floor(n / par1)) [1] 2 > 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] 3 3 3 2 2 2 2 2 2 2 2 2 > arr [,1] [,2] [,3] [1,] 1103 5411 6247 [2,] 1125 5503 6342 [3,] 1150 5583 6431 [4,] 1187 5763 NA [5,] 1248 5840 NA [6,] 1172 5907 NA [7,] 1092 5836 NA [8,] 5255 5756 NA [9,] 5297 5916 NA [10,] 5461 6056 NA [11,] 5729 6469 NA [12,] 5795 6603 NA > darr [,1] [,2] [,3] [1,] 22 92 95 [2,] 25 80 89 [3,] 37 180 NA [4,] 61 77 NA [5,] -76 67 NA [6,] -80 -71 NA [7,] 4163 -80 NA [8,] 42 160 NA [9,] 164 140 NA [10,] 268 413 NA [11,] 66 134 NA [12,] -384 -356 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/1a8a61358027019.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/2kxsd1358027019.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/39bxj1358027019.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/4pgok1358027019.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,] 1103 1125.0 1150.0 1187 1248 1172.0 1092 5255.0 5297.0 5461.0 5729 5795 [2,] 3257 3314.0 3366.5 1187 1248 1172.0 1092 5255.0 5297.0 5461.0 5729 5795 [3,] 5411 5503.0 5583.0 3475 3544 3539.5 3464 5505.5 5606.5 5758.5 6099 6199 [4,] 5829 5922.5 6007.0 5763 5840 5907.0 5836 5756.0 5916.0 6056.0 6469 6603 [5,] 6247 6342.0 6431.0 5763 5840 5907.0 5836 5756.0 5916.0 6056.0 6469 6603 $n [1] 3 3 3 2 2 2 2 2 2 2 2 2 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3064.787 3123.491 3174.3 -1637.439 -1586.314 -1750.578 -1836.133 4945.768 [2,] 7757.213 7882.509 7991.7 8587.439 8674.314 8829.578 8764.133 6065.232 [,9] [,10] [,11] [,12] [1,] 4914.935 5093.749 5272.251 5296.279 [2,] 6298.065 6423.251 6925.749 7101.721 $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(1103, 3257, 5411, 5829, 6247, 1125, 3314, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5uttp1358027019.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,] 22.0 25.0 37.0 61 -76.0 -80.0 -80.0 42 140 268.0 66 -384 [2,] 57.0 52.5 37.0 61 -76.0 -80.0 -80.0 42 140 268.0 66 -384 [3,] 92.0 80.0 108.5 69 -4.5 -75.5 2041.5 101 152 340.5 100 -370 [4,] 93.5 84.5 180.0 77 67.0 -71.0 4163.0 160 164 413.0 134 -356 [5,] 95.0 89.0 180.0 77 67.0 -71.0 4163.0 160 164 413.0 134 -356 $n [1] 3 3 2 2 2 2 2 2 2 2 2 2 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 58.70421 50.80917 -51.26371 51.12434 -164.2637 -85.55506 -2698.901 [2,] 125.29579 109.19083 268.26371 86.87566 155.2637 -65.44494 6781.901 [,8] [,9] [,10] [,11] [,12] [1,] -30.83299 125.1865 178.5018 24.02845 -401.2824 [2,] 232.83299 178.8135 502.4982 175.97155 -338.7176 $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(22, 57, 92, 93.5, 95, 25, 52.5, 80, 84.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6br0g1358027019.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] [1,] 1092.0 5411.0 6247.0 [2,] 1137.5 5669.5 6294.5 [3,] 1217.5 5838.0 6342.0 [4,] 5379.0 5986.0 6386.5 [5,] 5795.0 6056.0 6431.0 $n [1] 12 12 3 $conf [,1] [,2] [,3] [1,] -717.0766 5693.642 6258.076 [2,] 3152.0766 5982.358 6425.924 $out [1] 6469 6603 $group [1] 2 2 $names [1] "1" "2" NA Warning message: In bxp(list(stats = c(1092, 1137.5, 1217.5, 5379, 5795, 5411, 5669.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7elga1358027019.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,] 3464.000 3464.00 3464.00 [2,] 3541.750 3541.75 3541.75 [3,] 4355.667 5504.25 4652.50 [4,] 5682.500 5682.50 5682.50 [5,] 6199.000 6199.00 6199.00 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3379.256 4527.84 3676.09 [2,] 5332.077 6480.66 5628.91 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(3464, 3541.75, 4355.66666666667, 5682.5, 6199, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1a8a61358027019.ps tmp/1a8a61358027019.png",intern=TRUE)) character(0) > try(system("convert tmp/2kxsd1358027019.ps tmp/2kxsd1358027019.png",intern=TRUE)) character(0) > try(system("convert tmp/39bxj1358027019.ps tmp/39bxj1358027019.png",intern=TRUE)) character(0) > try(system("convert tmp/4pgok1358027019.ps tmp/4pgok1358027019.png",intern=TRUE)) character(0) > try(system("convert tmp/5uttp1358027019.ps tmp/5uttp1358027019.png",intern=TRUE)) character(0) > try(system("convert tmp/6br0g1358027019.ps tmp/6br0g1358027019.png",intern=TRUE)) character(0) > try(system("convert tmp/7elga1358027019.ps tmp/7elga1358027019.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.581 0.634 4.219