R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 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(3441,3431,3420,3400,3606,3596,3441,3338,3348,3348,3358,3379,3441,3472,3524,3565,3751,3730,3575,3348,3389,3431,3420,3472,3431,3503,3534,3544,3772,3730,3575,3348,3389,3358,3410,3524,3513,3493,3544,3575,3751,3761,3575,3307,3286,3348,3296,3462,3462,3400,3482,3534,3710,3761,3544,3286,3286,3203,3141,3276,3224,3100,3183,3255,3472,3555,3327,3162,3162,3100,3059,3141,3038,3017,3069,3141,3358,3400,3131,2935,2842,2749,2697,2800,2738,2749,2800,2842,3048,3079,2749,2594,2439,2335,2263,2366,2315,2397,2428,2459,2594,2676,2263,2160,1901,1736,1684,1829,1746,1850,1850,1860,1984,2067,1664,1519,1281,1126,1044,1250) > 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,] 3441 3441 3431 3513 3462 3224 3038 2738 2315 1746 NA [2,] 3431 3472 3503 3493 3400 3100 3017 2749 2397 1850 NA [3,] 3420 3524 3534 3544 3482 3183 3069 2800 2428 1850 NA [4,] 3400 3565 3544 3575 3534 3255 3141 2842 2459 1860 NA [5,] 3606 3751 3772 3751 3710 3472 3358 3048 2594 1984 NA [6,] 3596 3730 3730 3761 3761 3555 3400 3079 2676 2067 NA [7,] 3441 3575 3575 3575 3544 3327 3131 2749 2263 1664 NA [8,] 3338 3348 3348 3307 3286 3162 2935 2594 2160 1519 NA [9,] 3348 3389 3389 3286 3286 3162 2842 2439 1901 1281 NA [10,] 3348 3431 3358 3348 3203 3100 2749 2335 1736 1126 NA [11,] 3358 3420 3410 3296 3141 3059 2697 2263 1684 1044 NA [12,] 3379 3472 3524 3462 3276 3141 2800 2366 1829 1250 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -10 31 72 -20 -62 -124 -21 11 82 104 NA [2,] -11 52 31 51 82 83 52 51 31 0 NA [3,] -20 41 10 31 52 72 72 42 31 10 NA [4,] 206 186 228 176 176 217 217 206 135 124 NA [5,] -10 -21 -42 10 51 83 42 31 82 83 NA [6,] -155 -155 -155 -186 -217 -228 -269 -330 -413 -403 NA [7,] -103 -227 -227 -268 -258 -165 -196 -155 -103 -145 NA [8,] 10 41 41 -21 0 0 -93 -155 -259 -238 NA [9,] 0 42 -31 62 -83 -62 -93 -104 -165 -155 NA [10,] 10 -11 52 -52 -62 -41 -52 -72 -52 -82 NA [11,] 21 52 114 166 135 82 103 103 145 206 NA [12,] 62 -41 -11 0 -52 -103 -62 -51 -83 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/1uz3m1471288667.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/2p8nd1471288667.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/3corm1471288667.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/4kwm91471288667.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,] 1746.0 1850 1850.0 1860.0 2594 2676.0 1664 1519 1281 1126.0 1044 1250.0 [2,] 2738.0 2749 2800.0 2842.0 3048 3079.0 2749 2594 2439 2335.0 2263 2366.0 [3,] 3327.5 3250 3301.5 3327.5 3539 3575.5 3384 3224 3224 3151.5 3100 3208.5 [4,] 3441.0 3472 3524.0 3544.0 3751 3730.0 3575 3338 3348 3348.0 3358 3462.0 [5,] 3513.0 3503 3544.0 3575.0 3772 3761.0 3575 3348 3389 3431.0 3420 3524.0 $n [1] 10 10 10 10 10 10 10 10 10 10 10 10 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 2976.253 2888.76 2939.761 2976.753 3187.753 3250.234 2971.297 2852.268 [2,] 3678.747 3611.24 3663.239 3678.247 3890.247 3900.766 3796.703 3595.732 [,9] [,10] [,11] [,12] [1,] 2769.827 2645.365 2552.894 2660.895 [2,] 3678.173 3657.635 3647.106 3756.105 $out [1] 1984 2067 $group [1] 5 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1746, 2738, 3327.5, 3441, 3513, 1850, 2749, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5dvvd1471288667.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,] -124.0 0 -20 124 -42.0 -413.0 -268.0 -259.0 -165.0 -82 21.0 -103 [2,] -21.0 31 10 176 -10.0 -330.0 -227.0 -155.0 -104.0 -62 82.0 -62 [3,] 0.5 51 36 196 36.5 -222.5 -180.5 -10.5 -72.5 -52 108.5 -51 [4,] 72.0 52 52 217 82.0 -155.0 -145.0 10.0 0.0 -11 145.0 -11 [5,] 104.0 83 72 228 83.0 -155.0 -103.0 41.0 62.0 52 206.0 62 $n [1] 10 10 10 10 10 10 10 10 10 10 10 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -45.96651 40.50756 15.01513 175.5148 -9.466868 -309.937 -221.4705 [2,] 46.96651 61.49244 56.98487 216.4852 82.466868 -135.063 -139.5295 [,8] [,9] [,10] [,11] [,12] [1,] -92.94058 -124.46255 -77.48163 77.02269 -77.86 [2,] 71.94058 -20.53745 -26.51837 139.97731 -24.14 $out [1] -11 $group [1] 2 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-124, -21, 0.5, 72, 104, 0, 31, 51, 52, 83, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/60kql1471288667.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,] 3338 3348.0 3348.0 3286.0 3141 3059.0 2697.0 2263.0 1684.0 1044.0 NA [2,] 3353 3425.5 3399.5 3327.5 3281 3120.5 2821.0 2402.5 1865.0 1265.5 NA [3,] 3410 3472.0 3513.5 3503.0 3431 3172.5 3027.5 2743.5 2289.0 1705.0 NA [4,] 3441 3570.0 3559.5 3575.0 3539 3291.0 3136.0 2821.0 2443.5 1855.0 NA [5,] 3441 3751.0 3772.0 3761.0 3761 3472.0 3400.0 3079.0 2676.0 2067.0 NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3369.863 3406.093 3440.523 3390.114 3313.324 3094.734 2883.826 2552.619 [2,] 3450.137 3537.907 3586.477 3615.886 3548.676 3250.266 3171.174 2934.381 [,9] [,10] [,11] [1,] 2025.142 1436.125 NA [2,] 2552.858 1973.875 NA $out [1] 3606 3596 3555 $group [1] 1 1 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(3338, 3353, 3410, 3441, 3441, 3348, 3425.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/76ktu1471288667.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,] 2737.20 3100.00 2857.000 [2,] 2841.10 3216.25 2947.000 [3,] 3038.05 3275.75 3132.938 [4,] 3100.95 3355.75 3217.500 [5,] 3335.50 3539.00 3444.625 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 2919.531 3212.123 3009.561 [2,] 3156.569 3339.377 3256.314 $out [1] 3575.5 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(2737.2, 2841.1, 3038.05, 3100.95, 3335.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1uz3m1471288667.ps tmp/1uz3m1471288667.png",intern=TRUE)) character(0) > try(system("convert tmp/2p8nd1471288667.ps tmp/2p8nd1471288667.png",intern=TRUE)) character(0) > try(system("convert tmp/3corm1471288667.ps tmp/3corm1471288667.png",intern=TRUE)) character(0) > try(system("convert tmp/4kwm91471288667.ps tmp/4kwm91471288667.png",intern=TRUE)) character(0) > try(system("convert tmp/5dvvd1471288667.ps tmp/5dvvd1471288667.png",intern=TRUE)) character(0) > try(system("convert tmp/60kql1471288667.ps tmp/60kql1471288667.png",intern=TRUE)) character(0) > try(system("convert tmp/76ktu1471288667.ps tmp/76ktu1471288667.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.629 0.259 2.955