R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(250.8,247.6,237.8,226.4,217.2,211.4,207.6,204.3,197.5,193.6,192.3,192,196.1,191.9,185.6,179.4,173.9,169.2,166.8,165.2,161.4,160.8,163.7,170.8,182.7,190.9,197.8,205.1,210.7,220.2,229.7,237.1,241.6,250.4,258.6,269.9,283.2,289.6,281.8,274.7,267.6,261.4,260.5,260.7,254.2,250.5,253.4,263.7,276.2,273.8,265.9,258.4,253.5,250.7,252.8,255.3,251.2,252.5,257.8,269.9,291.6,298.9,295.6,292.1,290.9,290.6,298,304,304.3,309.8,322.3,340.2,369.3,376.7,379.7,379.5,377.8,381.6,394.6,399.3,400.4,408.2,419.1,437.7) > 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,] 250.8 196.1 182.7 283.2 276.2 291.6 369.3 NA [2,] 247.6 191.9 190.9 289.6 273.8 298.9 376.7 NA [3,] 237.8 185.6 197.8 281.8 265.9 295.6 379.7 NA [4,] 226.4 179.4 205.1 274.7 258.4 292.1 379.5 NA [5,] 217.2 173.9 210.7 267.6 253.5 290.9 377.8 NA [6,] 211.4 169.2 220.2 261.4 250.7 290.6 381.6 NA [7,] 207.6 166.8 229.7 260.5 252.8 298.0 394.6 NA [8,] 204.3 165.2 237.1 260.7 255.3 304.0 399.3 NA [9,] 197.5 161.4 241.6 254.2 251.2 304.3 400.4 NA [10,] 193.6 160.8 250.4 250.5 252.5 309.8 408.2 NA [11,] 192.3 163.7 258.6 253.4 257.8 322.3 419.1 NA [12,] 192.0 170.8 269.9 263.7 269.9 340.2 437.7 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] -3.2 -4.2 8.2 6.4 -2.4 7.3 7.4 NA [2,] -9.8 -6.3 6.9 -7.8 -7.9 -3.3 3.0 NA [3,] -11.4 -6.2 7.3 -7.1 -7.5 -3.5 -0.2 NA [4,] -9.2 -5.5 5.6 -7.1 -4.9 -1.2 -1.7 NA [5,] -5.8 -4.7 9.5 -6.2 -2.8 -0.3 3.8 NA [6,] -3.8 -2.4 9.5 -0.9 2.1 7.4 13.0 NA [7,] -3.3 -1.6 7.4 0.2 2.5 6.0 4.7 NA [8,] -6.8 -3.8 4.5 -6.5 -4.1 0.3 1.1 NA [9,] -3.9 -0.6 8.8 -3.7 1.3 5.5 7.8 NA [10,] -1.3 2.9 8.2 2.9 5.3 12.5 10.9 NA [11,] -0.3 7.1 11.3 10.3 12.1 17.9 18.6 NA [12,] 4.1 11.9 13.3 12.5 21.7 29.1 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/1c4yt1413483672.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/26kwm1413483672.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/3k3w61413483672.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/4ywm71413483672.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,] 182.70 190.90 185.6 179.40 173.90 169.2 166.80 165.20 161.40 160.80 163.70 [2,] 223.45 219.75 217.8 215.75 213.95 215.8 218.65 220.70 219.55 222.00 222.85 [3,] 276.20 273.80 265.9 258.40 253.50 250.7 252.80 255.30 251.20 250.50 257.80 [4,] 287.40 294.25 288.7 283.40 279.25 276.0 279.25 282.35 279.25 281.15 290.45 [5,] 369.30 376.70 379.7 379.50 290.90 290.6 298.00 304.00 304.30 309.80 322.30 [,12] [1,] 170.80 [2,] 227.85 [3,] 269.90 [4,] 305.05 [5,] 340.20 $n [1] 7 7 7 7 7 7 7 7 7 7 7 7 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 238.0101 229.3098 223.5597 218.0005 214.5039 214.7495 216.6107 218.4836 [2,] 314.3899 318.2902 308.2403 298.7995 292.4961 286.6505 288.9893 292.1164 [,9] [,10] [,11] [,12] [1,] 215.5481 215.1766 217.4304 223.7974 [2,] 286.8519 285.8234 298.1696 316.0026 $out [1] 377.8 381.6 394.6 399.3 400.4 408.2 419.1 437.7 $group [1] 5 6 7 8 9 10 11 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(182.7, 223.45, 276.2, 287.4, 369.3, 190.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5qekl1413483672.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,] -4.20 -9.80 -11.40 -9.20 -6.20 -3.80 -3.30 -6.8 -3.90 -1.30 -0.3 4.1 [2,] -2.80 -7.85 -7.30 -6.30 -5.25 -1.65 -0.70 -5.3 -2.15 2.90 8.7 11.9 [3,] 6.40 -6.30 -6.20 -4.90 -2.80 2.10 2.50 -3.8 1.30 5.30 11.3 12.9 [4,] 7.35 -0.15 -1.85 -1.45 1.75 8.45 5.35 0.7 6.65 9.55 15.0 21.7 [5,] 8.20 6.90 -0.20 5.60 9.50 13.00 7.40 4.5 8.80 12.50 18.6 29.1 $n [1] 7 7 7 7 7 7 7 7 7 7 7 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.3385837 -10.898316 -9.454652 -7.796342 -6.980287 -3.931557 -1.112962 [2,] 12.4614163 -1.701684 -2.945348 -2.003658 1.380287 8.131557 6.112962 [,8] [,9] [,10] [,11] [,12] [1,] -7.3831032 -3.955218 1.328727 7.537742 6.578683 [2,] -0.2168968 6.555218 9.271273 15.062258 19.221317 $out [1] 7.3 $group [1] 3 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-4.19999999999999, -2.8, 6.40000000000003, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/68yc51413483672.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,] 192.00 160.80 182.70 250.50 250.70 290.60 369.30 NA [2,] 195.55 164.45 201.45 257.35 252.65 291.85 378.65 NA [3,] 209.50 170.00 224.95 262.55 256.55 298.45 388.10 NA [4,] 232.10 182.50 246.00 278.25 267.90 307.05 404.30 NA [5,] 250.80 196.10 269.90 289.60 276.20 322.30 437.70 NA $n [1] 12 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 192.8293 161.7673 204.6304 253.0174 249.5944 291.5172 376.4009 NA [2,] 226.1707 178.2327 245.2696 272.0826 263.5056 305.3828 399.7991 NA $out [1] 340.2 $group [1] 6 $names [1] "1" "2" "3" "4" "5" "6" "7" NA Warning message: In bxp(list(stats = c(192, 195.55, 209.5, 232.1, 250.8, 160.8, 164.45, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7htvr1413483672.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,] 255.0143 250.50 245.9000 [2,] 258.6143 252.00 249.1750 [3,] 260.8357 256.55 251.5500 [4,] 265.5071 267.90 256.0375 [5,] 267.0571 276.20 257.0000 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 257.6918 249.2979 248.42 [2,] 263.9796 263.8021 254.68 $out [1] 277.7429 266.4500 $group [1] 1 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(255.014285714286, 258.614285714286, 260.835714285714, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1c4yt1413483672.ps tmp/1c4yt1413483672.png",intern=TRUE)) character(0) > try(system("convert tmp/26kwm1413483672.ps tmp/26kwm1413483672.png",intern=TRUE)) character(0) > try(system("convert tmp/3k3w61413483672.ps tmp/3k3w61413483672.png",intern=TRUE)) character(0) > try(system("convert tmp/4ywm71413483672.ps tmp/4ywm71413483672.png",intern=TRUE)) character(0) > try(system("convert tmp/5qekl1413483672.ps tmp/5qekl1413483672.png",intern=TRUE)) character(0) > try(system("convert tmp/68yc51413483672.ps tmp/68yc51413483672.png",intern=TRUE)) character(0) > try(system("convert tmp/7htvr1413483672.ps tmp/7htvr1413483672.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.445 0.398 2.874