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(91,120.7,127.9,112.4,93.1,107.5,107.3,114.8,120.8,112.2,123.3,100.6,86.7,123.6,125.3,111.1,98.4,102.3,105,128.2,124.7,116.1,131.2,97.7,88.8,132.8,113.9,112.6,104.3,107.5,106,117.3,123.1,114.3,132,92.3,93.7,121.3,113.6,116.3,98.3,111.9,109.3,133.2,118,131.6,134.1,96.7,99.8,128.3,134.9,130.7,107.3,121.6,120.6,140.5,124.8,129.9,159.4,111,110.1,132.7,135,118.6,94,117.9,114.7,113.6,130.6,117.1,123.2,106.1,87.9) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > n <- length(x) > c <- array(NA,dim=c(401)) > l <- array(NA,dim=c(401)) > mx <- 0 > mxli <- -999 > for (i in 1:401) + { + l[i] <- (i-201)/100 + if (l[i] != 0) + { + x1 <- (x^l[i] - 1) / l[i] + } else { + x1 <- log(x) + } + c[i] <- cor(qnorm(ppoints(x), mean=0, sd=1),x1) + if (mx < c[i]) + { + mx <- c[i] + mxli <- l[i] + } + } > c [1] 0.1645113 0.1645994 0.1646874 0.1647754 0.1648634 0.1649513 0.1650392 [8] 0.1651271 0.1652149 0.1653027 0.1653904 0.1654781 0.1655658 0.1656534 [15] 0.1657410 0.1658286 0.1659161 0.1660036 0.1660910 0.1661785 0.1662658 [22] 0.1663532 0.1664405 0.1665277 0.1666149 0.1667021 0.1667892 0.1668763 [29] 0.1669634 0.1670504 0.1671374 0.1672243 0.1673112 0.1673981 0.1674849 [36] 0.1675716 0.1676584 0.1677451 0.1678317 0.1679183 0.1680048 0.1680914 [43] 0.1681778 0.1682642 0.1683506 0.1684370 0.1685233 0.1686095 0.1686957 [50] 0.1687819 0.1688680 0.1689540 0.1690400 0.1691260 0.1692119 0.1692978 [57] 0.1693837 0.1694694 0.1695552 0.1696409 0.1697265 0.1698121 0.1698976 [64] 0.1699831 0.1700686 0.1701540 0.1702393 0.1703246 0.1704099 0.1704951 [71] 0.1705802 0.1706653 0.1707503 0.1708353 0.1709203 0.1710052 0.1710900 [78] 0.1711748 0.1712595 0.1713442 0.1714288 0.1715134 0.1715979 0.1716824 [85] 0.1717668 0.1718511 0.1719354 0.1720197 0.1721039 0.1721880 0.1722721 [92] 0.1723561 0.1724401 0.1725240 0.1726078 0.1726916 0.1727754 0.1728590 [99] 0.1729427 0.1730262 0.1731097 0.1731932 0.1732766 0.1733599 0.1734432 [106] 0.1735264 0.1736095 0.1736926 0.1737756 0.1738586 0.1739415 0.1740244 [113] 0.1741071 0.1741899 0.1742725 0.1743551 0.1744376 0.1745201 0.1746025 [120] 0.1746849 0.1747671 0.1748494 0.1749315 0.1750136 0.1750956 0.1751776 [127] 0.1752595 0.1753413 0.1754230 0.1755047 0.1755864 0.1756679 0.1757494 [134] 0.1758308 0.1759122 0.1759935 0.1760747 0.1761558 0.1762369 0.1763179 [141] 0.1763989 0.1764797 0.1765605 0.1766413 0.1767219 0.1768025 0.1768830 [148] 0.1769635 0.1770439 0.1771242 0.1772044 0.1772846 0.1773646 0.1774447 [155] 0.1775246 0.1776045 0.1776842 0.1777640 0.1778436 0.1779232 0.1780027 [162] 0.1780821 0.1781614 0.1782407 0.1783199 0.1783990 0.1784780 0.1785570 [169] 0.1786358 0.1787146 0.1787934 0.1788720 0.1789506 0.1790290 0.1791074 [176] 0.1791858 0.1792640 0.1793422 0.1794203 0.1794983 0.1795762 0.1796540 [183] 0.1797318 0.1798095 0.1798870 0.1799646 0.1800420 0.1801193 0.1801966 [190] 0.1802738 0.1803509 0.1804279 0.1805048 0.1805816 0.1806584 0.1807350 [197] 0.1808116 0.1808881 0.1809645 0.1810408 0.1811171 0.1811932 0.1812693 [204] 0.1813452 0.1814211 0.1814969 0.1815726 0.1816482 0.1817237 0.1817992 [211] 0.1818745 0.1819498 0.1820249 0.1821000 0.1821750 0.1822498 0.1823246 [218] 0.1823993 0.1824739 0.1825484 0.1826229 0.1826972 0.1827714 0.1828455 [225] 0.1829196 0.1829935 0.1830674 0.1831411 0.1832148 0.1832883 0.1833618 [232] 0.1834352 0.1835084 0.1835816 0.1836547 0.1837277 0.1838005 0.1838733 [239] 0.1839460 0.1840186 0.1840910 0.1841634 0.1842357 0.1843079 0.1843799 [246] 0.1844519 0.1845238 0.1845955 0.1846672 0.1847388 0.1848102 0.1848816 [253] 0.1849528 0.1850240 0.1850950 0.1851660 0.1852368 0.1853075 0.1853781 [260] 0.1854486 0.1855190 0.1855893 0.1856595 0.1857296 0.1857996 0.1858695 [267] 0.1859392 0.1860089 0.1860784 0.1861478 0.1862172 0.1862864 0.1863555 [274] 0.1864245 0.1864933 0.1865621 0.1866308 0.1866993 0.1867677 0.1868361 [281] 0.1869043 0.1869723 0.1870403 0.1871082 0.1871759 0.1872436 0.1873111 [288] 0.1873785 0.1874458 0.1875129 0.1875800 0.1876469 0.1877137 0.1877804 [295] 0.1878470 0.1879135 0.1879798 0.1880460 0.1881121 0.1881781 0.1882440 [302] 0.1883097 0.1883754 0.1884409 0.1885062 0.1885715 0.1886366 0.1887016 [309] 0.1887665 0.1888313 0.1888959 0.1889605 0.1890249 0.1890891 0.1891533 [316] 0.1892173 0.1892812 0.1893450 0.1894086 0.1894721 0.1895355 0.1895988 [323] 0.1896619 0.1897249 0.1897878 0.1898506 0.1899132 0.1899757 0.1900380 [330] 0.1901003 0.1901624 0.1902243 0.1902862 0.1903479 0.1904095 0.1904709 [337] 0.1905322 0.1905934 0.1906544 0.1907154 0.1907761 0.1908368 0.1908973 [344] 0.1909577 0.1910179 0.1910780 0.1911380 0.1911978 0.1912575 0.1913171 [351] 0.1913765 0.1914358 0.1914949 0.1915539 0.1916128 0.1916715 0.1917301 [358] 0.1917885 0.1918468 0.1919050 0.1919630 0.1920209 0.1920787 0.1921363 [365] 0.1921937 0.1922510 0.1923082 0.1923653 0.1924221 0.1924789 0.1925355 [372] 0.1925919 0.1926482 0.1927044 0.1927604 0.1928163 0.1928720 0.1929276 [379] 0.1929830 0.1930383 0.1930935 0.1931485 0.1932033 0.1932580 0.1933125 [386] 0.1933669 0.1934212 0.1934753 0.1935292 0.1935830 0.1936366 0.1936901 [393] 0.1937434 0.1937966 0.1938497 0.1939025 0.1939553 0.1940078 0.1940603 [400] 0.1941125 0.1941646 > mx [1] 0.1941646 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1bvls1226568190.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Normality Plot',xlab='Lambda',ylab='correlation') > mtext(paste('Optimal Lambda =',mxli)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/29hni1226568190.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x,main='Histogram of Original Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3vqxq1226568190.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x1,main='Histogram of Transformed Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4qr0q1226568190.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5m1zc1226568190.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > qqline(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Box-Cox Normality Plot',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations x',header=TRUE) > a<-table.element(a,n) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum correlation',header=TRUE) > a<-table.element(a,mx) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'optimal lambda',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/6bfd11226568190.tab") > > system("convert tmp/1bvls1226568190.ps tmp/1bvls1226568190.png") > system("convert tmp/29hni1226568190.ps tmp/29hni1226568190.png") > system("convert tmp/3vqxq1226568190.ps tmp/3vqxq1226568190.png") > system("convert tmp/4qr0q1226568190.ps tmp/4qr0q1226568190.png") > system("convert tmp/5m1zc1226568190.ps tmp/5m1zc1226568190.png") > > > proc.time() user system elapsed 1.355 0.819 1.595