R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 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(1859000,1869000,1858000,1859000,1878000,1876000,1869000,1888000,1874000,1872000,1885000,1878000,1868000,1879000,1873000,1863000,1880000,1886000,1880000,1901000,1900000,1901000,1922000,1917000,1918000,1927000,1926000,1926000,1945000,1940000,1934000,1945000,1940000,1935000,1945000,1937000,1932000,1947000,1943000,1941000,1951000,1951000,1944000,1962000,1968000,1969000,1972000,1954000,1959000,1971000,1963000,1964000,1986000,1972000,1975000,1993000,1983000,1997000,2000000,1995000,1991000,2001000,1993000,1995000,2010000,2005000,2008000,2028000,2015000,2023000,2031000,2027000) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Mon, 30 Nov 2015 07:01:18 +0000) > #Author: root > #To cite this work: Wessa P., (2015), Mean Plot (v1.0.5) 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) > x <- na.omit(x) > (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,] 1859000 1868000 1918000 1932000 1959000 1991000 NA [2,] 1869000 1879000 1927000 1947000 1971000 2001000 NA [3,] 1858000 1873000 1926000 1943000 1963000 1993000 NA [4,] 1859000 1863000 1926000 1941000 1964000 1995000 NA [5,] 1878000 1880000 1945000 1951000 1986000 2010000 NA [6,] 1876000 1886000 1940000 1951000 1972000 2005000 NA [7,] 1869000 1880000 1934000 1944000 1975000 2008000 NA [8,] 1888000 1901000 1945000 1962000 1993000 2028000 NA [9,] 1874000 1900000 1940000 1968000 1983000 2015000 NA [10,] 1872000 1901000 1935000 1969000 1997000 2023000 NA [11,] 1885000 1922000 1945000 1972000 2000000 2031000 NA [12,] 1878000 1917000 1937000 1954000 1995000 2027000 NA > darr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 10000 11000 9000 15000 12000 10000 NA [2,] -11000 -6000 -1000 -4000 -8000 -8000 NA [3,] 1000 -10000 0 -2000 1000 2000 NA [4,] 19000 17000 19000 10000 22000 15000 NA [5,] -2000 6000 -5000 0 -14000 -5000 NA [6,] -7000 -6000 -6000 -7000 3000 3000 NA [7,] 19000 21000 11000 18000 18000 20000 NA [8,] -14000 -1000 -5000 6000 -10000 -13000 NA [9,] -2000 1000 -5000 1000 14000 8000 NA [10,] 13000 21000 10000 3000 3000 8000 NA [11,] -7000 -5000 -8000 -18000 -5000 -4000 NA [12,] -10000 1000 -5000 5000 -4000 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/1iq0h1476131512.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/2j4v51476131512.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/3fw4x1476131512.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/4dhap1476131512.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,] 1859000 1869000 1858000 1859000 1878000 1876000 1869000 1888000 1874000 [2,] 1868000 1879000 1873000 1863000 1880000 1886000 1880000 1901000 1900000 [3,] 1925000 1937000 1934500 1933500 1948000 1945500 1939000 1953500 1954000 [4,] 1959000 1971000 1963000 1964000 1986000 1972000 1975000 1993000 1983000 [5,] 1991000 2001000 1993000 1995000 2010000 2005000 2008000 2028000 2015000 [,10] [,11] [,12] [1,] 1872000 1885000 1878000 [2,] 1901000 1922000 1917000 [3,] 1952000 1958500 1945500 [4,] 1997000 2000000 1995000 [5,] 2023000 2031000 2027000 $n [1] 6 6 6 6 6 6 6 6 6 6 6 6 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1866302 1877657 1876447 1868352 1879627 1890027 1877722 1894157 1900462 [2,] 1983698 1996343 1992553 1998648 2016373 2000973 2000278 2012843 2007538 [,10] [,11] [,12] [1,] 1890077 1908187 1895187 [2,] 2013923 2008813 1995813 $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(1859000, 1868000, 1925000, 1959000, 1991000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5z9xk1476131512.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,] 9000 -11000 -2000 10000 -5000 -7000 18000 -14000 -5000 3000 -8000 -10000 [2,] 10000 -8000 -2000 15000 -5000 -7000 18000 -13000 -2000 3000 -8000 -5000 [3,] 10500 -7000 500 18000 -3500 -6000 18500 -7500 1000 9000 -6000 -4000 [4,] 12000 -4000 1000 19000 0 3000 20000 -1000 8000 13000 -5000 1000 [5,] 15000 -1000 2000 22000 6000 3000 21000 6000 14000 21000 -4000 5000 $n [1] 6 6 6 6 6 6 6 6 6 6 6 5 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 9209.935 -9580.129 -1435.097 15419.87 -6725.1615 -12450.323 17209.94 [2,] 11790.065 -4419.871 2435.097 20580.13 -274.8385 450.323 19790.06 [,8] [,9] [,10] [,11] [,12] [1,] -15240.3876 -5450.323 2549.677 -7935.097 -8239.5849 [2,] 240.3876 7450.323 15450.323 -4064.903 239.5849 $out [1] -10000 -14000 11000 -18000 $group [1] 3 5 7 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(9000, 10000, 10500, 12000, 15000, -11000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6m4xy1476131512.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,] 1858000 1863000 1918000 1932000 1959000 1991000 NA [2,] 1864000 1876000 1926500 1943500 1967500 1998000 NA [3,] 1873000 1883000 1936000 1951000 1979000 2009000 NA [4,] 1878000 1901000 1942500 1965000 1994000 2025000 NA [5,] 1888000 1922000 1945000 1972000 2000000 2031000 NA $n [1] 12 12 12 12 12 12 0 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1866615 1871597 1928702 1941194 1966913 1996685 NA [2,] 1879385 1894403 1943298 1960806 1991087 2021315 NA $out numeric(0) $group numeric(0) $names [1] "1" "2" "3" "4" "5" "6" NA Warning message: In bxp(list(stats = c(1858000, 1864000, 1873000, 1878000, 1888000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/7zklq1476131512.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,] 1921167 1925000 1916375 [2,] 1929167 1935750 1925062 [3,] 1940000 1945500 1934938 [4,] 1950417 1952750 1949188 [5,] 1959167 1958500 1960375 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1930308 1937746 1923934 [2,] 1949692 1953254 1945941 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1921166.66666667, 1929166.66666667, 1940000, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > try(system("convert tmp/1iq0h1476131512.ps tmp/1iq0h1476131512.png",intern=TRUE)) character(0) > try(system("convert tmp/2j4v51476131512.ps tmp/2j4v51476131512.png",intern=TRUE)) character(0) > try(system("convert tmp/3fw4x1476131512.ps tmp/3fw4x1476131512.png",intern=TRUE)) character(0) > try(system("convert tmp/4dhap1476131512.ps tmp/4dhap1476131512.png",intern=TRUE)) character(0) > try(system("convert tmp/5z9xk1476131512.ps tmp/5z9xk1476131512.png",intern=TRUE)) character(0) > try(system("convert tmp/6m4xy1476131512.ps tmp/6m4xy1476131512.png",intern=TRUE)) character(0) > try(system("convert tmp/7zklq1476131512.ps tmp/7zklq1476131512.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.672 0.202 2.955