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(80.6,104.1,108.2,93.4,71.9,94.1,94.9,96.4,91.1,84.4,86.4,88,75.1,109.7,103,82.1,68,96.4,94.3,90,88,76.1,82.5,81.4,66.5,97.2,94.1,80.7,70.5,87.8,89.5,99.6,84.2,75.1,92,80.8,73.1,99.8,90,83.1,72.4,78.8,87.3,91,80.1,73.6,86.4,74.5,71.2,92.4,81.5,85.3,69.9,84.2,90.7,100.3,79.4,84.8,92.9,81.6,76,98.7,89.1,88.7,67.1,93.6,97,100.8,80.1,80.7,89.4,81.5,73.6,90.9,97.3,84.3,65.6,87.3,90.5,82.4,80.4) > #'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.1512063 -0.1513242 -0.1514422 -0.1515603 -0.1516784 -0.1517966 [7] -0.1519149 -0.1520333 -0.1521517 -0.1522703 -0.1523889 -0.1525076 [13] -0.1526263 -0.1527452 -0.1528641 -0.1529831 -0.1531022 -0.1532214 [19] -0.1533406 -0.1534600 -0.1535794 -0.1536988 -0.1538184 -0.1539380 [25] -0.1540577 -0.1541775 -0.1542974 -0.1544173 -0.1545373 -0.1546574 [31] -0.1547776 -0.1548978 -0.1550181 -0.1551385 -0.1552589 -0.1553794 [37] -0.1555000 -0.1556207 -0.1557415 -0.1558623 -0.1559832 -0.1561041 [43] -0.1562252 -0.1563463 -0.1564674 -0.1565887 -0.1567100 -0.1568314 [49] -0.1569528 -0.1570744 -0.1571960 -0.1573176 -0.1574393 -0.1575611 [55] -0.1576830 -0.1578049 -0.1579269 -0.1580490 -0.1581712 -0.1582934 [61] -0.1584156 -0.1585380 -0.1586604 -0.1587828 -0.1589054 -0.1590280 [67] -0.1591506 -0.1592734 -0.1593961 -0.1595190 -0.1596419 -0.1597649 [73] -0.1598879 -0.1600111 -0.1601342 -0.1602575 -0.1603807 -0.1605041 [79] -0.1606275 -0.1607510 -0.1608745 -0.1609981 -0.1611218 -0.1612455 [85] -0.1613693 -0.1614931 -0.1616170 -0.1617410 -0.1618650 -0.1619891 [91] -0.1621132 -0.1622374 -0.1623616 -0.1624859 -0.1626103 -0.1627347 [97] -0.1628592 -0.1629837 -0.1631083 -0.1632329 -0.1633576 -0.1634824 [103] -0.1636072 -0.1637320 -0.1638570 -0.1639819 -0.1641069 -0.1642320 [109] -0.1643571 -0.1644823 -0.1646075 -0.1647328 -0.1648581 -0.1649835 [115] -0.1651089 -0.1652344 -0.1653599 -0.1654855 -0.1656112 -0.1657368 [121] -0.1658626 -0.1659883 -0.1661142 -0.1662400 -0.1663660 -0.1664919 [127] -0.1666179 -0.1667440 -0.1668701 -0.1669963 -0.1671225 -0.1672487 [133] -0.1673750 -0.1675013 -0.1676277 -0.1677541 -0.1678806 -0.1680071 [139] -0.1681337 -0.1682603 -0.1683869 -0.1685136 -0.1686403 -0.1687671 [145] -0.1688939 -0.1690208 -0.1691476 -0.1692746 -0.1694015 -0.1695286 [151] -0.1696556 -0.1697827 -0.1699098 -0.1700370 -0.1701642 -0.1702914 [157] -0.1704187 -0.1705460 -0.1706734 -0.1708008 -0.1709282 -0.1710557 [163] -0.1711832 -0.1713107 -0.1714383 -0.1715659 -0.1716935 -0.1718212 [169] -0.1719489 -0.1720767 -0.1722045 -0.1723323 -0.1724601 -0.1725880 [175] -0.1727159 -0.1728438 -0.1729718 -0.1730998 -0.1732278 -0.1733559 [181] -0.1734840 -0.1736121 -0.1737402 -0.1738684 -0.1739966 -0.1741249 [187] -0.1742531 -0.1743814 -0.1745097 -0.1746381 -0.1747665 -0.1748949 [193] -0.1750233 -0.1751517 -0.1752802 -0.1754087 -0.1755372 -0.1756658 [199] -0.1757944 -0.1759230 -0.1760516 -0.1761802 -0.1763089 -0.1764376 [205] -0.1765663 -0.1766950 -0.1768238 -0.1769526 -0.1770814 -0.1772102 [211] -0.1773390 -0.1774679 -0.1775968 -0.1777257 -0.1778546 -0.1779835 [217] -0.1781125 -0.1782415 -0.1783705 -0.1784995 -0.1786285 -0.1787575 [223] -0.1788866 -0.1790157 -0.1791448 -0.1792739 -0.1794030 -0.1795321 [229] -0.1796613 -0.1797904 -0.1799196 -0.1800488 -0.1801780 -0.1803072 [235] -0.1804364 -0.1805657 -0.1806949 -0.1808242 -0.1809535 -0.1810828 [241] -0.1812121 -0.1813414 -0.1814707 -0.1816000 -0.1817293 -0.1818587 [247] -0.1819880 -0.1821174 -0.1822468 -0.1823761 -0.1825055 -0.1826349 [253] -0.1827643 -0.1828937 -0.1830231 -0.1831525 -0.1832819 -0.1834114 [259] -0.1835408 -0.1836702 -0.1837996 -0.1839291 -0.1840585 -0.1841880 [265] -0.1843174 -0.1844469 -0.1845763 -0.1847058 -0.1848352 -0.1849647 [271] -0.1850941 -0.1852236 -0.1853530 -0.1854825 -0.1856119 -0.1857414 [277] -0.1858708 -0.1860003 -0.1861297 -0.1862592 -0.1863886 -0.1865180 [283] -0.1866475 -0.1867769 -0.1869063 -0.1870358 -0.1871652 -0.1872946 [289] -0.1874240 -0.1875534 -0.1876828 -0.1878122 -0.1879415 -0.1880709 [295] -0.1882003 -0.1883296 -0.1884590 -0.1885883 -0.1887177 -0.1888470 [301] -0.1889763 -0.1891056 -0.1892349 -0.1893642 -0.1894934 -0.1896227 [307] -0.1897520 -0.1898812 -0.1900104 -0.1901396 -0.1902688 -0.1903980 [313] -0.1905272 -0.1906564 -0.1907855 -0.1909146 -0.1910437 -0.1911728 [319] -0.1913019 -0.1914310 -0.1915601 -0.1916891 -0.1918181 -0.1919471 [325] -0.1920761 -0.1922051 -0.1923340 -0.1924630 -0.1925919 -0.1927208 [331] -0.1928496 -0.1929785 -0.1931073 -0.1932362 -0.1933650 -0.1934937 [337] -0.1936225 -0.1937512 -0.1938799 -0.1940086 -0.1941373 -0.1942659 [343] -0.1943945 -0.1945231 -0.1946517 -0.1947802 -0.1949088 -0.1950373 [349] -0.1951657 -0.1952942 -0.1954226 -0.1955510 -0.1956794 -0.1958077 [355] -0.1959360 -0.1960643 -0.1961926 -0.1963208 -0.1964490 -0.1965772 [361] -0.1967053 -0.1968334 -0.1969615 -0.1970896 -0.1972176 -0.1973456 [367] -0.1974736 -0.1976015 -0.1977294 -0.1978573 -0.1979851 -0.1981129 [373] -0.1982407 -0.1983684 -0.1984961 -0.1986238 -0.1987515 -0.1988791 [379] -0.1990066 -0.1991342 -0.1992617 -0.1993891 -0.1995165 -0.1996439 [385] -0.1997713 -0.1998986 -0.2000259 -0.2001531 -0.2002803 -0.2004075 [391] -0.2005346 -0.2006617 -0.2007888 -0.2009158 -0.2010427 -0.2011697 [397] -0.2012966 -0.2014234 -0.2015502 -0.2016770 -0.2018037 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1390i1226497728.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/2z84y1226497728.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/3isha1226497728.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/41p6h1226497728.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/5n04p1226497728.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/68ejh1226497728.tab") > > system("convert tmp/1390i1226497728.ps tmp/1390i1226497728.png") > system("convert tmp/2z84y1226497728.ps tmp/2z84y1226497728.png") > system("convert tmp/3isha1226497728.ps tmp/3isha1226497728.png") > system("convert tmp/41p6h1226497728.ps tmp/41p6h1226497728.png") > system("convert tmp/5n04p1226497728.ps tmp/5n04p1226497728.png") > > > proc.time() user system elapsed 1.283 0.779 1.516