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(1,0.977281089,0.979482353,1.005380994,1.008888464,1.008525957,1.005260192,1.060829751,0.999383423,1.009254363,1.044799581,1.050986292,1.036344839,1.059934004,1.052997394,1.026608911,0.996986136,1.075171302,1.066166823,0.888888889,1.058148734,0.986853583,0.95567902,0.987910418,1.046408988,0.978080266,1.017902646,1.04936132,0.974308784,1.015256153,0.985529652,0.985944657,0.992426653,1.005707323,1.048141299,1.036135783,1.038985439,1.002768987,1.092927585,1.038878004,0.998014691,0.92420927,0.992305209,0.99728865,1.04279267,0.942694754,1.022346369,1.062814478,0.977143148,1.02370409,1.060050891,1.132741239,0.972112736,0.951039805,1.005226002,0.993113827,0.981907517,1.003928354,1.02725113,1.028478143) > x <- c(1,1.025329295,1.020678159,1.033110317,1.008323108,1.004214125,0.981390115,1.011776197,1.020785779,1.030195876,1.006094266,1.00558741,1.020838644,1.038698094,1.049470976,1.039822418,1.027510713,0.994269977,0.975754137,0.939243264,1.036830695,1.043402736,1.027918815,1.042422105,1.014795144,1.021701292,1.035661599,1.013215839,0.96765009,1.053773485,1.023019774,0.983912999,0.987328515,0.921031638,1.022360393,1.032291475,0.925584468,1.002801339,0.933881186,0.967873502,0.987481792,1.049863923,0.98533811,0.921945457,0.865376658,1.004758293,0.972205722,0.741920239,0.916567326,0.924733798,1.022857695,0.950446361,0.922186208,1.116384343,1.100609298,0.989074181,1.020314348,1.107483473,1.065343746,1.0286092) > #'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.1778236 -0.1778139 -0.1778042 -0.1777944 -0.1777846 -0.1777747 [7] -0.1777648 -0.1777549 -0.1777449 -0.1777349 -0.1777248 -0.1777147 [13] -0.1777046 -0.1776944 -0.1776841 -0.1776739 -0.1776636 -0.1776532 [19] -0.1776428 -0.1776324 -0.1776220 -0.1776115 -0.1776009 -0.1775903 [25] -0.1775797 -0.1775691 -0.1775584 -0.1775476 -0.1775369 -0.1775260 [31] -0.1775152 -0.1775043 -0.1774934 -0.1774824 -0.1774714 -0.1774604 [37] -0.1774493 -0.1774382 -0.1774270 -0.1774158 -0.1774046 -0.1773934 [43] -0.1773821 -0.1773707 -0.1773594 -0.1773479 -0.1773365 -0.1773250 [49] -0.1773135 -0.1773020 -0.1772904 -0.1772788 -0.1772671 -0.1772554 [55] -0.1772437 -0.1772319 -0.1772201 -0.1772083 -0.1771964 -0.1771845 [61] -0.1771726 -0.1771606 -0.1771486 -0.1771366 -0.1771245 -0.1771124 [67] -0.1771003 -0.1770881 -0.1770759 -0.1770637 -0.1770514 -0.1770391 [73] -0.1770268 -0.1770144 -0.1770020 -0.1769896 -0.1769771 -0.1769646 [79] -0.1769521 -0.1769395 -0.1769269 -0.1769143 -0.1769017 -0.1768890 [85] -0.1768763 -0.1768635 -0.1768508 -0.1768380 -0.1768251 -0.1768123 [91] -0.1767994 -0.1767864 -0.1767735 -0.1767605 -0.1767475 -0.1767344 [97] -0.1767214 -0.1767083 -0.1766951 -0.1766820 -0.1766688 -0.1766556 [103] -0.1766423 -0.1766291 -0.1766158 -0.1766025 -0.1765891 -0.1765757 [109] -0.1765623 -0.1765489 -0.1765354 -0.1765219 -0.1765084 -0.1764949 [115] -0.1764813 -0.1764677 -0.1764541 -0.1764404 -0.1764268 -0.1764131 [121] -0.1763993 -0.1763856 -0.1763718 -0.1763580 -0.1763442 -0.1763304 [127] -0.1763165 -0.1763026 -0.1762887 -0.1762747 -0.1762607 -0.1762468 [133] -0.1762327 -0.1762187 -0.1762046 -0.1761905 -0.1761764 -0.1761623 [139] -0.1761481 -0.1761340 -0.1761198 -0.1761055 -0.1760913 -0.1760770 [145] -0.1760627 -0.1760484 -0.1760341 -0.1760197 -0.1760054 -0.1759910 [151] -0.1759766 -0.1759621 -0.1759477 -0.1759332 -0.1759187 -0.1759042 [157] -0.1758896 -0.1758751 -0.1758605 -0.1758459 -0.1758313 -0.1758167 [163] -0.1758020 -0.1757873 -0.1757726 -0.1757579 -0.1757432 -0.1757285 [169] -0.1757137 -0.1756989 -0.1756841 -0.1756693 -0.1756545 -0.1756396 [175] -0.1756247 -0.1756099 -0.1755949 -0.1755800 -0.1755651 -0.1755501 [181] -0.1755352 -0.1755202 -0.1755052 -0.1754902 -0.1754751 -0.1754601 [187] -0.1754450 -0.1754299 -0.1754149 -0.1753997 -0.1753846 -0.1753695 [193] -0.1753543 -0.1753392 -0.1753240 -0.1753088 -0.1752936 -0.1752784 [199] -0.1752631 -0.1752479 -0.1752326 -0.1752174 -0.1752021 -0.1751868 [205] -0.1751715 -0.1751561 -0.1751408 -0.1751255 -0.1751101 -0.1750947 [211] -0.1750794 -0.1750640 -0.1750486 -0.1750331 -0.1750177 -0.1750023 [217] -0.1749868 -0.1749714 -0.1749559 -0.1749404 -0.1749249 -0.1749094 [223] -0.1748939 -0.1748784 -0.1748629 -0.1748474 -0.1748318 -0.1748163 [229] -0.1748007 -0.1747851 -0.1747695 -0.1747540 -0.1747384 -0.1747228 [235] -0.1747071 -0.1746915 -0.1746759 -0.1746603 -0.1746446 -0.1746290 [241] -0.1746133 -0.1745976 -0.1745820 -0.1745663 -0.1745506 -0.1745349 [247] -0.1745192 -0.1745035 -0.1744878 -0.1744721 -0.1744564 -0.1744407 [253] -0.1744249 -0.1744092 -0.1743935 -0.1743777 -0.1743620 -0.1743462 [259] -0.1743305 -0.1743147 -0.1742990 -0.1742832 -0.1742674 -0.1742516 [265] -0.1742359 -0.1742201 -0.1742043 -0.1741885 -0.1741727 -0.1741569 [271] -0.1741411 -0.1741253 -0.1741095 -0.1740937 -0.1740779 -0.1740621 [277] -0.1740463 -0.1740305 -0.1740147 -0.1739989 -0.1739831 -0.1739672 [283] -0.1739514 -0.1739356 -0.1739198 -0.1739040 -0.1738882 -0.1738724 [289] -0.1738565 -0.1738407 -0.1738249 -0.1738091 -0.1737933 -0.1737775 [295] -0.1737616 -0.1737458 -0.1737300 -0.1737142 -0.1736984 -0.1736826 [301] -0.1736668 -0.1736510 -0.1736352 -0.1736194 -0.1736036 -0.1735878 [307] -0.1735720 -0.1735562 -0.1735404 -0.1735246 -0.1735089 -0.1734931 [313] -0.1734773 -0.1734615 -0.1734458 -0.1734300 -0.1734142 -0.1733985 [319] -0.1733827 -0.1733670 -0.1733512 -0.1733355 -0.1733198 -0.1733040 [325] -0.1732883 -0.1732726 -0.1732569 -0.1732412 -0.1732255 -0.1732098 [331] -0.1731941 -0.1731784 -0.1731627 -0.1731470 -0.1731314 -0.1731157 [337] -0.1731000 -0.1730844 -0.1730688 -0.1730531 -0.1730375 -0.1730219 [343] -0.1730063 -0.1729906 -0.1729750 -0.1729595 -0.1729439 -0.1729283 [349] -0.1729127 -0.1728972 -0.1728816 -0.1728661 -0.1728505 -0.1728350 [355] -0.1728195 -0.1728040 -0.1727885 -0.1727730 -0.1727575 -0.1727420 [361] -0.1727266 -0.1727111 -0.1726957 -0.1726802 -0.1726648 -0.1726494 [367] -0.1726340 -0.1726186 -0.1726032 -0.1725878 -0.1725725 -0.1725571 [373] -0.1725418 -0.1725264 -0.1725111 -0.1724958 -0.1724805 -0.1724652 [379] -0.1724499 -0.1724347 -0.1724194 -0.1724042 -0.1723889 -0.1723737 [385] -0.1723585 -0.1723433 -0.1723281 -0.1723130 -0.1722978 -0.1722827 [391] -0.1722675 -0.1722524 -0.1722373 -0.1722222 -0.1722072 -0.1721921 [397] -0.1721770 -0.1721620 -0.1721470 -0.1721320 -0.1721170 > mx [1] 0.1778236 > 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/1hgrw1259507491.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/244561259507491.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/38yqi1259507491.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/429wc1259507491.tab") > > system("convert tmp/1hgrw1259507491.ps tmp/1hgrw1259507491.png") > system("convert tmp/244561259507491.ps tmp/244561259507491.png") > system("convert tmp/38yqi1259507491.ps tmp/38yqi1259507491.png") > > > proc.time() user system elapsed 0.779 0.498 0.911