R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(91.19,91.53,91.88,92.06,92.32,92.67,92.85,92.82,93.46,93.23,93.54,93.29,93.2,93.6,93.81,94.62,95.22,95.38,95.31,95.3,95.57,95.42,95.53,95.33,95.9,96.06,96.31,96.34,96.49,96.22,96.53,96.5,96.77,96.66,96.58,96.63,97.06,97.73,98.01,97.76,97.49,97.77,97.96,98.23,98.51,98.19,98.37,98.31,98.6,98.97,99.11,99.64,100.03,99.98,100.32,100.44,100.51,101,100.88,100.55,100.83,101.51,102.16,102.39,102.54,102.85,103.47,103.57,103.69,103.5,103.47,103.45,103.48,103.93,103.89,104.4,104.79,104.77,105.13,105.26,104.96,104.75,105.01,105.15,105.2,105.77,105.78,106.26,106.13,106.12,106.57,106.44,106.54) > x <- c(1.79,1.95,2.26,2.04,2.16,2.75,2.79,2.88,3.36,2.97,3.1,2.49,2.2,2.25,2.09,2.79,3.14,2.93,2.65,2.67,2.26,2.35,2.13,2.18,2.9,2.63,2.67,1.81,1.33,0.88,1.28,1.26,1.26,1.29,1.1,1.37,1.21,1.74,1.76,1.48,1.04,1.62,1.49,1.79,1.8,1.58,1.86,1.74,1.59,1.26,1.13,1.92,2.61,2.26,2.41,2.26,2.03,2.86,2.55,2.27,2.26,2.57,3.07,2.76,2.51,2.87,3.14,3.11,3.16,2.47,2.57,2.89,2.63,2.38,1.69,1.96,2.19,1.87,1.6,1.63,1.22,1.21,1.49,1.64,1.66,1.77,1.82,1.78,1.28,1.29,1.37,1.12,1.51) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Linearity Plot (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.1426044 -0.1429575 -0.1433099 -0.1436615 -0.1440124 -0.1443624 [7] -0.1447117 -0.1450602 -0.1454079 -0.1457548 -0.1461009 -0.1464462 [13] -0.1467907 -0.1471343 -0.1474771 -0.1478191 -0.1481603 -0.1485006 [19] -0.1488400 -0.1491786 -0.1495163 -0.1498532 -0.1501892 -0.1505244 [25] -0.1508586 -0.1511920 -0.1515244 -0.1518560 -0.1521867 -0.1525164 [31] -0.1528453 -0.1531732 -0.1535002 -0.1538263 -0.1541515 -0.1544757 [37] -0.1547990 -0.1551213 -0.1554427 -0.1557631 -0.1560826 -0.1564011 [43] -0.1567186 -0.1570352 -0.1573507 -0.1576653 -0.1579789 -0.1582915 [49] -0.1586031 -0.1589137 -0.1592233 -0.1595319 -0.1598395 -0.1601460 [55] -0.1604516 -0.1607561 -0.1610595 -0.1613620 -0.1616633 -0.1619637 [61] -0.1622630 -0.1625612 -0.1628584 -0.1631545 -0.1634495 -0.1637435 [67] -0.1640364 -0.1643282 -0.1646190 -0.1649086 -0.1651972 -0.1654846 [73] -0.1657710 -0.1660563 -0.1663405 -0.1666235 -0.1669054 -0.1671863 [79] -0.1674660 -0.1677446 -0.1680220 -0.1682984 -0.1685735 -0.1688476 [85] -0.1691205 -0.1693923 -0.1696629 -0.1699324 -0.1702007 -0.1704679 [91] -0.1707339 -0.1709987 -0.1712624 -0.1715249 -0.1717863 -0.1720464 [97] -0.1723054 -0.1725632 -0.1728199 -0.1730753 -0.1733296 -0.1735826 [103] -0.1738345 -0.1740851 -0.1743346 -0.1745829 -0.1748299 -0.1750758 [109] -0.1753205 -0.1755639 -0.1758061 -0.1760471 -0.1762869 -0.1765255 [115] -0.1767628 -0.1769989 -0.1772338 -0.1774675 -0.1776999 -0.1779311 [121] -0.1781611 -0.1783898 -0.1786173 -0.1788436 -0.1790686 -0.1792923 [127] -0.1795148 -0.1797361 -0.1799561 -0.1801749 -0.1803924 -0.1806087 [133] -0.1808237 -0.1810374 -0.1812499 -0.1814611 -0.1816711 -0.1818798 [139] -0.1820873 -0.1822934 -0.1824984 -0.1827020 -0.1829044 -0.1831055 [145] -0.1833053 -0.1835039 -0.1837012 -0.1838972 -0.1840919 -0.1842854 [151] -0.1844776 -0.1846685 -0.1848582 -0.1850465 -0.1852336 -0.1854194 [157] -0.1856040 -0.1857872 -0.1859692 -0.1861499 -0.1863293 -0.1865074 [163] -0.1866843 -0.1868598 -0.1870341 -0.1872071 -0.1873788 -0.1875493 [169] -0.1877184 -0.1878863 -0.1880529 -0.1882182 -0.1883822 -0.1885450 [175] -0.1887064 -0.1888666 -0.1890255 -0.1891831 -0.1893394 -0.1894945 [181] -0.1896483 -0.1898008 -0.1899520 -0.1901019 -0.1902506 -0.1903980 [187] -0.1905441 -0.1906889 -0.1908324 -0.1909747 -0.1911157 -0.1912554 [193] -0.1913939 -0.1915311 -0.1916670 -0.1918016 -0.1919350 -0.1920671 [199] -0.1921979 -0.1923275 -0.1924558 -0.1925829 -0.1927087 -0.1928332 [205] -0.1929564 -0.1930784 -0.1931992 -0.1933187 -0.1934369 -0.1935539 [211] -0.1936696 -0.1937841 -0.1938973 -0.1940093 -0.1941201 -0.1942296 [217] -0.1943378 -0.1944448 -0.1945506 -0.1946551 -0.1947585 -0.1948605 [223] -0.1949614 -0.1950610 -0.1951593 -0.1952565 -0.1953524 -0.1954471 [229] -0.1955406 -0.1956329 -0.1957240 -0.1958138 -0.1959024 -0.1959898 [235] -0.1960761 -0.1961611 -0.1962449 -0.1963275 -0.1964089 -0.1964891 [241] -0.1965681 -0.1966459 -0.1967226 -0.1967980 -0.1968723 -0.1969454 [247] -0.1970173 -0.1970880 -0.1971576 -0.1972260 -0.1972932 -0.1973593 [253] -0.1974242 -0.1974879 -0.1975505 -0.1976119 -0.1976721 -0.1977313 [259] -0.1977892 -0.1978461 -0.1979018 -0.1979563 -0.1980097 -0.1980620 [265] -0.1981132 -0.1981632 -0.1982121 -0.1982599 -0.1983066 -0.1983521 [271] -0.1983966 -0.1984399 -0.1984821 -0.1985233 -0.1985633 -0.1986022 [277] -0.1986401 -0.1986768 -0.1987125 -0.1987471 -0.1987806 -0.1988131 [283] -0.1988444 -0.1988747 -0.1989040 -0.1989321 -0.1989592 -0.1989853 [289] -0.1990103 -0.1990343 -0.1990572 -0.1990790 -0.1990999 -0.1991197 [295] -0.1991384 -0.1991562 -0.1991729 -0.1991886 -0.1992033 -0.1992169 [301] -0.1992296 -0.1992412 -0.1992519 -0.1992615 -0.1992702 -0.1992779 [307] -0.1992845 -0.1992902 -0.1992949 -0.1992987 -0.1993014 -0.1993032 [313] -0.1993041 -0.1993039 -0.1993028 -0.1993008 -0.1992978 -0.1992939 [319] -0.1992890 -0.1992832 -0.1992764 -0.1992687 -0.1992601 -0.1992506 [325] -0.1992401 -0.1992288 -0.1992165 -0.1992033 -0.1991892 -0.1991742 [331] -0.1991583 -0.1991415 -0.1991239 -0.1991053 -0.1990859 -0.1990656 [337] -0.1990444 -0.1990223 -0.1989994 -0.1989756 -0.1989510 -0.1989255 [343] -0.1988992 -0.1988720 -0.1988440 -0.1988151 -0.1987855 -0.1987550 [349] -0.1987236 -0.1986915 -0.1986585 -0.1986247 -0.1985901 -0.1985547 [355] -0.1985185 -0.1984815 -0.1984437 -0.1984051 -0.1983658 -0.1983256 [361] -0.1982847 -0.1982430 -0.1982006 -0.1981574 -0.1981134 -0.1980686 [367] -0.1980232 -0.1979769 -0.1979299 -0.1978822 -0.1978338 -0.1977846 [373] -0.1977347 -0.1976840 -0.1976327 -0.1975806 -0.1975278 -0.1974743 [379] -0.1974202 -0.1973653 -0.1973097 -0.1972534 -0.1971964 -0.1971388 [385] -0.1970805 -0.1970215 -0.1969618 -0.1969014 -0.1968404 -0.1967788 [391] -0.1967165 -0.1966535 -0.1965899 -0.1965256 -0.1964607 -0.1963952 [397] -0.1963290 -0.1962622 -0.1961948 -0.1961268 -0.1960581 > mx [1] 0.1993041 > mxli [1] 1.12 > 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/1ivhr1194112708.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/2kz0l1194112708.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/3fenr1194112708.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 > 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/4iysm1194112710.tab") > > system("convert tmp/1ivhr1194112708.ps tmp/1ivhr1194112708.png") > system("convert tmp/2kz0l1194112708.ps tmp/2kz0l1194112708.png") > system("convert tmp/3fenr1194112708.ps tmp/3fenr1194112708.png") > > > proc.time() user system elapsed 1.832 0.822 1.963