R version 2.7.2 (2008-08-25) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(1045.9,1401.9,1027.6,1703.8,1481.3,1422.7,1304.7,1246.1,1417.8,1459.1,1156.4,1304.5,1336.9,1372.3,975.5,1180.8,1361.3,1428.1,1355.9,1781.2,1697,1852,1844.1,1967.2,1747.1,1863.9,1559.3,1675,2237.5,1965.2,1871.5,1752.2,1360.7,1444.3,1621.6,1368,1553.9,1695.3,1397.1,1848.4,1809.2,1551.1,1546.6,1467.9,1662.4,1972.3,1673.5,1762,2019.8,1754.3,1400.4,1453.6,1740.9,1694.6,1541.2,1482.3,1632.1,1837.3,1797,2066.2,1983.8,1601.7,1660.3,1954,1991.9,1881.4,2345.5,1773.1,1719.2,2240.9,1816.4,2171.3,1823.3,2022.5,1991,1920,2168.4,2013.5,1790.8,1855.7,2074,2535.8,1837.2,1805.1,1785.7,2250,1959.7,1890.8,2405.7,2090.3,1666.5,1803.5,1793.8,1488.8,1545,1369.9,1451.6) > par1 = '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Mean Plot (v1.0.1) 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 > #Technical description: Write here your technical program description > par1 <- as.numeric(par1) > (n <- length(x)) [1] 97 > (np <- floor(n / par1)) [1] 8 > arr <- array(NA,dim=c(par1,np+1)) > ari <- array(0,dim=par1) > j <- 0 > for (i in 1:n) + { + j = j + 1 + ari[j] = ari[j] + 1 + arr[j,ari[j]] <- x[i] + if (j == par1) j = 0 + } > ari [1] 9 8 8 8 8 8 8 8 8 8 8 8 > arr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1045.9 1336.9 1747.1 1553.9 2019.8 1983.8 1823.3 1785.7 1451.6 [2,] 1401.9 1372.3 1863.9 1695.3 1754.3 1601.7 2022.5 2250.0 NA [3,] 1027.6 975.5 1559.3 1397.1 1400.4 1660.3 1991.0 1959.7 NA [4,] 1703.8 1180.8 1675.0 1848.4 1453.6 1954.0 1920.0 1890.8 NA [5,] 1481.3 1361.3 2237.5 1809.2 1740.9 1991.9 2168.4 2405.7 NA [6,] 1422.7 1428.1 1965.2 1551.1 1694.6 1881.4 2013.5 2090.3 NA [7,] 1304.7 1355.9 1871.5 1546.6 1541.2 2345.5 1790.8 1666.5 NA [8,] 1246.1 1781.2 1752.2 1467.9 1482.3 1773.1 1855.7 1803.5 NA [9,] 1417.8 1697.0 1360.7 1662.4 1632.1 1719.2 2074.0 1793.8 NA [10,] 1459.1 1852.0 1444.3 1972.3 1837.3 2240.9 2535.8 1488.8 NA [11,] 1156.4 1844.1 1621.6 1673.5 1797.0 1816.4 1837.2 1545.0 NA [12,] 1304.5 1967.2 1368.0 1762.0 2066.2 2171.3 1805.1 1369.9 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/www/html/rcomp/tmp/1u9vl1225709584.ps",horizontal=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/www/html/rcomp/tmp/2umdb1225709584.ps",horizontal=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/www/html/rcomp/tmp/36nz21225709584.ps",horizontal=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/www/html/rcomp/tmp/4iwj11225709584.ps",horizontal=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,] 1045.9 1372.3 975.50 1180.8 1361.30 1422.70 1304.70 1246.10 1360.70 [2,] 1451.6 1501.8 1212.35 1564.3 1611.10 1489.60 1448.55 1475.10 1524.95 [3,] 1747.1 1724.8 1479.85 1776.1 1900.55 1788.00 1606.55 1762.65 1679.70 [4,] 1823.3 1943.2 1810.00 1905.4 2202.95 1989.35 1831.15 1792.35 1756.50 [5,] 2019.8 2250.0 1991.00 1954.0 2405.70 2090.30 2345.50 1855.70 2074.00 [,10] [,11] [,12] [1,] 1444.30 1545.00 1304.50 [2,] 1473.95 1583.30 1368.95 [3,] 1844.65 1735.25 1783.55 [4,] 2106.60 1826.80 2016.70 [5,] 2535.80 1844.10 2171.30 $n [1] 9 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1551.338 1478.228 1145.994 1585.557 1569.934 1508.832 1392.824 1585.430 [2,] 1942.862 1971.372 1813.706 1966.643 2231.166 2067.168 1820.276 1939.870 [,9] [,10] [,11] [,12] [1,] 1550.353 1491.243 1599.227 1421.708 [2,] 1809.047 2198.057 1871.273 2145.392 $out [1] 1156.4 $group [1] 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1045.9, 1451.6, 1747.1, 1823.3, 2019.8, 1372.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/57elq1225709584.ps",horizontal=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,] 1027.60 975.50 1360.70 1397.10 1400.40 1601.70 1790.80 1369.90 1451.6 [2,] 1201.25 1346.40 1501.80 1548.85 1511.75 1746.15 1830.25 1605.75 1451.6 [3,] 1353.30 1400.20 1711.05 1667.95 1717.75 1917.70 1955.50 1798.65 1451.6 [4,] 1440.90 1812.65 1867.70 1785.60 1817.15 2081.60 2048.25 2025.00 1451.6 [5,] 1703.80 1967.20 2237.50 1972.30 2066.20 2345.50 2168.40 2405.70 1451.6 $n [1] 12 12 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1243.994 1187.540 1544.161 1559.967 1578.455 1764.699 1856.069 1607.427 [2,] 1462.606 1612.860 1877.939 1775.933 1857.045 2070.701 2054.931 1989.873 [,9] [1,] 1451.6 [2,] 1451.6 $out [1] 2535.8 $group [1] 7 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(1027.6, 1201.25, 1353.3, 1440.9, 1703.8, 975.5, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/602tb1225709584.ps",horizontal=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,] 1638.667 1606.550 1519.938 [2,] 1653.325 1702.250 1645.188 [3,] 1690.569 1754.875 1696.356 [4,] 1750.550 1785.775 1753.844 [5,] 1853.812 1900.550 1760.412 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1646.224 1716.779 1646.797 [2,] 1734.914 1792.971 1745.915 $out [1] 1496.362 1899.525 1479.850 1930.838 $group [1] 1 1 2 3 $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1638.66666666667, 1653.325, 1690.56875, 1750.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/1u9vl1225709584.ps tmp/1u9vl1225709584.png") > system("convert tmp/2umdb1225709584.ps tmp/2umdb1225709584.png") > system("convert tmp/36nz21225709584.ps tmp/36nz21225709584.png") > system("convert tmp/4iwj11225709584.ps tmp/4iwj11225709584.png") > system("convert tmp/57elq1225709584.ps tmp/57elq1225709584.png") > system("convert tmp/602tb1225709584.ps tmp/602tb1225709584.png") > > > proc.time() user system elapsed 1.321 0.832 1.832