R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(19064,18993,18921,18772,20246,20168,19064,18330,18401,18401,18480,18622,18843,18843,18701,18330,20246,20538,20097,19064,19506,18843,19142,19285,19434,19064,19142,18622,20246,20759,20318,19506,20389,19434,20318,20246,20467,19655,20538,20467,21792,21493,20318,19726,20538,19434,20246,20389,20688,20026,20389,20610,21422,20759,19876,18921,19805,17375,18551,19213,19876,18921,18921,18921,19434,18701,17739,16934,17518,15238,16635,17447,17596,16784,16855,16635,17375,16855,15830,15089,16342,13621,15388,16193,16193,15238,14355,14284,15089,14355,12959,11997,13030,10601,12809,13984,14355,13543,12517,13251,13543,13322,11113,10088,10821,8613,10893,11705,12367,11263,10230,10821,11113,10529,8321,7359,8242,5813,8463,10088) > 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] 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,] 19064 18843 19434 20467 20688 19876 17596 16193 14355 12367 NA [2,] 18993 18843 19064 19655 20026 18921 16784 15238 13543 11263 NA [3,] 18921 18701 19142 20538 20389 18921 16855 14355 12517 10230 NA [4,] 18772 18330 18622 20467 20610 18921 16635 14284 13251 10821 NA [5,] 20246 20246 20246 21792 21422 19434 17375 15089 13543 11113 NA [6,] 20168 20538 20759 21493 20759 18701 16855 14355 13322 10529 NA [7,] 19064 20097 20318 20318 19876 17739 15830 12959 11113 8321 NA [8,] 18330 19064 19506 19726 18921 16934 15089 11997 10088 7359 NA [9,] 18401 19506 20389 20538 19805 17518 16342 13030 10821 8242 NA [10,] 18401 18843 19434 19434 17375 15238 13621 10601 8613 5813 NA [11,] 18480 19142 20318 20246 18551 16635 15388 12809 10893 8463 NA [12,] 18622 19285 20246 20389 19213 17447 16193 13984 11705 10088 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -71 0 -370 -812 -662 -955 -812 -955 -812 -1104 NA [2,] -72 -142 78 883 363 0 71 -883 -1026 -1033 NA [3,] -149 -371 -520 -71 221 0 -220 -71 734 591 NA [4,] 1474 1916 1624 1325 812 513 740 805 292 292 NA [5,] -78 292 513 -299 -663 -733 -520 -734 -221 -584 NA [6,] -1104 -441 -441 -1175 -883 -962 -1025 -1396 -2209 -2208 NA [7,] -734 -1033 -812 -592 -955 -805 -741 -962 -1025 -962 NA [8,] 71 442 883 812 884 584 1253 1033 733 883 NA [9,] 0 -663 -955 -1104 -2430 -2280 -2721 -2429 -2208 -2429 NA [10,] 79 299 884 812 1176 1397 1767 2208 2280 2650 NA [11,] 142 143 -72 143 662 812 805 1175 812 1625 NA [12,] 221 149 221 299 663 149 0 371 662 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/www/rcomp/tmp/13hix1344866211.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/www/rcomp/tmp/2870z1344866211.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/www/rcomp/tmp/3h6cq1344866211.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/www/rcomp/tmp/4lupt1344866211.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,] 12367.0 11263 10230 10821 11113 10529.0 8321.0 7359 8242.0 5813.0 [2,] 16193.0 15238 14355 14284 15089 14355.0 12959.0 11997 13030.0 10601.0 [3,] 18953.5 18882 18811 18476 19840 19434.5 18401.5 17632 17959.5 16306.5 [4,] 19876.0 19064 19142 18921 20246 20759.0 20097.0 19064 19805.0 18843.0 [5,] 20688.0 20026 20538 20610 21792 21493.0 20318.0 19726 20538.0 19434.0 [,11] [,12] [1,] 8463.0 10088.0 [2,] 12809.0 13984.0 [3,] 17557.5 18034.5 [4,] 19142.0 19285.0 [5,] 20318.0 20389.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,] 17113.33 16970.38 16419.22 16159.17 17263.36 16234.81 14835.07 14101.05 [2,] 20793.67 20793.62 21202.78 20792.83 22416.64 22634.19 21967.93 21162.95 [,9] [,10] [,11] [,12] [1,] 14574.44 12188.47 14393.28 15385.91 [2,] 21344.56 20424.53 20721.72 20683.09 $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(12367, 16193, 18953.5, 19876, 20688, 11263, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/50ra01344866211.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,] -1104 -1033 -520 292.0 -734.0 -1396.0 -1033.0 442.0 -2721 79.0 -72.0 [2,] -955 -883 -220 513.0 -663.0 -1396.0 -962.0 584.0 -2429 812.0 143.0 [3,] -812 -36 -71 808.5 -409.5 -1064.5 -883.5 847.5 -2244 1286.5 733.5 [4,] -370 78 221 1474.0 -78.0 -883.0 -741.0 884.0 -955 2208.0 812.0 [5,] 0 883 734 1916.0 513.0 -441.0 -592.0 1253.0 0 2650.0 1625.0 [,12] [1,] 0 [2,] 149 [3,] 221 [4,] 371 [5,] 663 $n [1] 10 10 10 10 10 10 10 10 10 10 10 9 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -1104.2893 -516.1539 -291.3412 328.3461 -701.7893 -1320.8153 -993.9204 [2,] -519.7107 444.1539 149.3412 1288.6539 -117.2107 -808.1847 -773.0796 [,8] [,9] [,10] [,11] [,12] [1,] 697.608 -2980.469 589.0027 399.2409 104.08 [2,] 997.392 -1507.531 1983.9973 1067.7591 337.92 $out [1] -2209 -2208 71 $group [1] 6 6 8 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-1104, -955, -812, -370, 0, -1033, -883, -36, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/6pn681344866211.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] [1,] 18330.0 18330.0 18622 19434 17375 15238.0 15089.0 10601 8613.0 5813.0 [2,] 18440.5 18843.0 19288 19986 19067 17190.5 15609.0 12884 10857.0 8281.5 [3,] 18846.5 19103.0 19876 20428 19951 18220.0 16488.5 14134 12111.0 10159.0 [4,] 19064.0 19801.5 20318 20538 20649 18921.0 16855.0 14722 13432.5 10967.0 [5,] 19064.0 20538.0 20759 20538 21422 19876.0 17596.0 16193 14355.0 12367.0 [,11] [1,] NA [2,] NA [3,] NA [4,] NA [5,] NA $n [1] 12 12 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 18562.12 18665.82 19406.21 20176.23 19229.44 17430.71 15920.19 13295.68 [2,] 19130.88 19540.18 20345.79 20679.77 20672.56 19009.29 17056.81 14972.32 [,9] [,10] [,11] [1,] 10936.30 8934.125 NA [2,] 13285.70 11383.875 NA $out [1] 20246 20168 21792 21493 13621 $group [1] 1 1 4 4 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" NA Warning message: In bxp(list(stats = c(18330, 18440.5, 18846.5, 19064, 19064, 18330, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/73dmu1344866211.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,] 14737.30 16306.50 15044.25 [2,] 16275.85 17795.75 16509.06 [3,] 16887.05 18438.75 16889.69 [4,] 17490.45 18917.75 17588.62 [5,] 18050.60 19840.00 18154.62 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 16333.06 17927.0 16397.29 [2,] 17441.04 18950.5 17382.08 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(14737.3, 16275.85, 16887.05, 17490.45, 18050.6, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/13hix1344866211.ps tmp/13hix1344866211.png",intern=TRUE)) character(0) > try(system("convert tmp/2870z1344866211.ps tmp/2870z1344866211.png",intern=TRUE)) character(0) > try(system("convert tmp/3h6cq1344866211.ps tmp/3h6cq1344866211.png",intern=TRUE)) character(0) > try(system("convert tmp/4lupt1344866211.ps tmp/4lupt1344866211.png",intern=TRUE)) character(0) > try(system("convert tmp/50ra01344866211.ps tmp/50ra01344866211.png",intern=TRUE)) character(0) > try(system("convert tmp/6pn681344866211.ps tmp/6pn681344866211.png",intern=TRUE)) character(0) > try(system("convert tmp/73dmu1344866211.ps tmp/73dmu1344866211.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.580 0.880 2.419