R version 3.2.2 (2015-08-14) -- "Fire Safety" 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(254,200,165,123,162,145,145,161,155,173,160,47,232,143,161,159,243,192,157,143,221,227,132,41,273,182,188,162,140,186,178,236,202,184,119,16,340,151,240,235,76.93,79.32,79.35,80.94,80.13,81.38,81.1,81.53,80.46,79.71,78.66,79.96,80.64,81.8,81.06,81.67,79.72,81.28,81.36,85.26,90,93,95.62,102.15,105.73,109.79,113.77,114.3,114.76,113.69,113.88,114.47,112.57,114.43,112.7,113.48,113.05,112.22,111.44,111.67,111.91,111.7,104.26,101.13,98.55,97.06,96.22,95.15,94.54,94.29,93.98,93.76,94.16,93.83,93.97,94.19,94.14,94.24,94.27,94.21,93.45,95.84,98.59,97,96.45,96.48,96.1,95.49,95.85,95.85,98.52,101.77,101.2,102.85,102.98,102.87,100.48,97.59,97.55,99.06,100.43,102.93,104.22,105.26,105.44,106.97,105.82,104.4,102.03,100.17,98.01,96.49,95.63,95.4,94.97,94.68,95.87,94.99,94.65,94.35,94.1,94.21,95.2,95.55,95.68,95.27,95.3,95.93) > 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] 148 > (np <- floor(n / par1)) [1] 12 > 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] 13 13 13 13 12 12 12 12 12 12 12 12 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 254 232 273 340.00 80.46 90.00 112.57 98.55 94.14 95.85 100.43 95.63 [2,] 200 143 182 151.00 79.71 93.00 114.43 97.06 94.24 95.85 102.93 95.40 [3,] 165 161 188 240.00 78.66 95.62 112.70 96.22 94.27 98.52 104.22 94.97 [4,] 123 159 162 235.00 79.96 102.15 113.48 95.15 94.21 101.77 105.26 94.68 [5,] 162 243 140 76.93 80.64 105.73 113.05 94.54 93.45 101.20 105.44 95.87 [6,] 145 192 186 79.32 81.80 109.79 112.22 94.29 95.84 102.85 106.97 94.99 [7,] 145 157 178 79.35 81.06 113.77 111.44 93.98 98.59 102.98 105.82 94.65 [8,] 161 143 236 80.94 81.67 114.30 111.67 93.76 97.00 102.87 104.40 94.35 [9,] 155 221 202 80.13 79.72 114.76 111.91 94.16 96.45 100.48 102.03 94.10 [10,] 173 227 184 81.38 81.28 113.69 111.70 93.83 96.48 97.59 100.17 94.21 [11,] 160 132 119 81.10 81.36 113.88 104.26 93.97 96.10 97.55 98.01 95.20 [12,] 47 41 16 81.53 85.26 114.47 101.13 94.19 95.49 99.06 96.49 95.55 [,13] [1,] 95.68 [2,] 95.27 [3,] 95.30 [4,] 95.93 [5,] NA [6,] NA [7,] NA [8,] NA [9,] NA [10,] NA [11,] NA [12,] NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] -54 -89 -91 -189.00 -0.75 3.00 1.86 -1.49 0.10 0.00 2.50 -0.23 [2,] -35 18 6 89.00 -1.05 2.62 -1.73 -0.84 0.03 2.67 1.29 -0.43 [3,] -42 -2 -26 -5.00 1.30 6.53 0.78 -1.07 -0.06 3.25 1.04 -0.29 [4,] 39 84 -22 -158.07 0.68 3.58 -0.43 -0.61 -0.76 -0.57 0.18 1.19 [5,] -17 -51 46 2.39 1.16 4.06 -0.83 -0.25 2.39 1.65 1.53 -0.88 [6,] 0 -35 -8 0.03 -0.74 3.98 -0.78 -0.31 2.75 0.13 -1.15 -0.34 [7,] 16 -14 58 1.59 0.61 0.53 0.23 -0.22 -1.59 -0.11 -1.42 -0.30 [8,] -6 78 -34 -0.81 -1.95 0.46 0.24 0.40 -0.55 -2.39 -2.37 -0.25 [9,] 18 6 -18 1.25 1.56 -1.07 -0.21 -0.33 0.03 -2.89 -1.86 0.11 [10,] -13 -95 -65 -0.28 0.08 0.19 -7.44 0.14 -0.38 -0.04 -2.16 0.99 [11,] -113 -91 -103 0.43 3.90 0.59 -3.13 0.22 -0.61 1.51 -1.52 0.35 [12,] 185 232 324 -1.07 4.74 -1.90 -2.58 -0.05 0.36 1.37 -0.86 0.13 [,13] [1,] -0.41 [2,] 0.03 [3,] 0.63 [4,] NA [5,] NA [6,] NA [7,] NA [8,] NA [9,] NA [10,] NA [11,] NA [12,] 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/116541445630491.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/2qvb11445630491.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/37waq1445630491.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/4ksk71445630491.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,] 80.46 79.71 78.66 79.96 76.930 79.32 79.350 80.940 79.720 81.280 [2,] 95.63 95.27 95.30 95.15 93.995 94.64 94.315 94.055 94.130 94.020 [3,] 98.55 97.06 98.52 102.15 103.320 104.91 104.400 103.635 101.255 98.880 [4,] 232.00 143.00 161.00 123.00 126.525 128.61 129.385 128.650 134.880 143.345 [5,] 340.00 200.00 240.00 162.00 162.000 145.00 178.000 161.000 155.000 184.000 [,11] [,12] [1,] 81.100 16.000 [2,] 94.585 64.265 [3,] 97.780 94.840 [4,] 116.440 97.775 [5,] 132.000 114.470 $n [1] 13 13 13 13 12 12 12 12 12 12 12 12 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 38.79087 76.14409 69.7294 89.94576 88.48285 89.41605 88.40434 [2,] 158.30913 117.97591 127.3106 114.35424 118.15715 120.40395 120.39566 [,8] [,9] [,10] [,11] [,12] [1,] 87.85599 82.66865 76.38254 87.81179 79.55586 [2,] 119.41401 119.84135 121.37746 107.74821 110.12414 $out [1] 235 243 192 186 236 221 202 227 160 $group [1] 4 5 6 6 8 9 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(80.46, 95.63, 98.55, 232, 340, 79.71, 95.27, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5owzn1445630491.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,] -91.00 -1.73 -5.00 -0.760 -0.880 -1.150 -1.59 -6.00 -2.890 -13.00 -113.000 [2,] -54.00 -0.84 -2.00 -0.685 -0.855 -0.965 -0.86 -2.38 -1.465 -10.22 -47.065 [3,] -0.41 0.03 -0.06 -0.125 1.345 -0.325 0.06 -0.68 -0.090 -0.33 -0.195 [4,] 0.10 2.67 1.04 2.385 2.390 0.080 1.10 0.32 1.405 0.11 0.510 [5,] 3.00 6.00 3.25 3.580 4.060 0.130 1.59 0.46 1.560 0.99 3.900 [,12] [1,] -2.580 [2,] -0.965 [3,] 0.245 [4,] 94.870 [5,] 232.000 $n [1] 13 13 13 12 12 12 12 12 12 12 12 12 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -24.11733 -1.508128 -1.392168 -1.525248 -0.1350663 -0.8016315 -0.8339692 [2,] 23.29733 1.568128 1.272168 1.275248 2.8250663 0.1516315 0.9539692 [,8] [,9] [,10] [,11] [,12] [1,] -1.9114881 -1.399026 -5.041582 -21.89428 -43.46599 [2,] 0.5514881 1.219026 4.381582 21.50428 43.95599 $out [1] -189.00 -35.00 18.00 89.00 -42.00 -26.00 6.53 39.00 84.00 [10] -22.00 -158.07 -17.00 -51.00 46.00 -35.00 -8.00 3.98 2.75 [19] 16.00 -14.00 58.00 78.00 -34.00 18.00 6.00 -18.00 -95.00 [28] -65.00 324.00 $group [1] 1 2 2 2 3 3 3 4 4 4 4 5 5 5 6 6 6 6 7 7 7 8 8 9 9 [26] 9 10 10 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-91, -54, -0.410000000000011, 0.0999999999999943, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6e2271445630491.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,] 123.0 41 119 76.93 78.660 90.000 111.440 93.760 93.450 95.85 96.490 [2,] 145.0 143 151 79.74 79.840 98.885 111.555 93.975 94.225 97.57 100.300 [3,] 160.5 160 183 81.24 80.850 111.740 112.065 94.240 95.665 99.77 103.575 [4,] 169.0 224 195 193.00 81.515 114.090 112.875 95.685 96.465 102.31 105.350 [5,] 200.0 243 236 340.00 81.800 114.760 114.430 97.060 98.590 102.98 106.970 [,12] [,13] [1,] 94.100 95.270 [2,] 94.500 95.285 [3,] 94.980 95.490 [4,] 95.475 95.805 [5,] 95.870 95.930 $n [1] 12 12 12 12 12 12 12 12 12 12 12 12 4 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 149.5534 123.0554 162.9313 29.58135 80.08602 104.8049 111.4629 93.46006 [2,] 171.4466 196.9446 203.0687 132.89865 81.61398 118.6751 112.6671 95.01994 [,9] [,10] [,11] [,12] [,13] [1,] 94.64332 97.60805 101.2717 94.5353 95.0792 [2,] 96.68668 101.93195 105.8783 95.4247 95.9008 $out [1] 254.00 47.00 273.00 16.00 85.26 104.26 101.13 98.55 $group [1] 1 1 3 3 5 7 7 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" NA Warning message: In bxp(list(stats = c(123, 145, 160.5, 169, 200, 41, 143, 160, 224, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7anxu1445630491.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,] 113.4700 94.8400 105.0263 [2,] 115.1129 98.1500 107.3212 [3,] 118.5871 100.0675 108.5525 [4,] 121.0863 103.4775 115.2256 [5,] 124.9600 104.9100 119.1350 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 115.8626 97.63759 104.9473 [2,] 121.3115 102.49741 112.1577 $out [1] 150.9469 106.0358 80.5975 163.8150 128.1500 85.0150 $group [1] 1 1 1 3 3 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(113.47, 115.112916666667, 118.587051282051, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/116541445630491.ps tmp/116541445630491.png",intern=TRUE)) character(0) > try(system("convert tmp/2qvb11445630491.ps tmp/2qvb11445630491.png",intern=TRUE)) character(0) > try(system("convert tmp/37waq1445630491.ps tmp/37waq1445630491.png",intern=TRUE)) character(0) > try(system("convert tmp/4ksk71445630491.ps tmp/4ksk71445630491.png",intern=TRUE)) character(0) > try(system("convert tmp/5owzn1445630491.ps tmp/5owzn1445630491.png",intern=TRUE)) character(0) > try(system("convert tmp/6e2271445630491.ps tmp/6e2271445630491.png",intern=TRUE)) character(0) > try(system("convert tmp/7anxu1445630491.ps tmp/7anxu1445630491.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.828 0.459 3.311