R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 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(132,133.7,127,128.7,127.3,136.7,133.8,137.2,147.4,137.6,123.6,117.4,113.7,106.8,103.3,96.3,96.2,94.7,94.6,95.7,106.7,100.2,94.2,97.6,94.3,98,93.6,86.3,90.7,81.8,87.6,73.8,63.3,59.1,52.9,54.6,52.4,67.5,90.4,126,144.3,167.8,166.2,156,137,129.3,118,114.7,112.8,115.7,103.9,96.9,88.8,93,86.3,82.3,82.4,76.6,72.7,67.5,77.3,73.7,73,78.2,90.7,91.5,86.3,86.8,86.1,77.1,75.7,78.7,71.5,69.6,73.6,78.1,78.3,71.5,68.7,61.2,64.7,64.6,56.3,54.5,49.5,54,59.2,52.4,52.8,47.8,45.2,47.1,42.6,42.1,39.4,39.6) > 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] 96 > (np <- floor(n / par1)) [1] 8 > 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] 8 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 132.0 113.7 94.3 52.4 112.8 77.3 71.5 49.5 NA [2,] 133.7 106.8 98.0 67.5 115.7 73.7 69.6 54.0 NA [3,] 127.0 103.3 93.6 90.4 103.9 73.0 73.6 59.2 NA [4,] 128.7 96.3 86.3 126.0 96.9 78.2 78.1 52.4 NA [5,] 127.3 96.2 90.7 144.3 88.8 90.7 78.3 52.8 NA [6,] 136.7 94.7 81.8 167.8 93.0 91.5 71.5 47.8 NA [7,] 133.8 94.6 87.6 166.2 86.3 86.3 68.7 45.2 NA [8,] 137.2 95.7 73.8 156.0 82.3 86.8 61.2 47.1 NA [9,] 147.4 106.7 63.3 137.0 82.4 86.1 64.7 42.6 NA [10,] 137.6 100.2 59.1 129.3 76.6 77.1 64.6 42.1 NA [11,] 123.6 94.2 52.9 118.0 72.7 75.7 56.3 39.4 NA [12,] 117.4 97.6 54.6 114.7 67.5 78.7 54.5 39.6 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1.7 -6.9 3.7 15.1 2.9 -3.6 -1.9 4.5 NA [2,] -6.7 -3.5 -4.4 22.9 -11.8 -0.7 4.0 5.2 NA [3,] 1.7 -7.0 -7.3 35.6 -7.0 5.2 4.5 -6.8 NA [4,] -1.4 -0.1 4.4 18.3 -8.1 12.5 0.2 0.4 NA [5,] 9.4 -1.5 -8.9 23.5 4.2 0.8 -6.8 -5.0 NA [6,] -2.9 -0.1 5.8 -1.6 -6.7 -5.2 -2.8 -2.6 NA [7,] 3.4 1.1 -13.8 -10.2 -4.0 0.5 -7.5 1.9 NA [8,] 10.2 11.0 -10.5 -19.0 0.1 -0.7 3.5 -4.5 NA [9,] -9.8 -6.5 -4.2 -7.7 -5.8 -9.0 -0.1 -0.5 NA [10,] -14.0 -6.0 -6.2 -11.3 -3.9 -1.4 -8.3 -2.7 NA [11,] -6.2 3.4 1.7 -3.3 -5.2 3.0 -1.8 0.2 NA [12,] -3.7 -3.3 -2.2 -1.9 9.8 -7.2 -5.0 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/1z1jg1358253873.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/2wa3d1358253873.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/37atr1358253873.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/4jwdl1358253873.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,] 49.50 54.00 59.2 52.40 52.80 47.80 45.20 47.10 42.60 42.10 39.4 [2,] 61.95 68.55 73.3 78.15 83.55 76.65 77.50 67.50 64.00 61.85 54.6 [3,] 85.80 85.85 92.0 91.30 90.70 92.25 86.95 84.55 84.25 76.85 74.2 [4,] 113.25 111.25 103.6 111.45 111.75 115.70 114.20 116.45 121.85 114.75 106.1 [5,] 132.00 133.70 127.0 128.70 144.30 167.80 166.20 156.00 147.40 137.60 123.6 [,12] [1,] 39.60 [2,] 54.55 [3,] 73.10 [4,] 106.15 [5,] 117.40 $n [1] 8 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 57.14308 61.99717 75.07398 72.69814 74.94708 70.43611 66.44885 [2,] 114.45692 109.70283 108.92602 109.90186 106.45292 114.06389 107.45115 [,8] [,9] [,10] [,11] [,12] [1,] 57.20583 51.93416 47.2993 45.43136 44.2755 [2,] 111.89417 116.56584 106.4007 102.96864 101.9245 $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(49.5, 61.95, 85.8, 113.25, 132, 54, 68.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5ocgh1358253873.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,] -6.90 -11.80 -7.30 -8.10 -8.90 -6.70 -13.80 -19.00 -9.80 -14.0 -6.20 -7.20 [2,] -2.75 -5.55 -7.00 -0.75 -5.90 -4.05 -8.85 -7.50 -8.35 -9.8 -4.25 -4.35 [3,] 2.30 -2.10 -2.55 0.30 -0.35 -2.70 -1.75 -0.30 -6.15 -6.1 -0.80 -3.30 [4,] 4.10 4.60 4.85 8.45 6.80 -0.85 1.50 6.85 -2.35 -3.3 2.35 -2.05 [5,] 4.50 5.20 5.20 18.30 23.50 -0.10 3.40 11.00 -0.10 -1.4 3.40 -1.90 $n [1] 8 8 8 8 8 8 8 8 8 8 8 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -1.526508 -7.769936 -9.16958 -4.839252 -7.444402 -4.4875659 -7.531659 [2,] 6.126508 3.569936 4.06958 5.439252 6.744402 -0.9124341 4.031659 [,8] [,9] [,10] [,11] [,12] [1,] -8.316116 -9.501686 -9.730993 -4.486855 -4.673523 [2,] 7.716116 -2.798314 -2.469007 2.886855 -1.926477 $out [1] 15.1 22.9 35.6 5.8 9.8 $group [1] 1 2 3 6 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-6.90000000000001, -2.75, 2.3, 4.1, 4.5, -11.8, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/63xq31358253873.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] [1,] 117.40 94.20 52.90 52.40 67.50 73.00 54.50 39.40 NA [2,] 127.15 95.20 61.20 102.55 79.45 76.40 62.90 42.35 NA [3,] 132.85 96.95 84.05 127.65 87.55 78.45 69.15 47.45 NA [4,] 136.95 105.00 92.15 150.15 100.40 86.55 72.55 52.60 NA [5,] 147.40 113.70 98.00 167.80 115.70 91.50 78.30 59.20 NA $n [1] 12 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 128.3802 92.48015 69.9335 105.9393 77.99456 73.82052 64.74857 42.77491 [2,] 137.3198 101.41985 98.1665 149.3607 97.10544 83.07948 73.55143 52.12509 [,9] [1,] NA [2,] NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(117.4, 127.15, 132.85, 136.95, 147.4, 94.2, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/70evq1358253873.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,] 78.07500 73.100 85.35000 [2,] 86.88125 80.550 86.85625 [3,] 90.88750 85.825 89.18125 [4,] 94.47500 91.000 91.69375 [5,] 98.10000 92.250 95.07500 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 87.42394 81.05868 86.97483 [2,] 94.35106 90.59132 91.38767 $out [1] 77.800 78.225 $group [1] 3 3 $names [1] "mean" "median" "midrange" > dev.off() null device 1 > > try(system("convert tmp/1z1jg1358253873.ps tmp/1z1jg1358253873.png",intern=TRUE)) character(0) > try(system("convert tmp/2wa3d1358253873.ps tmp/2wa3d1358253873.png",intern=TRUE)) character(0) > try(system("convert tmp/37atr1358253873.ps tmp/37atr1358253873.png",intern=TRUE)) character(0) > try(system("convert tmp/4jwdl1358253873.ps tmp/4jwdl1358253873.png",intern=TRUE)) character(0) > try(system("convert tmp/5ocgh1358253873.ps tmp/5ocgh1358253873.png",intern=TRUE)) character(0) > try(system("convert tmp/63xq31358253873.ps tmp/63xq31358253873.png",intern=TRUE)) character(0) > try(system("convert tmp/70evq1358253873.ps tmp/70evq1358253873.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.664 1.037 4.698