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(1850.07,1841.55,1845,1844.01,1842.67,1842.67,1842.67,1842.9,1840.37,1841.59,1844.33,1844.33,1844.33,1845.39,1861.84,1862.85,1869.46,1870.8,1870.8,1871.52,1875.52,1880.38,1885.05,1886.42,1886.42,1891.65,1903.11,1905.29,1904.26,1905.37,1905.37,1905.12,1908.62,1915.08,1916.36,1916.68,1916.24,1922.05,1922.63,1922.47,1920.64,1920.66,1920.66,1921.19,1921.44,1921.73,1921.81,1921.81,1921.81,1921.48,1917.07,1912.64,1901.15,1898.12,1900.02,1900.02,1900.82,1901.9,1902.19,1901.84,1903.73,1889.7,1891.27,1894.48,1894.27,1893.98,1893.98,1895.62,1901.72,1905.4,1898.14,1898.09) > 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,] 1850.07 1844.33 1886.42 1916.24 1921.81 1903.73 NA [2,] 1841.55 1845.39 1891.65 1922.05 1921.48 1889.70 NA [3,] 1845.00 1861.84 1903.11 1922.63 1917.07 1891.27 NA [4,] 1844.01 1862.85 1905.29 1922.47 1912.64 1894.48 NA [5,] 1842.67 1869.46 1904.26 1920.64 1901.15 1894.27 NA [6,] 1842.67 1870.80 1905.37 1920.66 1898.12 1893.98 NA [7,] 1842.67 1870.80 1905.37 1920.66 1900.02 1893.98 NA [8,] 1842.90 1871.52 1905.12 1921.19 1900.02 1895.62 NA [9,] 1840.37 1875.52 1908.62 1921.44 1900.82 1901.72 NA [10,] 1841.59 1880.38 1915.08 1921.73 1901.90 1905.40 NA [11,] 1844.33 1885.05 1916.36 1921.81 1902.19 1898.14 NA [12,] 1844.33 1886.42 1916.68 1921.81 1901.84 1898.09 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -8.52 1.06 5.23 5.81 -0.33 -14.03 NA [2,] 3.45 16.45 11.46 0.58 -4.41 1.57 NA [3,] -0.99 1.01 2.18 -0.16 -4.43 3.21 NA [4,] -1.34 6.61 -1.03 -1.83 -11.49 -0.21 NA [5,] 0.00 1.34 1.11 0.02 -3.03 -0.29 NA [6,] 0.00 0.00 0.00 0.00 1.90 0.00 NA [7,] 0.23 0.72 -0.25 0.53 0.00 1.64 NA [8,] -2.53 4.00 3.50 0.25 0.80 6.10 NA [9,] 1.22 4.86 6.46 0.29 1.08 3.68 NA [10,] 2.74 4.67 1.28 0.08 0.29 -7.26 NA [11,] 0.00 1.37 0.32 0.00 -0.35 -0.05 NA [12,] 0.00 0.00 -0.44 0.00 1.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/wessaorg/rcomp/tmp/171v71412949990.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/2a8xc1412949990.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/3tzng1412949990.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/422p01412949990.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,] 1844.330 1841.550 1845.00 1844.010 1842.67 1842.67 1842.67 1842.90 1840.37 [2,] 1850.070 1845.390 1861.84 1862.850 1869.46 1870.80 1870.80 1871.52 1875.52 [3,] 1895.075 1890.675 1897.19 1899.885 1897.71 1896.05 1897.00 1897.82 1901.27 [4,] 1916.240 1921.480 1917.07 1912.640 1904.26 1905.37 1905.37 1905.12 1908.62 [5,] 1921.810 1922.050 1922.63 1922.470 1920.64 1920.66 1920.66 1921.19 1921.44 [,10] [,11] [,12] [1,] 1841.59 1844.330 1844.330 [2,] 1880.38 1885.050 1886.420 [3,] 1903.65 1900.165 1899.965 [4,] 1915.08 1916.360 1916.680 [5,] 1921.73 1921.810 1921.810 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1852.393 1841.594 1861.565 1867.769 1875.263 1873.751 1874.701 1876.147 [2,] 1937.757 1939.756 1932.815 1932.001 1920.157 1918.349 1919.299 1919.493 [,9] [,10] [,11] [,12] [1,] 1879.919 1881.267 1879.969 1880.446 [2,] 1922.621 1926.033 1920.361 1919.484 $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(1844.33, 1850.07, 1895.075, 1916.24, 1921.81, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5wijb1412949990.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,] -14.030 -4.41 -4.430 -1.830 -0.29 0 -0.25 -2.53 0.29 0.080 -0.35 0 [2,] -8.520 0.58 -0.990 -1.830 -0.29 0 0.00 0.25 1.08 0.080 -0.05 0 [3,] 0.365 2.51 0.425 -1.185 0.01 0 0.38 2.15 2.45 0.785 0.00 0 [4,] 5.230 11.46 2.180 -0.210 1.11 0 0.72 4.00 4.86 2.740 0.32 0 [5,] 5.810 16.45 3.210 -0.210 1.34 0 1.64 6.10 6.46 4.670 0.32 0 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] -8.504194 -4.507951 -1.619752 -2.2299523 -0.8930452 0 -0.08442326 [2,] 9.234194 9.527951 2.469752 -0.1400477 0.9130452 0 0.84442326 [,8] [,9] [,10] [,11] [,12] [1,] -0.2688711 0.01177791 -0.9307859 -0.238662 0 [2,] 4.5688711 4.88822209 2.5007859 0.238662 0 $out [1] 6.61 -11.49 -3.03 1.90 -7.26 1.37 -0.44 1.89 $group [1] 4 4 5 6 10 11 12 12 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(-14.03, -8.51999999999998, 0.365000000000123, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6nbdf1412949990.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,] 1840.370 1844.330 1891.650 1920.640 1898.120 1889.70 NA [2,] 1842.130 1862.345 1903.685 1920.660 1900.420 1893.98 NA [3,] 1842.785 1870.800 1905.330 1921.585 1901.870 1895.05 NA [4,] 1844.330 1877.950 1911.850 1921.930 1914.855 1899.93 NA [5,] 1845.000 1886.420 1916.680 1922.630 1921.810 1905.40 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1841.782 1863.682 1901.606 1921.006 1895.286 1892.336 NA [2,] 1843.788 1877.918 1909.054 1922.164 1908.454 1897.764 NA $out [1] 1850.07 1886.42 1916.24 $group [1] 1 3 4 $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1840.37, 1842.13, 1842.785, 1844.33, 1845, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7yr401412949990.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,] 1885.303 1895.075 1885.245 [2,] 1888.671 1896.525 1889.824 [3,] 1889.774 1897.765 1890.737 [4,] 1892.881 1900.065 1896.790 [5,] 1894.862 1903.650 1901.154 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1887.854 1896.15 1887.560 [2,] 1891.694 1899.38 1893.915 $out [1] 1890.675 $group [1] 2 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1885.30333333333, 1888.67083333333, 1889.77416666667, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/171v71412949990.ps tmp/171v71412949990.png",intern=TRUE)) character(0) > try(system("convert tmp/2a8xc1412949990.ps tmp/2a8xc1412949990.png",intern=TRUE)) character(0) > try(system("convert tmp/3tzng1412949990.ps tmp/3tzng1412949990.png",intern=TRUE)) character(0) > try(system("convert tmp/422p01412949990.ps tmp/422p01412949990.png",intern=TRUE)) character(0) > try(system("convert tmp/5wijb1412949990.ps tmp/5wijb1412949990.png",intern=TRUE)) character(0) > try(system("convert tmp/6nbdf1412949990.ps tmp/6nbdf1412949990.png",intern=TRUE)) character(0) > try(system("convert tmp/7yr401412949990.ps tmp/7yr401412949990.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.502 0.332 2.872