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(90.75,92.82,97.78,99.32,98.33,98.66,98.13,97.8,99.36,100.37,103.22,101.68,104.39,103.99,106.71,106.06,103.5,100.17,101.1,105.93,108.09,107.27,104.9,102.7,102.06,103.05,102.08,100.13,97.56,97.38,99.66,99.58,102.7,98.92,97.85,99.01,97.71,97.95,97.24,96.69,96.41,96.99,98.36,97.8,96.79,94.73,92.67,87.15,79.54,82.35,86.38,84.75,87.54,86.73,84.74,80.75,79.28,78.52,78.54,77.33) > 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,] 90.75 104.39 102.06 97.71 79.54 NA [2,] 92.82 103.99 103.05 97.95 82.35 NA [3,] 97.78 106.71 102.08 97.24 86.38 NA [4,] 99.32 106.06 100.13 96.69 84.75 NA [5,] 98.33 103.50 97.56 96.41 87.54 NA [6,] 98.66 100.17 97.38 96.99 86.73 NA [7,] 98.13 101.10 99.66 98.36 84.74 NA [8,] 97.80 105.93 99.58 97.80 80.75 NA [9,] 99.36 108.09 102.70 96.79 79.28 NA [10,] 100.37 107.27 98.92 94.73 78.52 NA [11,] 103.22 104.90 97.85 92.67 78.54 NA [12,] 101.68 102.70 99.01 87.15 77.33 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 2.07 -0.40 0.99 0.24 2.81 NA [2,] 4.96 2.72 -0.97 -0.71 4.03 NA [3,] 1.54 -0.65 -1.95 -0.55 -1.63 NA [4,] -0.99 -2.56 -2.57 -0.28 2.79 NA [5,] 0.33 -3.33 -0.18 0.58 -0.81 NA [6,] -0.53 0.93 2.28 1.37 -1.99 NA [7,] -0.33 4.83 -0.08 -0.56 -3.99 NA [8,] 1.56 2.16 3.12 -1.01 -1.47 NA [9,] 1.01 -0.82 -3.78 -2.06 -0.76 NA [10,] 2.85 -2.37 -1.07 -2.06 0.02 NA [11,] -1.54 -2.20 1.16 -5.52 -1.21 NA [12,] 2.71 -0.64 -1.30 -7.61 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/17l0o1457193926.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/2ln8m1457193926.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/3f3kf1457193926.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/4n07i1457193926.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] [1,] 79.54 82.35 97.24 96.69 96.41 96.99 98.13 97.80 96.79 94.73 78.54 [2,] 90.75 92.82 97.24 96.69 96.41 96.99 98.13 97.80 96.79 94.73 92.67 [3,] 97.71 97.95 97.78 99.32 97.56 97.38 98.36 97.80 99.36 98.92 97.85 [4,] 102.06 103.05 102.08 100.13 98.33 98.66 99.66 99.58 102.70 100.37 103.22 [5,] 104.39 103.99 106.71 100.13 98.33 100.17 101.10 99.58 108.09 107.27 104.90 [,12] [1,] 77.33 [2,] 87.15 [3,] 99.01 [4,] 101.68 [5,] 102.70 $n [1] 5 5 5 5 5 5 5 5 5 5 5 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 89.71838 90.72151 94.36007 96.8893 96.20333 96.19998 97.27891 96.54226 [2,] 105.70162 105.17849 101.19993 101.7507 98.91667 98.56002 99.44109 99.05774 [,9] [,10] [,11] [,12] [1,] 95.18401 94.93479 90.3954 88.74314 [2,] 103.53599 102.90521 105.3046 109.27686 $out [1] 86.38 106.06 84.75 103.50 87.54 86.73 84.74 105.93 80.75 79.28 [11] 78.52 $group [1] 3 4 4 5 5 6 7 8 8 9 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(79.54, 90.75, 97.71, 102.06, 104.39, 82.35, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5erdz1457193926.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.40 -0.97 -1.95 -2.57 -0.81 -1.99 -0.56 -1.47 -3.78 -2.37 -2.20 -7.610 [2,] 0.24 -0.71 -1.63 -2.56 -0.81 -0.53 -0.56 -1.01 -2.06 -2.06 -2.20 -4.455 [3,] 0.99 2.72 -0.65 -0.99 -0.18 0.93 -0.33 1.56 -0.82 -1.07 -1.54 -0.970 [4,] 2.07 4.03 -0.55 -0.28 0.33 1.37 -0.08 2.16 -0.76 0.02 -1.21 1.035 [5,] 2.81 4.96 -0.55 2.79 0.58 2.28 -0.08 3.12 1.01 2.85 -1.21 2.710 $n [1] 5 5 5 5 5 5 5 5 5 5 5 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.3030734 -0.6292721 -1.4131253 -2.6010423 -0.9855211 -0.4125352 [2,] 2.2830734 6.0692721 0.1131253 0.6210423 0.6255211 2.2725352 [,7] [,8] [,9] [,10] [,11] [,12] [1,] -0.669166791 -0.679914 -1.73857673 -2.5397228 -2.2395315 -5.3071 [2,] 0.009166791 3.799914 0.09857673 0.3997228 -0.8404685 3.3671 $out [1] 1.54 -3.33 4.83 -3.99 1.16 -5.52 $group [1] 3 5 7 7 11 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-0.400000000000006, 0.240000000000009, 0.989999999999995, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6au5c1457193926.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,] 97.780 100.170 97.380 92.670 77.330 NA [2,] 97.790 103.100 98.385 95.570 78.910 NA [3,] 98.495 104.645 99.620 96.890 81.550 NA [4,] 99.865 106.385 102.070 97.755 85.565 NA [5,] 101.680 108.090 103.050 98.360 87.540 NA $n [1] 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [1,] 97.54858 103.1467 97.93925 95.89341 78.51461 NA [2,] 99.44142 106.1433 101.30075 97.88659 84.58539 NA $out [1] 90.75 92.82 103.22 87.15 $group [1] 1 1 1 4 $names [1] "1" "2" "3" "4" "5" NA Warning message: In bxp(list(stats = c(97.78, 97.79, 98.495, 99.865, 101.68, 100.17, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7oiwl1457193926.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,] 94.890 97.380 96.4050 [2,] 95.699 97.745 97.4600 [3,] 96.202 97.900 97.9400 [4,] 96.956 98.965 98.7925 [5,] 98.038 99.360 99.7450 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 95.62867 97.34355 97.33224 [2,] 96.77533 98.45645 98.54776 $out [1] 93.574 94.415 $group [1] 1 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(94.89, 95.699, 96.202, 96.956, 98.038, 97.38, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/17l0o1457193926.ps tmp/17l0o1457193926.png",intern=TRUE)) character(0) > try(system("convert tmp/2ln8m1457193926.ps tmp/2ln8m1457193926.png",intern=TRUE)) character(0) > try(system("convert tmp/3f3kf1457193926.ps tmp/3f3kf1457193926.png",intern=TRUE)) character(0) > try(system("convert tmp/4n07i1457193926.ps tmp/4n07i1457193926.png",intern=TRUE)) character(0) > try(system("convert tmp/5erdz1457193926.ps tmp/5erdz1457193926.png",intern=TRUE)) character(0) > try(system("convert tmp/6au5c1457193926.ps tmp/6au5c1457193926.png",intern=TRUE)) character(0) > try(system("convert tmp/7oiwl1457193926.ps tmp/7oiwl1457193926.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.458 0.412 2.901