R version 2.9.0 (2009-04-17) Copyright (C) 2009 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. > y <- c(112.39,97.59,142.30,120.79,121.24,104.61,119.86,117.81,91.86,117.37,112.84,101.95,120.52,102.84,137.41,118.97,125.01,118.57,130.61,116.30,99.15,110.26,107.59,107.01,113.77,93.33,147.32,124.48,106.79,134.39,111.41,132.43,98.26,109.81,115.28,108.97,99.19,105.46,138.97,124.52,117.37,123.86,116.39,124.70,97.46,103.24,112.39,107.19,100.53,95.73,143.54,101.99,120.66,121.46,102.97,121.32,85.02,106.21,110.39,87.10) > x <- c(105.81,107.16,107.83,108.85,109.52,110.19,111.20,111.54,111.88,112.55,112.55,112.55,114.24,116.26,116.60,118.62,119.63,120.64,121.65,122.33,122.66,123.00,123.34,124.68,125.02,125.02,125.36,125.70,125.70,126.03,126.37,126.37,126.71,126.71,127.04,127.04,127.38,127.72,128.05,129.40,131.09,131.42,131.76,132.10,132.43,132.77,132.77,133.11,133.45,133.78,134.12,134.46,134.79,134.79,135.13,135.13,136.82,137.15,142.54,143.89) > #'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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] -0.1440653 -0.1441457 -0.1442262 -0.1443067 -0.1443872 -0.1444677 [7] -0.1445483 -0.1446289 -0.1447095 -0.1447901 -0.1448708 -0.1449515 [13] -0.1450322 -0.1451129 -0.1451937 -0.1452745 -0.1453553 -0.1454361 [19] -0.1455170 -0.1455979 -0.1456788 -0.1457598 -0.1458407 -0.1459217 [25] -0.1460027 -0.1460838 -0.1461648 -0.1462459 -0.1463270 -0.1464082 [31] -0.1464893 -0.1465705 -0.1466517 -0.1467329 -0.1468142 -0.1468955 [37] -0.1469768 -0.1470581 -0.1471395 -0.1472208 -0.1473022 -0.1473837 [43] -0.1474651 -0.1475466 -0.1476281 -0.1477096 -0.1477911 -0.1478727 [49] -0.1479543 -0.1480359 -0.1481175 -0.1481992 -0.1482809 -0.1483626 [55] -0.1484443 -0.1485260 -0.1486078 -0.1486896 -0.1487714 -0.1488532 [61] -0.1489351 -0.1490170 -0.1490989 -0.1491808 -0.1492628 -0.1493448 [67] -0.1494267 -0.1495088 -0.1495908 -0.1496729 -0.1497550 -0.1498371 [73] -0.1499192 -0.1500013 -0.1500835 -0.1501657 -0.1502479 -0.1503302 [79] -0.1504124 -0.1504947 -0.1505770 -0.1506593 -0.1507417 -0.1508240 [85] -0.1509064 -0.1509888 -0.1510712 -0.1511537 -0.1512362 -0.1513187 [91] -0.1514012 -0.1514837 -0.1515663 -0.1516488 -0.1517314 -0.1518140 [97] -0.1518967 -0.1519793 -0.1520620 -0.1521447 -0.1522274 -0.1523102 [103] -0.1523929 -0.1524757 -0.1525585 -0.1526413 -0.1527241 -0.1528070 [109] -0.1528899 -0.1529728 -0.1530557 -0.1531386 -0.1532216 -0.1533046 [115] -0.1533876 -0.1534706 -0.1535536 -0.1536367 -0.1537197 -0.1538028 [121] -0.1538859 -0.1539691 -0.1540522 -0.1541354 -0.1542186 -0.1543018 [127] -0.1543850 -0.1544682 -0.1545515 -0.1546348 -0.1547181 -0.1548014 [133] -0.1548847 -0.1549681 -0.1550514 -0.1551348 -0.1552182 -0.1553017 [139] -0.1553851 -0.1554686 -0.1555520 -0.1556355 -0.1557191 -0.1558026 [145] -0.1558861 -0.1559697 -0.1560533 -0.1561369 -0.1562205 -0.1563041 [151] -0.1563878 -0.1564715 -0.1565552 -0.1566389 -0.1567226 -0.1568063 [157] -0.1568901 -0.1569738 -0.1570576 -0.1571414 -0.1572253 -0.1573091 [163] -0.1573930 -0.1574768 -0.1575607 -0.1576446 -0.1577285 -0.1578125 [169] -0.1578964 -0.1579804 -0.1580644 -0.1581484 -0.1582324 -0.1583164 [175] -0.1584005 -0.1584845 -0.1585686 -0.1586527 -0.1587368 -0.1588209 [181] -0.1589051 -0.1589892 -0.1590734 -0.1591576 -0.1592418 -0.1593260 [187] -0.1594102 -0.1594945 -0.1595787 -0.1596630 -0.1597473 -0.1598316 [193] -0.1599159 -0.1600003 -0.1600846 -0.1601690 -0.1602533 -0.1603377 [199] -0.1604221 -0.1605066 -0.1605910 -0.1606754 -0.1607599 -0.1608444 [205] -0.1609288 -0.1610133 -0.1610979 -0.1611824 -0.1612669 -0.1613515 [211] -0.1614360 -0.1615206 -0.1616052 -0.1616898 -0.1617744 -0.1618591 [217] -0.1619437 -0.1620284 -0.1621131 -0.1621977 -0.1622824 -0.1623671 [223] -0.1624519 -0.1625366 -0.1626213 -0.1627061 -0.1627909 -0.1628757 [229] -0.1629604 -0.1630453 -0.1631301 -0.1632149 -0.1632997 -0.1633846 [235] -0.1634695 -0.1635543 -0.1636392 -0.1637241 -0.1638090 -0.1638940 [241] -0.1639789 -0.1640638 -0.1641488 -0.1642338 -0.1643187 -0.1644037 [247] -0.1644887 -0.1645737 -0.1646588 -0.1647438 -0.1648288 -0.1649139 [253] -0.1649990 -0.1650840 -0.1651691 -0.1652542 -0.1653393 -0.1654244 [259] -0.1655095 -0.1655947 -0.1656798 -0.1657650 -0.1658501 -0.1659353 [265] -0.1660205 -0.1661057 -0.1661909 -0.1662761 -0.1663613 -0.1664465 [271] -0.1665318 -0.1666170 -0.1667023 -0.1667875 -0.1668728 -0.1669581 [277] -0.1670434 -0.1671287 -0.1672140 -0.1672993 -0.1673846 -0.1674700 [283] -0.1675553 -0.1676407 -0.1677260 -0.1678114 -0.1678968 -0.1679821 [289] -0.1680675 -0.1681529 -0.1682383 -0.1683238 -0.1684092 -0.1684946 [295] -0.1685800 -0.1686655 -0.1687509 -0.1688364 -0.1689218 -0.1690073 [301] -0.1690928 -0.1691783 -0.1692638 -0.1693493 -0.1694348 -0.1695203 [307] -0.1696058 -0.1696913 -0.1697769 -0.1698624 -0.1699479 -0.1700335 [313] -0.1701190 -0.1702046 -0.1702902 -0.1703757 -0.1704613 -0.1705469 [319] -0.1706325 -0.1707181 -0.1708037 -0.1708893 -0.1709749 -0.1710605 [325] -0.1711462 -0.1712318 -0.1713174 -0.1714031 -0.1714887 -0.1715744 [331] -0.1716600 -0.1717457 -0.1718313 -0.1719170 -0.1720027 -0.1720883 [337] -0.1721740 -0.1722597 -0.1723454 -0.1724311 -0.1725168 -0.1726025 [343] -0.1726882 -0.1727739 -0.1728596 -0.1729453 -0.1730310 -0.1731168 [349] -0.1732025 -0.1732882 -0.1733739 -0.1734597 -0.1735454 -0.1736312 [355] -0.1737169 -0.1738026 -0.1738884 -0.1739742 -0.1740599 -0.1741457 [361] -0.1742314 -0.1743172 -0.1744030 -0.1744887 -0.1745745 -0.1746603 [367] -0.1747460 -0.1748318 -0.1749176 -0.1750034 -0.1750892 -0.1751749 [373] -0.1752607 -0.1753465 -0.1754323 -0.1755181 -0.1756039 -0.1756897 [379] -0.1757755 -0.1758613 -0.1759471 -0.1760328 -0.1761186 -0.1762044 [385] -0.1762902 -0.1763760 -0.1764618 -0.1765476 -0.1766334 -0.1767192 [391] -0.1768050 -0.1768908 -0.1769766 -0.1770624 -0.1771482 -0.1772341 [397] -0.1773199 -0.1774057 -0.1774915 -0.1775773 -0.1776631 > mx [1] 0.1776631 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > r<-lm(y~x) > se <- sqrt(var(r$residuals)) > r1 <- lm(y~x1) > se1 <- sqrt(var(r1$residuals)) > postscript(file="/var/www/html/rcomp/tmp/11thm1258117824.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2gyza1258117824.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') > abline(r) > grid() > mtext(paste('Residual Standard Deviation = ',se)) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3qg6z1258117824.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') > abline(r1) > grid() > mtext(paste('Residual Standard Deviation = ',se1)) > 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 Linearity 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(x)',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (orginial)',header=TRUE) > a<-table.element(a,se) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (transformed)',header=TRUE) > a<-table.element(a,se1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/4iar81258117824.tab") > > system("convert tmp/11thm1258117824.ps tmp/11thm1258117824.png") > system("convert tmp/2gyza1258117824.ps tmp/2gyza1258117824.png") > system("convert tmp/3qg6z1258117824.ps tmp/3qg6z1258117824.png") > > > proc.time() user system elapsed 0.789 0.506 0.927