R version 2.15.3 (2013-03-01) -- "Security Blanket" Copyright (C) 2013 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(122.27,124.69,147.56,120.03,136.01,138.16,122.87,112.22,137.35,139.08,139.64,121.12,132.37,130.69,149.41,130.72,139.14,146.55,137.35,122.73,138.97,154.73,143.4,123.88,140.25,142.39,143.81,153.58,144.71,153.84,151.3,121.92,153.05,149.29,118.81,109.19,103.68,106.94,114.43,107.87,103.14,117.02,112.44,95.85,123.86,121.83,121.95,120.34,113.32,117.31,141.69,130.35,127.28,148.1,131.21,120.37,146.91,144.04,141.77,132.15,142.04,149.77,172.31,150.24,163.23,155.92,146.96,134.51,152.83,150.54,150.98,138.82) > 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] 72 > (np <- floor(n / par1)) [1] 6 > 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] 6 6 6 6 6 6 6 6 6 6 6 6 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 122.27 132.37 140.25 103.68 113.32 142.04 NA [2,] 124.69 130.69 142.39 106.94 117.31 149.77 NA [3,] 147.56 149.41 143.81 114.43 141.69 172.31 NA [4,] 120.03 130.72 153.58 107.87 130.35 150.24 NA [5,] 136.01 139.14 144.71 103.14 127.28 163.23 NA [6,] 138.16 146.55 153.84 117.02 148.10 155.92 NA [7,] 122.87 137.35 151.30 112.44 131.21 146.96 NA [8,] 112.22 122.73 121.92 95.85 120.37 134.51 NA [9,] 137.35 138.97 153.05 123.86 146.91 152.83 NA [10,] 139.08 154.73 149.29 121.83 144.04 150.54 NA [11,] 139.64 143.40 118.81 121.95 141.77 150.98 NA [12,] 121.12 123.88 109.19 120.34 132.15 138.82 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 2.42 -1.68 2.14 3.26 3.99 7.73 NA [2,] 22.87 18.72 1.42 7.49 24.38 22.54 NA [3,] -27.53 -18.69 9.77 -6.56 -11.34 -22.07 NA [4,] 15.98 8.42 -8.87 -4.73 -3.07 12.99 NA [5,] 2.15 7.41 9.13 13.88 20.82 -7.31 NA [6,] -15.29 -9.20 -2.54 -4.58 -16.89 -8.96 NA [7,] -10.65 -14.62 -29.38 -16.59 -10.84 -12.45 NA [8,] 25.13 16.24 31.13 28.01 26.54 18.32 NA [9,] 1.73 15.76 -3.76 -2.03 -2.87 -2.29 NA [10,] 0.56 -11.33 -30.48 0.12 -2.27 0.44 NA [11,] -18.52 -19.52 -9.62 -1.61 -9.62 -12.16 NA [12,] 11.25 16.37 -5.51 -7.02 9.89 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/1c1ut1362838562.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/2do1h1362838562.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/3574n1362838562.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/4z2p91362838562.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] [1,] 103.68 106.94 141.690 107.870 103.140 117.020 112.44 112.220 123.86 [2,] 113.32 117.31 141.690 120.030 127.280 138.160 122.87 112.220 137.35 [3,] 127.32 127.69 145.685 130.535 137.575 147.325 134.28 121.145 142.94 [4,] 140.25 142.39 149.410 150.240 144.710 153.840 146.96 122.730 152.83 [5,] 142.04 149.77 149.410 153.580 163.230 155.920 151.30 134.510 153.05 [,10] [,11] [,12] [1,] 139.080 118.810 109.19 [2,] 139.080 121.950 120.34 [3,] 146.665 140.705 122.50 [4,] 150.540 143.400 132.15 [5,] 154.730 150.980 138.82 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 109.9493 111.5126 140.7054 111.0486 126.3321 137.2109 118.7412 114.3657 [2,] 144.6907 143.8674 150.6646 150.0214 148.8179 157.4391 149.8188 127.9243 [,9] [,10] [,11] [,12] [1,] 132.9549 139.2729 126.8691 114.8822 [2,] 152.9251 154.0571 154.5409 130.1178 $out [1] 114.43 172.31 95.85 121.83 $group [1] 3 3 8 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(103.68, 113.32, 127.32, 140.25, 142.04, 106.94, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5t5ja1362838562.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,] 2.14 1.42 -27.530 -8.870 -7.31 -16.89 -16.590 16.240 -3.76 -11.330 -19.52 [2,] 2.14 7.49 -22.070 -4.730 2.15 -15.29 -16.590 18.320 -2.87 -11.330 -18.52 [3,] 2.84 20.63 -15.015 2.675 8.27 -9.08 -13.535 25.835 -2.16 -1.075 -10.89 [4,] 3.99 22.87 -6.560 12.990 13.88 -4.58 -10.840 28.010 1.73 0.440 -9.62 [5,] 3.99 24.38 9.770 15.980 20.82 -2.54 -10.650 31.130 1.73 0.560 -1.61 [,12] [1,] -7.02 [2,] -5.51 [3,] 9.89 [4,] 11.25 [5,] 16.37 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.64669 10.7094 -25.019451 -8.754972 0.7037711 -15.988296 -17.243936 [2,] 4.03331 30.5506 -5.010549 14.104972 15.8362289 -2.171704 -9.826064 [,8] [,9] [,10] [,11] [,12] [1,] 19.58464 -5.1271486 -8.66703 -16.630787 -1.952574 [2,] 32.08536 0.8071486 6.51703 -5.149213 21.732574 $out [1] -1.68 7.73 -29.38 15.76 -30.48 $group [1] 1 1 7 9 10 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(2.13999999999999, 2.13999999999999, 2.84, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/6sy661362838562.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] [1,] 112.220 122.730 109.190 95.850 113.320 134.510 NA [2,] 121.695 130.705 131.085 105.310 123.825 144.500 NA [3,] 130.350 138.160 144.260 113.435 131.680 150.390 NA [4,] 138.620 144.975 152.175 121.085 142.905 154.375 NA [5,] 147.560 154.730 153.840 123.860 148.100 163.230 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 122.6304 131.6514 134.6407 106.2399 122.9775 145.8859 NA [2,] 138.0696 144.6686 153.8793 120.6301 140.3825 154.8941 NA $out [1] 172.31 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(112.22, 121.695, 130.35, 138.62, 147.56, 122.73, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7dbgo1362838562.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,] 117.9333 121.1450 118.3925 [2,] 127.1433 127.5050 128.1144 [3,] 134.6367 135.9275 134.7194 [4,] 142.7067 144.3125 144.9131 [5,] 144.8683 147.3250 146.3313 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 127.5381 128.2615 127.0574 [2,] 141.7352 143.5935 142.3814 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(117.933333333333, 127.143333333333, 134.636666666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1c1ut1362838562.ps tmp/1c1ut1362838562.png",intern=TRUE)) character(0) > try(system("convert tmp/2do1h1362838562.ps tmp/2do1h1362838562.png",intern=TRUE)) character(0) > try(system("convert tmp/3574n1362838562.ps tmp/3574n1362838562.png",intern=TRUE)) character(0) > try(system("convert tmp/4z2p91362838562.ps tmp/4z2p91362838562.png",intern=TRUE)) character(0) > try(system("convert tmp/5t5ja1362838562.ps tmp/5t5ja1362838562.png",intern=TRUE)) character(0) > try(system("convert tmp/6sy661362838562.ps tmp/6sy661362838562.png",intern=TRUE)) character(0) > try(system("convert tmp/7dbgo1362838562.ps tmp/7dbgo1362838562.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.504 0.485 3.976