R version 2.7.0 (2008-04-22) 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(1593,1477.9,1733.7,1569.7,1843.7,1950.3,1657.5,1772.1,1568.3,1809.8,1646.7,1808.5,1763.9,1625.5,1538.8,1342.4,1645.1,1619.9,1338.1,1505.5,1529.1,1511.9,1656.7,1694.4,1662.3,1588.7,1483.3,1585.6,1658.9,1584.4,1470.6,1618.7,1407.6,1473.9,1515.3,1485.4,1496.1,1493.5,1298.4,1375.3,1507.9,1455.3,1363.3,1392.8,1348.8,1880.3,1669.2,1543.6,1701.2,1516.5,1466.8,1484.1,1577.2,1684.5,1414.7,1674.5,1598.7,1739.1,1674.6,1671.8,1802,1526.8,1580.9,1634.8,1610.3,1712,1678.8,1708.1,1680.6,2056,1624,2021.4,1861.1,1750.8,1767.5,1710.3,2151.5,2047.9,1915.4,1984.7,1896.5,2170.8,2139.9,2330.5,2121.8,2226.8,1857.9,2155.9,2341.7,2290.2,2006.5,2111.9,1731.3,1762.2,1863.2,1943.5,1975.2) > 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,] 1593.0 1763.9 1662.3 1496.1 1701.2 1802.0 1861.1 2121.8 1975.2 [2,] 1477.9 1625.5 1588.7 1493.5 1516.5 1526.8 1750.8 2226.8 NA [3,] 1733.7 1538.8 1483.3 1298.4 1466.8 1580.9 1767.5 1857.9 NA [4,] 1569.7 1342.4 1585.6 1375.3 1484.1 1634.8 1710.3 2155.9 NA [5,] 1843.7 1645.1 1658.9 1507.9 1577.2 1610.3 2151.5 2341.7 NA [6,] 1950.3 1619.9 1584.4 1455.3 1684.5 1712.0 2047.9 2290.2 NA [7,] 1657.5 1338.1 1470.6 1363.3 1414.7 1678.8 1915.4 2006.5 NA [8,] 1772.1 1505.5 1618.7 1392.8 1674.5 1708.1 1984.7 2111.9 NA [9,] 1568.3 1529.1 1407.6 1348.8 1598.7 1680.6 1896.5 1731.3 NA [10,] 1809.8 1511.9 1473.9 1880.3 1739.1 2056.0 2170.8 1762.2 NA [11,] 1646.7 1656.7 1515.3 1669.2 1674.6 1624.0 2139.9 1863.2 NA [12,] 1808.5 1694.4 1485.4 1543.6 1671.8 2021.4 2330.5 1943.5 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/14vyb1225710214.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/2p3rp1225710214.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/3mmcl1225710214.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/4v5be1225710214.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,] 1496.1 1477.90 1298.40 1342.40 1507.90 1455.30 1338.10 1392.8 1348.80 [2,] 1662.3 1505.00 1475.05 1429.70 1593.75 1602.15 1389.00 1562.1 1468.35 [3,] 1763.9 1557.75 1559.85 1577.65 1652.00 1698.25 1564.05 1691.3 1583.50 [4,] 1861.1 1688.15 1750.60 1672.55 1997.60 1999.10 1797.10 1878.4 1705.95 [5,] 2121.8 1750.80 1857.90 1710.30 2341.70 2290.20 2006.50 2111.9 1896.50 [,10] [,11] [,12] [1,] 1473.90 1515.30 1485.40 [2,] 1625.50 1635.35 1607.70 [3,] 1786.00 1662.95 1751.45 [4,] 1968.15 1768.90 1982.45 [5,] 2170.80 1863.20 2330.50 $n [1] 9 8 8 8 8 8 8 8 8 8 8 8 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1659.199 1455.440 1405.924 1441.991 1426.404 1476.508 1336.079 1514.610 [2,] 1868.601 1660.060 1713.776 1713.309 1877.596 1919.992 1792.021 1867.990 [,9] [,10] [,11] [,12] [1,] 1450.773 1594.591 1588.347 1542.109 [2,] 1716.227 1977.409 1737.553 1960.791 $out [1] 2226.8 2155.9 2139.9 $group [1] 2 4 11 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" Warning message: In bxp(list(stats = c(1496.1, 1662.3, 1763.9, 1861.1, 2121.8, 1477.9, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5728e1225710214.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,] 1477.90 1338.10 1407.60 1298.40 1414.70 1526.80 1710.30 1731.30 1975.2 [2,] 1581.35 1508.70 1478.60 1369.30 1500.30 1617.15 1814.30 1860.55 1975.2 [3,] 1695.60 1579.35 1549.85 1474.40 1635.25 1679.70 1950.05 2059.20 1975.2 [4,] 1809.15 1650.90 1603.70 1525.75 1679.55 1757.00 2145.70 2191.35 1975.2 [5,] 1950.30 1763.90 1662.30 1669.20 1739.10 1802.00 2330.50 2341.70 1975.2 $n [1] 12 12 12 12 12 12 12 12 1 $conf [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1591.699 1514.492 1492.791 1403.042 1553.493 1615.913 1798.896 1908.32 [2,] 1799.501 1644.208 1606.909 1545.758 1717.007 1743.487 2101.204 2210.08 [,9] [1,] 1975.2 [2,] 1975.2 $out [1] 1880.3 2056.0 2021.4 $group [1] 4 6 6 $names [1] "1" "2" "3" "4" "5" "6" "7" "8" NA Warning message: In bxp(list(stats = c(1477.9, 1581.35, 1695.6, 1809.15, 1950.3, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/6iojo1225710214.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,] 1590.912 1557.750 1555.287 [2,] 1606.438 1570.850 1589.894 [3,] 1722.369 1657.475 1694.606 [4,] 1792.550 1724.850 1777.281 [5,] 1812.388 1786.000 1803.262 $n [1] 12 12 12 $conf [,1] [,2] [,3] [1,] 1637.482 1587.235 1609.138 [2,] 1807.256 1727.715 1780.075 $out numeric(0) $group numeric(0) $names [1] "mean" "median" "midrange" Warning message: In bxp(list(stats = c(1590.9125, 1606.4375, 1722.36875, 1792.55, : some notches went outside hinges ('box'): maybe set notch=FALSE > dev.off() null device 1 > > system("convert tmp/14vyb1225710214.ps tmp/14vyb1225710214.png") > system("convert tmp/2p3rp1225710214.ps tmp/2p3rp1225710214.png") > system("convert tmp/3mmcl1225710214.ps tmp/3mmcl1225710214.png") > system("convert tmp/4v5be1225710214.ps tmp/4v5be1225710214.png") > system("convert tmp/5728e1225710214.ps tmp/5728e1225710214.png") > system("convert tmp/6iojo1225710214.ps tmp/6iojo1225710214.png") > > > proc.time() user system elapsed 2.323 1.348 2.544