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(92.46,91.73,91.73,91.73,91.73,91.73,91.73,91.73,91.73,91.73,91.73,91.73,91.73,86.87,86.87,86.87,86.87,86.87,86.87,86.87,86.87,86.87,86.87,86.87,86.87,89.81,89.81,89.81,89.81,89.81,89.81,89.81,89.81,89.81,89.81,89.81,89.81,94.81,94.81,94.81,94.81,94.81,94.81,94.81,94.81,94.81,94.81,94.81,94.81,95.01,95.01,95.01,95.01,95.01,95.01,95.01,95.01,95.01,95.01,95.01,95.01,95.57,95.57,95.57,95.57,95.57,95.57,95.57,95.57,95.57,95.57,95.57,95.57,98.56,98.56,98.56,98.56,98.56,98.56,98.56,98.56,98.56,98.56,98.56,98.56,100.13,100.13,100.13,100.13,100.13,100.13,100.13,100.13,100.13,100.13,100.13,100.13,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86,101.86) > 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] 120 > (np <- floor(n / par1)) [1] 10 > 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] 10 10 10 10 10 10 10 10 10 10 10 10 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 92.46 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 NA [2,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [3,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [4,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [5,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [6,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [7,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [8,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [9,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [10,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [11,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [12,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -0.73 -4.86 2.94 5 0.2 0.56 2.99 1.57 1.73 0 NA [2,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [3,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [4,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [5,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [6,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [7,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [8,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [9,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [10,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [11,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 0 NA [12,] 0.00 0.00 0.00 0 0.0 0.00 0.00 0.00 0.00 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/1cuhi1457176370.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/2icfp1457176370.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/3swmb1457176370.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/4wfzs1457176370.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,] 86.87 86.87 86.87 86.87 86.87 86.87 86.87 86.87 86.87 86.87 [2,] 91.73 91.73 91.73 91.73 91.73 91.73 91.73 91.73 91.73 91.73 [3,] 94.91 95.29 95.29 95.29 95.29 95.29 95.29 95.29 95.29 95.29 [4,] 98.56 100.13 100.13 100.13 100.13 100.13 100.13 100.13 100.13 100.13 [5,] 101.86 101.86 101.86 101.86 101.86 101.86 101.86 101.86 101.86 101.86 [,11] [,12] [1,] 86.87 86.87 [2,] 91.73 91.73 [3,] 95.29 95.29 [4,] 100.13 100.13 [5,] 101.86 101.86 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 91.49746 91.09303 91.09303 91.09303 91.09303 91.09303 91.09303 91.09303 [2,] 98.32254 99.48697 99.48697 99.48697 99.48697 99.48697 99.48697 99.48697 [,9] [,10] [,11] [,12] [1,] 91.09303 91.09303 91.09303 91.09303 [2,] 99.48697 99.48697 99.48697 99.48697 $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(86.87, 91.73, 94.91, 98.56, 101.86, 86.87, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/560ox1457176370.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.730 0 0 0 0 0 0 0 0 0 0 0 [2,] 0.000 0 0 0 0 0 0 0 0 0 0 0 [3,] 1.065 0 0 0 0 0 0 0 0 0 0 0 [4,] 2.940 0 0 0 0 0 0 0 0 0 0 0 [5,] 5.000 0 0 0 0 0 0 0 0 0 0 0 $n [1] 10 10 10 10 10 10 10 10 10 10 10 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.4039412 0 0 0 0 0 0 0 0 0 0 0 [2,] 2.5339412 0 0 0 0 0 0 0 0 0 0 0 $out [1] -4.86 $group [1] 1 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.72999999999999, 0, 1.06499999999999, 2.94, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/65r2o1457176370.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] [,9] [,10] [,11] [1,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [2,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [3,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [4,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [5,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA [2,] 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 101.86 101.86 NA $out [1] 92.46 91.73 86.87 89.81 94.81 95.01 95.57 98.56 100.13 $group [1] 1 2 3 4 5 6 7 8 9 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7qepn1457176370.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,] 95.621 95.29 96.11875 [2,] 95.621 95.29 96.11875 [3,] 95.621 95.29 96.11875 [4,] 95.621 95.29 96.11875 [5,] 95.621 95.29 96.11875 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 95.621 95.29 96.11875 [2,] 95.621 95.29 96.11875 $out [1] 94.6810 94.9100 94.8625 $group [1] 1 2 3 $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1cuhi1457176370.ps tmp/1cuhi1457176370.png",intern=TRUE)) character(0) > try(system("convert tmp/2icfp1457176370.ps tmp/2icfp1457176370.png",intern=TRUE)) character(0) > try(system("convert tmp/3swmb1457176370.ps tmp/3swmb1457176370.png",intern=TRUE)) character(0) > try(system("convert tmp/4wfzs1457176370.ps tmp/4wfzs1457176370.png",intern=TRUE)) character(0) > try(system("convert tmp/560ox1457176370.ps tmp/560ox1457176370.png",intern=TRUE)) character(0) > try(system("convert tmp/65r2o1457176370.ps tmp/65r2o1457176370.png",intern=TRUE)) character(0) > try(system("convert tmp/7qepn1457176370.ps tmp/7qepn1457176370.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.405 0.385 2.812