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(105.28,107,106.29,108.07,105.41,104.4,102.77,102.44,103.43,102.95,103.52,105.2,105.88,104.88,106.59,107.8,106.31,106.53,106.25,105.87,107.83,108.01,107.9,108.55,108.83,109.39,108.65,108.33,109.76,110.07,109.23,108.4,108.9,109.14,109.27,109.38,109.66,109.87,109.98,111.24,110.03,111.43,110.28,109.53,111.97,111.89,112.93,113.11,112.95,114.08,115.27,114.73,114.97,113.78,113.7,113.91,114.22,115.32,113.5,115.35,113.23,113.65,114.82,113.54,113.97,113.79,113.27,114.35,113.68,115.3,113.69,115.31) > 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,] 105.28 105.88 108.83 109.66 112.95 113.23 NA [2,] 107.00 104.88 109.39 109.87 114.08 113.65 NA [3,] 106.29 106.59 108.65 109.98 115.27 114.82 NA [4,] 108.07 107.80 108.33 111.24 114.73 113.54 NA [5,] 105.41 106.31 109.76 110.03 114.97 113.97 NA [6,] 104.40 106.53 110.07 111.43 113.78 113.79 NA [7,] 102.77 106.25 109.23 110.28 113.70 113.27 NA [8,] 102.44 105.87 108.40 109.53 113.91 114.35 NA [9,] 103.43 107.83 108.90 111.97 114.22 113.68 NA [10,] 102.95 108.01 109.14 111.89 115.32 115.30 NA [11,] 103.52 107.90 109.27 112.93 113.50 113.69 NA [12,] 105.20 108.55 109.38 113.11 115.35 115.31 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.72 -1.00 0.56 0.21 1.13 0.42 NA [2,] -0.71 1.71 -0.74 0.11 1.19 1.17 NA [3,] 1.78 1.21 -0.32 1.26 -0.54 -1.28 NA [4,] -2.66 -1.49 1.43 -1.21 0.24 0.43 NA [5,] -1.01 0.22 0.31 1.40 -1.19 -0.18 NA [6,] -1.63 -0.28 -0.84 -1.15 -0.08 -0.52 NA [7,] -0.33 -0.38 -0.83 -0.75 0.21 1.08 NA [8,] 0.99 1.96 0.50 2.44 0.31 -0.67 NA [9,] -0.48 0.18 0.24 -0.08 1.10 1.62 NA [10,] 0.57 -0.11 0.13 1.04 -1.82 -1.61 NA [11,] 1.68 0.65 0.11 0.18 1.85 1.62 NA [12,] 0.68 0.28 0.28 -0.16 -2.12 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/19afv1363704515.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/2z08p1363704515.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/3afg21363704515.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/4m71w1363704515.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,] 105.280 104.88 106.290 107.800 105.410 104.40 102.770 102.440 103.430 [2,] 105.880 107.00 106.590 108.070 106.310 106.53 106.250 105.870 107.830 [3,] 109.245 109.63 109.315 109.785 109.895 110.75 109.755 108.965 110.435 [4,] 112.950 113.65 114.820 113.540 113.970 113.78 113.270 113.910 113.680 [5,] 113.230 114.08 115.270 114.730 114.970 113.79 113.700 114.350 114.220 [,10] [,11] [,12] [1,] 102.950 103.52 105.200 [2,] 108.010 107.90 108.550 [3,] 110.515 111.10 111.245 [4,] 115.300 113.50 115.310 [5,] 115.320 113.69 115.350 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 104.6846 105.3405 104.0064 106.2567 104.9541 106.0735 105.2269 103.7789 [2,] 113.8054 113.9195 114.6236 113.3133 114.8359 115.4265 114.2831 114.1511 [,9] [,10] [,11] [,12] [1,] 106.6616 105.8127 107.4878 106.8846 [2,] 114.2084 115.2173 114.7122 115.6054 $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(105.28, 105.88, 109.245, 112.95, 113.23, 104.88, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5a6uy1363704515.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,] -1.00 -0.74 -1.280 -2.660 -1.19 -1.63 -0.830 -0.670 -0.48 -1.82 0.110 [2,] 0.21 -0.71 -0.540 -1.490 -1.01 -1.15 -0.750 0.310 -0.08 -1.61 0.180 [3,] 0.49 0.64 0.445 -0.485 0.02 -0.68 -0.355 0.745 0.21 0.01 1.135 [4,] 1.13 1.19 1.260 0.430 0.31 -0.28 0.210 1.960 1.10 0.57 1.680 [5,] 1.72 1.71 1.780 1.430 1.40 -0.08 1.080 2.440 1.62 1.04 1.850 [,12] [1,] -0.16 [2,] -0.16 [3,] 0.28 [4,] 0.28 [5,] 0.68 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -0.1034297 -0.5855614 -0.7160581 -1.723462 -0.8314426 -1.2411781 -0.974231 [2,] 1.0834297 1.8655614 1.6060581 0.753462 0.8714426 -0.1188219 0.264231 [,8] [,9] [,10] [,11] [,12] [1,] -0.3193033 -0.5511381 -1.39617 0.1674516 -0.03090289 [2,] 1.8093033 0.9711381 1.41617 2.1025484 0.59090289 $out [1] -2.12 $group [1] 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-1, 0.210000000000008, 0.490000000000002, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6a0f91363704515.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,] 102.44 104.880 108.330 109.530 112.95 113.230 NA [2,] 103.19 106.065 108.740 109.925 113.74 113.595 NA [3,] 104.80 106.560 109.185 110.760 114.15 113.740 NA [4,] 105.85 107.865 109.385 111.930 115.12 114.585 NA [5,] 108.07 108.550 110.070 113.110 115.35 115.310 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 103.5868 105.739 108.8908 109.8455 113.5206 113.2885 NA [2,] 106.0132 107.381 109.4792 111.6745 114.7794 114.1915 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(102.44, 103.19, 104.8, 105.85, 108.07, 104.88, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7vpkr1363704515.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,] 109.0833 108.9650 109.3725 [2,] 109.5583 109.4725 109.9187 [3,] 110.0400 109.8400 110.3306 [4,] 110.3508 110.6325 110.7375 [5,] 111.1500 111.2450 111.7587 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 109.6785 109.3109 109.9572 [2,] 110.4015 110.3691 110.7041 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(109.083333333333, 109.558333333333, 110.04, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/19afv1363704515.ps tmp/19afv1363704515.png",intern=TRUE)) character(0) > try(system("convert tmp/2z08p1363704515.ps tmp/2z08p1363704515.png",intern=TRUE)) character(0) > try(system("convert tmp/3afg21363704515.ps tmp/3afg21363704515.png",intern=TRUE)) character(0) > try(system("convert tmp/4m71w1363704515.ps tmp/4m71w1363704515.png",intern=TRUE)) character(0) > try(system("convert tmp/5a6uy1363704515.ps tmp/5a6uy1363704515.png",intern=TRUE)) character(0) > try(system("convert tmp/6a0f91363704515.ps tmp/6a0f91363704515.png",intern=TRUE)) character(0) > try(system("convert tmp/7vpkr1363704515.ps tmp/7vpkr1363704515.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.071 0.593 4.655