R version 2.7.0 (2008-04-22) 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. > y <- c(85.0,95.9,108.9,96.2,100.1,105.7,64.5,66.8,110.3,96.1,102.5,97.6,83.6,86.5,96.0,91.1,87.2,84.5,59.2,61.5,98.8,97.9,92.7,84.2,74.5,79.7,86.8,79.8,87.0,91.4,58.7,62.8,87.9,90.4,80.6,73.5,71.4,70.6,78.3,76.0,77.4,80.9,63.4,58.1,88.2,81.2,84.9,76.4,71.5,76.1,82.9,78.0,82.0,84.7,55.7,59.5,83.2,87.6,76.2,76.4,68.3,70.0,76.3,70.9,72.4,80.1,57.4,62.7,82.6,88.9,80.4,72.0,69.4,69.2,77.3,79.4,78.6,76.1,61.8,59.4,78.1) > x <- c(97.7,101.5,119.6,108.1,117.8,125.5,89.2,92.3,104.6,122.8,96.0,94.6,93.3,101.1,114.2,104.7,113.3,118.2,83.6,73.9,99.5,97.7,103.0,106.3,92.2,101.8,122.8,111.8,106.3,121.5,81.9,85.4,110.9,117.3,106.3,105.5,101.3,105.9,126.3,111.9,108.9,127.2,94.2,85.7,116.2,107.2,110.6,112.0,104.5,112.0,132.8,110.8,128.7,136.8,94.9,88.8,123.2,125.3,122.7,125.7,116.3,118.7,142.0,127.9,131.9,152.3,110.8,99.1,135.0,133.2,131.0,133.9,119.9,136.9,148.9,145.1,142.4,159.6,120.7,109.0,142.0) > #'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.2999787 0.2996725 0.2993658 0.2990587 0.2987511 0.2984430 0.2981345 [8] 0.2978255 0.2975160 0.2972061 0.2968958 0.2965849 0.2962737 0.2959619 [15] 0.2956498 0.2953372 0.2950241 0.2947106 0.2943967 0.2940823 0.2937675 [22] 0.2934522 0.2931365 0.2928204 0.2925039 0.2921869 0.2918695 0.2915517 [29] 0.2912334 0.2909147 0.2905957 0.2902762 0.2899562 0.2896359 0.2893152 [36] 0.2889940 0.2886725 0.2883505 0.2880281 0.2877053 0.2873822 0.2870586 [43] 0.2867346 0.2864103 0.2860855 0.2857604 0.2854349 0.2851089 0.2847826 [50] 0.2844560 0.2841289 0.2838015 0.2834736 0.2831454 0.2828169 0.2824879 [57] 0.2821586 0.2818289 0.2814989 0.2811685 0.2808377 0.2805066 0.2801751 [64] 0.2798433 0.2795111 0.2791785 0.2788456 0.2785124 0.2781788 0.2778448 [71] 0.2775105 0.2771759 0.2768410 0.2765057 0.2761700 0.2758341 0.2754978 [78] 0.2751612 0.2748242 0.2744869 0.2741493 0.2738114 0.2734732 0.2731346 [85] 0.2727957 0.2724566 0.2721171 0.2717773 0.2714372 0.2710967 0.2707560 [92] 0.2704150 0.2700737 0.2697321 0.2693901 0.2690479 0.2687054 0.2683627 [99] 0.2680196 0.2676762 0.2673326 0.2669886 0.2666444 0.2663000 0.2659552 [106] 0.2656102 0.2652649 0.2649193 0.2645734 0.2642273 0.2638810 0.2635343 [113] 0.2631874 0.2628403 0.2624929 0.2621452 0.2617973 0.2614491 0.2611007 [120] 0.2607521 0.2604032 0.2600540 0.2597047 0.2593550 0.2590052 0.2586551 [127] 0.2583048 0.2579542 0.2576034 0.2572524 0.2569012 0.2565497 0.2561981 [134] 0.2558462 0.2554941 0.2551417 0.2547892 0.2544365 0.2540835 0.2537303 [141] 0.2533770 0.2530234 0.2526697 0.2523157 0.2519615 0.2516072 0.2512526 [148] 0.2508979 0.2505430 0.2501878 0.2498325 0.2494771 0.2491214 0.2487656 [155] 0.2484095 0.2480533 0.2476970 0.2473404 0.2469837 0.2466269 0.2462698 [162] 0.2459126 0.2455553 0.2451977 0.2448401 0.2444822 0.2441243 0.2437661 [169] 0.2434078 0.2430494 0.2426908 0.2423321 0.2419732 0.2416142 0.2412551 [176] 0.2408958 0.2405364 0.2401768 0.2398172 0.2394574 0.2390974 0.2387374 [183] 0.2383772 0.2380169 0.2376565 0.2372960 0.2369353 0.2365746 0.2362137 [190] 0.2358527 0.2354917 0.2351305 0.2347692 0.2344078 0.2340463 0.2336847 [197] 0.2333230 0.2329613 0.2325994 0.2322374 0.2318754 0.2315133 0.2311511 [204] 0.2307888 0.2304264 0.2300639 0.2297014 0.2293388 0.2289761 0.2286134 [211] 0.2282505 0.2278877 0.2275247 0.2271617 0.2267986 0.2264355 0.2260723 [218] 0.2257090 0.2253457 0.2249824 0.2246190 0.2242555 0.2238920 0.2235285 [225] 0.2231649 0.2228013 0.2224376 0.2220739 0.2217101 0.2213464 0.2209826 [232] 0.2206187 0.2202549 0.2198910 0.2195271 0.2191631 0.2187991 0.2184352 [239] 0.2180712 0.2177072 0.2173431 0.2169791 0.2166150 0.2162510 0.2158869 [246] 0.2155229 0.2151588 0.2147947 0.2144306 0.2140666 0.2137025 0.2133384 [253] 0.2129744 0.2126103 0.2122463 0.2118823 0.2115183 0.2111543 0.2107903 [260] 0.2104264 0.2100624 0.2096985 0.2093346 0.2089708 0.2086069 0.2082431 [267] 0.2078794 0.2075156 0.2071519 0.2067883 0.2064247 0.2060611 0.2056975 [274] 0.2053340 0.2049706 0.2046072 0.2042438 0.2038805 0.2035173 0.2031541 [281] 0.2027909 0.2024278 0.2020648 0.2017018 0.2013389 0.2009761 0.2006133 [288] 0.2002506 0.1998879 0.1995254 0.1991629 0.1988004 0.1984381 0.1980758 [295] 0.1977136 0.1973515 0.1969895 0.1966275 0.1962656 0.1959039 0.1955422 [302] 0.1951806 0.1948191 0.1944576 0.1940963 0.1937351 0.1933739 0.1930129 [309] 0.1926520 0.1922911 0.1919304 0.1915698 0.1912093 0.1908489 0.1904886 [316] 0.1901284 0.1897683 0.1894083 0.1890485 0.1886888 0.1883292 0.1879697 [323] 0.1876103 0.1872511 0.1868919 0.1865330 0.1861741 0.1858154 0.1854567 [330] 0.1850983 0.1847399 0.1843817 0.1840237 0.1836657 0.1833080 0.1829503 [337] 0.1825928 0.1822354 0.1818782 0.1815212 0.1811642 0.1808075 0.1804509 [344] 0.1800944 0.1797381 0.1793819 0.1790259 0.1786701 0.1783144 0.1779589 [351] 0.1776035 0.1772483 0.1768933 0.1765384 0.1761837 0.1758292 0.1754748 [358] 0.1751206 0.1747666 0.1744128 0.1740591 0.1737056 0.1733523 0.1729992 [365] 0.1726463 0.1722935 0.1719409 0.1715885 0.1712363 0.1708843 0.1705325 [372] 0.1701808 0.1698294 0.1694781 0.1691271 0.1687762 0.1684255 0.1680751 [379] 0.1677248 0.1673747 0.1670249 0.1666752 0.1663257 0.1659765 0.1656274 [386] 0.1652786 0.1649300 0.1645816 0.1642333 0.1638853 0.1635376 0.1631900 [393] 0.1628426 0.1624955 0.1621486 0.1618019 0.1614554 0.1611092 0.1607632 [400] 0.1604174 0.1600718 > mx [1] 0.2999787 > 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/1wfyx1228922212.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/2wwoc1228922212.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/31unp1228922212.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/487ru1228922212.tab") > > system("convert tmp/1wfyx1228922212.ps tmp/1wfyx1228922212.png") > system("convert tmp/2wwoc1228922212.ps tmp/2wwoc1228922212.png") > system("convert tmp/31unp1228922212.ps tmp/31unp1228922212.png") > > > proc.time() user system elapsed 1.880 0.829 2.013