R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(86.37,86.84,86.73,90.99,92.61,93.83,94.2,94.01,93.47,93.27,94.3,94.53,94.59,94.69,94.67,96.55,97.14,97.32,97.97,98.49,99.11,99.09,98.76,99.2,99.61,99.54,99.68,100.75,100.38,100.79,100.39,100.39,100.12,100,99.17,99.17,99.59,99.96,99.68,101.03,100.99,101.38,101.84,101.52,101.37,101.22,101.45,101.99,104.05,104.61,105.06,105.4,104.71,104.8,104.83,104.81,104.49,104.59,104.5,104.61) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Mon, 30 Nov 2015 07:01:18 +0000) > #Author: root > #To cite this work: Wessa P., (2015), Mean Plot (v1.0.5) 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) > x <- na.omit(x) > (n <- length(x)) [1] 60 > (np <- floor(n / par1)) [1] 5 > 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] 5 5 5 5 5 5 5 5 5 5 5 5 > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 86.37 94.59 99.61 99.59 104.05 NA [2,] 86.84 94.69 99.54 99.96 104.61 NA [3,] 86.73 94.67 99.68 99.68 105.06 NA [4,] 90.99 96.55 100.75 101.03 105.40 NA [5,] 92.61 97.14 100.38 100.99 104.71 NA [6,] 93.83 97.32 100.79 101.38 104.80 NA [7,] 94.20 97.97 100.39 101.84 104.83 NA [8,] 94.01 98.49 100.39 101.52 104.81 NA [9,] 93.47 99.11 100.12 101.37 104.49 NA [10,] 93.27 99.09 100.00 101.22 104.59 NA [11,] 94.30 98.76 99.17 101.45 104.50 NA [12,] 94.53 99.20 99.17 101.99 104.61 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.47 0.10 -0.07 0.37 0.56 NA [2,] -0.11 -0.02 0.14 -0.28 0.45 NA [3,] 4.26 1.88 1.07 1.35 0.34 NA [4,] 1.62 0.59 -0.37 -0.04 -0.69 NA [5,] 1.22 0.18 0.41 0.39 0.09 NA [6,] 0.37 0.65 -0.40 0.46 0.03 NA [7,] -0.19 0.52 0.00 -0.32 -0.02 NA [8,] -0.54 0.62 -0.27 -0.15 -0.32 NA [9,] -0.20 -0.02 -0.12 -0.15 0.10 NA [10,] 1.03 -0.33 -0.83 0.23 -0.09 NA [11,] 0.23 0.44 0.00 0.54 0.11 NA [12,] 0.06 0.41 0.42 2.06 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/1poaq1457174785.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/2v48c1457174785.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/3lun91457174785.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/4t9sc1457174785.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,] 94.59 86.84 94.67 90.99 92.61 93.83 94.20 94.01 99.11 99.09 [2,] 94.59 94.69 94.67 96.55 97.14 97.32 97.97 98.49 99.11 99.09 [3,] 99.59 99.54 99.68 100.75 100.38 100.79 100.39 100.39 100.12 100.00 [4,] 99.61 99.96 99.68 101.03 100.99 101.38 101.84 101.52 101.37 101.22 [5,] 104.05 104.61 105.06 105.40 104.71 104.80 104.83 104.81 104.49 101.22 [,11] [,12] [1,] 98.76 99.17 [2,] 98.76 99.17 [3,] 99.17 99.20 [4,] 101.45 101.99 [5,] 104.50 104.61 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 96.04288 95.81623 96.13995 97.58444 97.6596 97.92121 97.65547 [2,] 103.13712 103.26377 103.22005 103.91556 103.1004 103.65879 103.12453 [,8] [,9] [,10] [,11] [,12] [1,] 98.24901 98.52309 98.49495 97.26925 97.2074 [2,] 102.53099 101.71691 101.50505 101.07075 101.1926 $out [1] 86.37 86.73 93.47 93.27 104.59 94.30 94.53 $group [1] 1 3 9 10 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(94.59, 94.59, 99.59, 99.61, 104.05, 86.84, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5o1611457174785.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.07 -0.28 0.34 -0.69 0.09 -0.40 -0.32 -0.54 -0.20 -0.83 0.00 0.060 [2,] 0.10 -0.11 1.07 -0.37 0.18 0.03 -0.19 -0.32 -0.15 -0.33 0.11 0.235 [3,] 0.37 -0.02 1.35 -0.04 0.39 0.37 -0.02 -0.27 -0.12 -0.09 0.23 0.415 [4,] 0.47 0.14 1.88 0.59 0.41 0.46 0.00 -0.15 -0.02 0.23 0.44 1.240 [5,] 0.56 0.45 1.88 1.62 0.41 0.65 0.00 -0.15 0.10 1.03 0.54 2.060 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.1085589 -0.1966494 0.777656 -0.7183336 0.2274826 0.06616308 -0.1542535 [2,] 0.6314411 0.1566494 1.922344 0.6383336 0.5525174 0.67383692 0.1142535 [,8] [,9] [,10] [,11] [,12] [1,] -0.3901216 -0.21185767 -0.4856946 -0.003177169 -0.37895 [2,] -0.1498784 -0.02814233 0.3056946 0.463177169 1.20895 $out [1] 4.26 1.22 0.52 0.62 $group [1] 3 5 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.0699999999999932, 0.0999999999999943, 0.36999999999999, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6oqlq1457174785.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] [1,] 86.370 94.590 99.170 99.590 104.490 NA [2,] 88.915 95.620 99.575 100.475 104.545 NA [3,] 93.370 97.645 100.060 101.295 104.660 NA [4,] 94.105 98.925 100.390 101.485 104.820 NA [5,] 94.530 99.200 100.790 101.990 105.060 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 91.00281 96.13757 99.68827 100.8343 104.5346 NA [2,] 95.73719 99.15243 100.43173 101.7557 104.7854 NA $out [1] 104.05 105.40 $group [1] 5 5 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(86.37, 88.915, 93.37, 94.105, 94.53, 94.59, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7b4kv1457174785.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,] 96.842 99.170 97.1000 [2,] 98.054 99.565 98.0575 [3,] 99.629 100.060 99.6275 [4,] 99.778 100.390 100.1300 [5,] 99.900 100.790 100.5800 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 98.84267 99.68371 98.68222 [2,] 100.41533 100.43629 100.57278 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(96.842, 98.054, 99.629, 99.778, 99.9, 99.17, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1poaq1457174785.ps tmp/1poaq1457174785.png",intern=TRUE)) character(0) > try(system("convert tmp/2v48c1457174785.ps tmp/2v48c1457174785.png",intern=TRUE)) character(0) > try(system("convert tmp/3lun91457174785.ps tmp/3lun91457174785.png",intern=TRUE)) character(0) > try(system("convert tmp/4t9sc1457174785.ps tmp/4t9sc1457174785.png",intern=TRUE)) character(0) > try(system("convert tmp/5o1611457174785.ps tmp/5o1611457174785.png",intern=TRUE)) character(0) > try(system("convert tmp/6oqlq1457174785.ps tmp/6oqlq1457174785.png",intern=TRUE)) character(0) > try(system("convert tmp/7b4kv1457174785.ps tmp/7b4kv1457174785.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.406 0.382 2.806