R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(4309,4303,4177,4117,4065,3983,4091,4067,4024,3868,3800,3804,3862,3792,3674,3560,3489,3412,3674,3672,3463,3429,3400,3533,3578,3544,3435,3352,3213,3235,3460,3385,3283,3295,3331,3520,3668,3714,3691,3604,3581,3675,3833,3810,3663,3704,3810,4053,4152,4139,4055,3928,3821,3811,3999,3954,3724,3731,3697,3818,3897,3888,3754,3647,3564,3498,3704,3678,3599,3507,3484,2612,2926,2918,2833,2791,2762,2728,2831,2839,2775,2540,2625,2669) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] 7 7 7 7 7 7 7 7 7 7 7 7 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 4309 3862 3578 3668 4152 3897 2926 NA [2,] 4303 3792 3544 3714 4139 3888 2918 NA [3,] 4177 3674 3435 3691 4055 3754 2833 NA [4,] 4117 3560 3352 3604 3928 3647 2791 NA [5,] 4065 3489 3213 3581 3821 3564 2762 NA [6,] 3983 3412 3235 3675 3811 3498 2728 NA [7,] 4091 3674 3460 3833 3999 3704 2831 NA [8,] 4067 3672 3385 3810 3954 3678 2839 NA [9,] 4024 3463 3283 3663 3724 3599 2775 NA [10,] 3868 3429 3295 3704 3731 3507 2540 NA [11,] 3800 3400 3331 3810 3697 3484 2625 NA [12,] 3804 3533 3520 4053 3818 2612 2669 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -6 -70 -34 46 -13 -9 -8 NA [2,] -126 -118 -109 -23 -84 -134 -85 NA [3,] -60 -114 -83 -87 -127 -107 -42 NA [4,] -52 -71 -139 -23 -107 -83 -29 NA [5,] -82 -77 22 94 -10 -66 -34 NA [6,] 108 262 225 158 188 206 103 NA [7,] -24 -2 -75 -23 -45 -26 8 NA [8,] -43 -209 -102 -147 -230 -79 -64 NA [9,] -156 -34 12 41 7 -92 -235 NA [10,] -68 -29 36 106 -34 -23 85 NA [11,] 4 133 189 243 121 -872 44 NA [12,] 58 45 148 99 79 314 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/fisher/rcomp/tmp/1aqak1382195649.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/fisher/rcomp/tmp/27cx71382195649.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/fisher/rcomp/tmp/3zo3w1382195649.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/fisher/rcomp/tmp/4xe5r1382195649.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,] 3578.0 3544.0 3435.0 3352.0 3213 2728.0 3460 3385.0 3283.0 3295.0 3331.0 [2,] 3623.0 3629.0 3554.5 3456.0 3351 3323.5 3567 3528.5 3373.0 3362.0 3365.5 [3,] 3862.0 3792.0 3691.0 3604.0 3564 3498.0 3704 3678.0 3599.0 3507.0 3484.0 [4,] 4024.5 4013.5 3904.5 3787.5 3701 3743.0 3916 3882.0 3693.5 3717.5 3748.5 [5,] 4309.0 4303.0 4177.0 4117.0 4065 3983.0 4091 4067.0 4024.0 3868.0 3810.0 [,12] [1,] 2612.0 [2,] 3094.5 [3,] 3533.0 [4,] 3811.0 [5,] 4053.0 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3622.231 3562.383 3481.986 3406.034 3354.986 3247.481 3495.583 3466.896 [2,] 4101.769 4021.617 3900.014 3801.966 3773.014 3748.519 3912.417 3889.104 [,9] [,10] [,11] [,12] [1,] 3407.603 3294.701 3255.279 3105.118 [2,] 3790.397 3719.299 3712.721 3960.882 $out [1] 2926 2918 2833 2791 2762 2831 2839 2775 2540 2625 $group [1] 1 2 3 4 5 7 8 9 10 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(3578, 3623, 3862, 4024.5, 4309, 3544, 3629, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5ywa81382195649.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,] -34.0 -134.0 -127.0 -139.0 -82.0 103.0 -45.0 -230.0 -235.0 -68.0 4 [2,] -23.5 -122.0 -110.5 -95.0 -71.5 133.0 -35.5 -178.0 -124.0 -31.5 24 [3,] -9.0 -109.0 -87.0 -71.0 -34.0 188.0 -24.0 -102.0 -34.0 -23.0 121 [4,] -7.0 -84.5 -71.5 -40.5 6.0 215.5 -12.5 -71.5 9.5 60.5 161 [5,] -6.0 -84.0 -42.0 -23.0 94.0 262.0 8.0 -43.0 41.0 106.0 243 [,12] [1,] 45 [2,] 58 [3,] 89 [4,] 148 [5,] 148 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -18.8535338 -131.3944 -110.29017 -103.54652 -80.28175 138.7323 -37.73523 [2,] 0.8535338 -86.6056 -63.70983 -38.45348 12.28175 237.2677 -10.26477 [,8] [,9] [,10] [,11] [,12] [1,] -165.60008 -113.72405 -77.94092 39.18581 30.94709 [2,] -38.39992 45.72405 31.94092 202.81419 147.05291 $out [1] -70 46 -23 -75 -872 314 $group [1] 1 1 2 7 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-34, -23.5, -9, -7, -6, -134, -122, -109, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/623u71382195649.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] [1,] 3800.0 3400.0 3213.0 3581.0 3697.0 3484.0 2540.0 NA [2,] 3925.5 3446.0 3289.0 3665.5 3771.0 3502.5 2698.5 NA [3,] 4066.0 3546.5 3368.5 3697.5 3874.5 3623.0 2783.0 NA [4,] 4147.0 3674.0 3490.0 3810.0 4027.0 3729.0 2836.0 NA [5,] 4309.0 3862.0 3578.0 3833.0 4152.0 3897.0 2926.0 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 3964.972 3442.508 3276.823 3631.593 3757.737 3519.692 2720.285 NA [2,] 4167.028 3650.492 3460.177 3763.407 3991.263 3726.308 2845.715 NA $out [1] 4053 2612 $group [1] 4 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(3800, 3925.5, 4066, 4147, 4309, 3400, 3446, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7lmba1382195649.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,] 3429.857 3484.0 3452.750 [2,] 3463.500 3520.0 3533.250 [3,] 3537.857 3601.5 3589.375 [4,] 3657.929 3697.5 3735.500 [5,] 3770.286 3862.0 3823.750 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 3449.177 3520.541 3497.127 [2,] 3626.537 3682.459 3681.623 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(3429.85714285714, 3463.5, 3537.85714285714, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1aqak1382195649.ps tmp/1aqak1382195649.png",intern=TRUE)) character(0) > try(system("convert tmp/27cx71382195649.ps tmp/27cx71382195649.png",intern=TRUE)) character(0) > try(system("convert tmp/3zo3w1382195649.ps tmp/3zo3w1382195649.png",intern=TRUE)) character(0) > try(system("convert tmp/4xe5r1382195649.ps tmp/4xe5r1382195649.png",intern=TRUE)) character(0) > try(system("convert tmp/5ywa81382195649.ps tmp/5ywa81382195649.png",intern=TRUE)) character(0) > try(system("convert tmp/623u71382195649.ps tmp/623u71382195649.png",intern=TRUE)) character(0) > try(system("convert tmp/7lmba1382195649.ps tmp/7lmba1382195649.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.011 0.521 3.529