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(110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.3,112.1,111.8,112.5,116.3,110.3,117.1,103.4,96.2) > #'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.1665142 0.1665559 0.1665977 0.1666395 0.1666812 0.1667229 0.1667646 [8] 0.1668062 0.1668479 0.1668895 0.1669311 0.1669727 0.1670142 0.1670557 [15] 0.1670973 0.1671388 0.1671802 0.1672217 0.1672631 0.1673045 0.1673459 [22] 0.1673873 0.1674286 0.1674700 0.1675113 0.1675526 0.1675938 0.1676351 [29] 0.1676763 0.1677175 0.1677587 0.1677998 0.1678410 0.1678821 0.1679232 [36] 0.1679643 0.1680053 0.1680463 0.1680874 0.1681283 0.1681693 0.1682103 [43] 0.1682512 0.1682921 0.1683330 0.1683739 0.1684147 0.1684555 0.1684963 [50] 0.1685371 0.1685779 0.1686186 0.1686593 0.1687000 0.1687407 0.1687813 [57] 0.1688220 0.1688626 0.1689032 0.1689437 0.1689843 0.1690248 0.1690653 [64] 0.1691058 0.1691463 0.1691867 0.1692271 0.1692675 0.1693079 0.1693483 [71] 0.1693886 0.1694289 0.1694692 0.1695095 0.1695497 0.1695899 0.1696301 [78] 0.1696703 0.1697105 0.1697506 0.1697908 0.1698309 0.1698709 0.1699110 [85] 0.1699510 0.1699910 0.1700310 0.1700710 0.1701110 0.1701509 0.1701908 [92] 0.1702307 0.1702705 0.1703104 0.1703502 0.1703900 0.1704298 0.1704695 [99] 0.1705093 0.1705490 0.1705887 0.1706283 0.1706680 0.1707076 0.1707472 [106] 0.1707868 0.1708264 0.1708659 0.1709054 0.1709449 0.1709844 0.1710238 [113] 0.1710633 0.1711027 0.1711421 0.1711814 0.1712208 0.1712601 0.1712994 [120] 0.1713387 0.1713780 0.1714172 0.1714564 0.1714956 0.1715348 0.1715739 [127] 0.1716131 0.1716522 0.1716913 0.1717303 0.1717694 0.1718084 0.1718474 [134] 0.1718864 0.1719253 0.1719642 0.1720032 0.1720420 0.1720809 0.1721198 [141] 0.1721586 0.1721974 0.1722362 0.1722749 0.1723137 0.1723524 0.1723911 [148] 0.1724297 0.1724684 0.1725070 0.1725456 0.1725842 0.1726228 0.1726613 [155] 0.1726998 0.1727383 0.1727768 0.1728153 0.1728537 0.1728921 0.1729305 [162] 0.1729689 0.1730072 0.1730455 0.1730838 0.1731221 0.1731604 0.1731986 [169] 0.1732368 0.1732750 0.1733132 0.1733513 0.1733894 0.1734276 0.1734656 [176] 0.1735037 0.1735417 0.1735797 0.1736177 0.1736557 0.1736937 0.1737316 [183] 0.1737695 0.1738074 0.1738452 0.1738831 0.1739209 0.1739587 0.1739965 [190] 0.1740342 0.1740719 0.1741097 0.1741473 0.1741850 0.1742226 0.1742603 [197] 0.1742979 0.1743354 0.1743730 0.1744105 0.1744480 0.1744855 0.1745230 [204] 0.1745604 0.1745979 0.1746353 0.1746726 0.1747100 0.1747473 0.1747846 [211] 0.1748219 0.1748592 0.1748964 0.1749337 0.1749709 0.1750080 0.1750452 [218] 0.1750823 0.1751194 0.1751565 0.1751936 0.1752307 0.1752677 0.1753047 [225] 0.1753417 0.1753786 0.1754156 0.1754525 0.1754894 0.1755262 0.1755631 [232] 0.1755999 0.1756367 0.1756735 0.1757103 0.1757470 0.1757837 0.1758204 [239] 0.1758571 0.1758937 0.1759303 0.1759669 0.1760035 0.1760401 0.1760766 [246] 0.1761131 0.1761496 0.1761861 0.1762226 0.1762590 0.1762954 0.1763318 [253] 0.1763681 0.1764045 0.1764408 0.1764771 0.1765134 0.1765496 0.1765858 [260] 0.1766221 0.1766582 0.1766944 0.1767305 0.1767667 0.1768028 0.1768388 [267] 0.1768749 0.1769109 0.1769469 0.1769829 0.1770189 0.1770548 0.1770907 [274] 0.1771266 0.1771625 0.1771983 0.1772342 0.1772700 0.1773058 0.1773415 [281] 0.1773773 0.1774130 0.1774487 0.1774844 0.1775200 0.1775556 0.1775913 [288] 0.1776268 0.1776624 0.1776979 0.1777335 0.1777690 0.1778044 0.1778399 [295] 0.1778753 0.1779107 0.1779461 0.1779815 0.1780168 0.1780521 0.1780874 [302] 0.1781227 0.1781580 0.1781932 0.1782284 0.1782636 0.1782988 0.1783339 [309] 0.1783690 0.1784041 0.1784392 0.1784743 0.1785093 0.1785443 0.1785793 [316] 0.1786142 0.1786492 0.1786841 0.1787190 0.1787539 0.1787887 0.1788236 [323] 0.1788584 0.1788932 0.1789279 0.1789627 0.1789974 0.1790321 0.1790668 [330] 0.1791014 0.1791361 0.1791707 0.1792053 0.1792398 0.1792744 0.1793089 [337] 0.1793434 0.1793779 0.1794123 0.1794468 0.1794812 0.1795156 0.1795500 [344] 0.1795843 0.1796186 0.1796529 0.1796872 0.1797215 0.1797557 0.1797899 [351] 0.1798241 0.1798583 0.1798924 0.1799265 0.1799606 0.1799947 0.1800288 [358] 0.1800628 0.1800968 0.1801308 0.1801648 0.1801987 0.1802327 0.1802666 [365] 0.1803005 0.1803343 0.1803681 0.1804020 0.1804358 0.1804695 0.1805033 [372] 0.1805370 0.1805707 0.1806044 0.1806381 0.1806717 0.1807053 0.1807389 [379] 0.1807725 0.1808060 0.1808396 0.1808731 0.1809065 0.1809400 0.1809734 [386] 0.1810069 0.1810403 0.1810736 0.1811070 0.1811403 0.1811736 0.1812069 [393] 0.1812402 0.1812734 0.1813066 0.1813398 0.1813730 0.1814062 0.1814393 [400] 0.1814724 0.1815055 > mx [1] 0.1815055 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1m4wu1226610660.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/2r6vm1226610660.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/3a1yb1226610660.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/40qwx1226610660.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/5w2af1226610660.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/64xo61226610660.tab") > > system("convert tmp/1m4wu1226610660.ps tmp/1m4wu1226610660.png") > system("convert tmp/2r6vm1226610660.ps tmp/2r6vm1226610660.png") > system("convert tmp/3a1yb1226610660.ps tmp/3a1yb1226610660.png") > system("convert tmp/40qwx1226610660.ps tmp/40qwx1226610660.png") > system("convert tmp/5w2af1226610660.ps tmp/5w2af1226610660.png") > > > proc.time() user system elapsed 1.474 0.881 2.252