R version 2.8.1 (2008-12-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(8.9,8.6,8.3,8.3,8.3,8.4,8.5,8.4,8.6,8.5,8.5,8.4,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.5,8.6,8.4,8.1,8,8,8,8,7.9,7.8,7.8,7.9,8.1,8,7.6,7.3,7,6.8,7,7.1,7.2,7.1,6.9,6.7,6.7,6.6,6.9,7.3,7.5,7.3,7.1,6.9,7.1,7.5,7.7,7.8,7.8,7.7,7.8,7.8,7.9) > x <- c(15836.8,17570.4,18252.1,16196.7,16643,17729,16446.1,15993.8,16373.5,17842.2,22321.5,22786.7,18274.1,22392.9,23899.3,21343.5,22952.3,21374.4,21164.1,20906.5,17877.4,20664.3,22160,19813.6,17735.4,19640.2,20844.4,19823.1,18594.6,21350.6,18574.1,18924.2,17343.4,19961.2,19932.1,19464.6,16165.4,17574.9,19795.4,19439.5,17170,21072.4,17751.8,17515.5,18040.3,19090.1,17746.5,19202.1,15141.6,16258.1,18586.5,17209.4,17838.7,19123.5,16583.6,15991.2,16704.4,17420.4,17872,17823.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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] 0.1791965 0.1793784 0.1795604 0.1797424 0.1799244 0.1801064 0.1802885 [8] 0.1804706 0.1806527 0.1808348 0.1810169 0.1811991 0.1813813 0.1815635 [15] 0.1817457 0.1819279 0.1821102 0.1822925 0.1824748 0.1826571 0.1828394 [22] 0.1830218 0.1832042 0.1833865 0.1835689 0.1837514 0.1839338 0.1841163 [29] 0.1842987 0.1844812 0.1846637 0.1848462 0.1850287 0.1852113 0.1853938 [36] 0.1855764 0.1857590 0.1859416 0.1861242 0.1863068 0.1864894 0.1866720 [43] 0.1868547 0.1870373 0.1872200 0.1874026 0.1875853 0.1877680 0.1879507 [50] 0.1881334 0.1883161 0.1884988 0.1886816 0.1888643 0.1890470 0.1892298 [57] 0.1894125 0.1895953 0.1897780 0.1899608 0.1901435 0.1903263 0.1905091 [64] 0.1906918 0.1908746 0.1910574 0.1912402 0.1914229 0.1916057 0.1917885 [71] 0.1919713 0.1921540 0.1923368 0.1925196 0.1927024 0.1928851 0.1930679 [78] 0.1932507 0.1934334 0.1936162 0.1937990 0.1939817 0.1941645 0.1943472 [85] 0.1945299 0.1947127 0.1948954 0.1950781 0.1952608 0.1954435 0.1956262 [92] 0.1958089 0.1959916 0.1961743 0.1963570 0.1965396 0.1967223 0.1969049 [99] 0.1970875 0.1972702 0.1974528 0.1976354 0.1978179 0.1980005 0.1981831 [106] 0.1983656 0.1985481 0.1987307 0.1989132 0.1990956 0.1992781 0.1994606 [113] 0.1996430 0.1998255 0.2000079 0.2001903 0.2003726 0.2005550 0.2007373 [120] 0.2009197 0.2011020 0.2012843 0.2014665 0.2016488 0.2018310 0.2020132 [127] 0.2021954 0.2023776 0.2025597 0.2027418 0.2029239 0.2031060 0.2032881 [134] 0.2034701 0.2036521 0.2038341 0.2040160 0.2041980 0.2043799 0.2045618 [141] 0.2047436 0.2049255 0.2051073 0.2052891 0.2054708 0.2056525 0.2058342 [148] 0.2060159 0.2061975 0.2063791 0.2065607 0.2067423 0.2069238 0.2071053 [155] 0.2072867 0.2074682 0.2076495 0.2078309 0.2080122 0.2081935 0.2083748 [162] 0.2085560 0.2087372 0.2089184 0.2090995 0.2092806 0.2094616 0.2096427 [169] 0.2098237 0.2100046 0.2101855 0.2103664 0.2105472 0.2107280 0.2109088 [176] 0.2110895 0.2112702 0.2114508 0.2116314 0.2118120 0.2119925 0.2121730 [183] 0.2123534 0.2125338 0.2127141 0.2128944 0.2130747 0.2132549 0.2134351 [190] 0.2136153 0.2137953 0.2139754 0.2141554 0.2143353 0.2145153 0.2146951 [197] 0.2148749 0.2150547 0.2152344 0.2154141 0.2155937 0.2157733 0.2159528 [204] 0.2161323 0.2163118 0.2164911 0.2166705 0.2168497 0.2170290 0.2172082 [211] 0.2173873 0.2175664 0.2177454 0.2179243 0.2181033 0.2182821 0.2184609 [218] 0.2186397 0.2188184 0.2189970 0.2191756 0.2193542 0.2195326 0.2197110 [225] 0.2198894 0.2200677 0.2202460 0.2204242 0.2206023 0.2207804 0.2209584 [232] 0.2211363 0.2213142 0.2214921 0.2216698 0.2218476 0.2220252 0.2222028 [239] 0.2223803 0.2225578 0.2227352 0.2229125 0.2230898 0.2232670 0.2234442 [246] 0.2236213 0.2237983 0.2239753 0.2241522 0.2243290 0.2245057 0.2246824 [253] 0.2248591 0.2250356 0.2252121 0.2253885 0.2255649 0.2257412 0.2259174 [260] 0.2260935 0.2262696 0.2264456 0.2266216 0.2267974 0.2269732 0.2271489 [267] 0.2273246 0.2275002 0.2276757 0.2278511 0.2280265 0.2282018 0.2283770 [274] 0.2285521 0.2287272 0.2289022 0.2290771 0.2292519 0.2294267 0.2296014 [281] 0.2297760 0.2299505 0.2301250 0.2302993 0.2304736 0.2306478 0.2308220 [288] 0.2309960 0.2311700 0.2313439 0.2315177 0.2316915 0.2318651 0.2320387 [295] 0.2322122 0.2323856 0.2325590 0.2327322 0.2329054 0.2330785 0.2332515 [302] 0.2334244 0.2335972 0.2337700 0.2339426 0.2341152 0.2342877 0.2344601 [309] 0.2346324 0.2348046 0.2349768 0.2351488 0.2353208 0.2354927 0.2356645 [316] 0.2358362 0.2360078 0.2361793 0.2363507 0.2365221 0.2366933 0.2368645 [323] 0.2370356 0.2372065 0.2373774 0.2375482 0.2377189 0.2378895 0.2380601 [330] 0.2382305 0.2384008 0.2385710 0.2387412 0.2389112 0.2390812 0.2392510 [337] 0.2394208 0.2395905 0.2397600 0.2399295 0.2400989 0.2402681 0.2404373 [344] 0.2406064 0.2407754 0.2409442 0.2411130 0.2412817 0.2414503 0.2416188 [351] 0.2417872 0.2419554 0.2421236 0.2422917 0.2424597 0.2426276 0.2427953 [358] 0.2429630 0.2431306 0.2432980 0.2434654 0.2436326 0.2437998 0.2439668 [365] 0.2441338 0.2443006 0.2444674 0.2446340 0.2448005 0.2449669 0.2451332 [372] 0.2452994 0.2454655 0.2456315 0.2457974 0.2459631 0.2461288 0.2462943 [379] 0.2464598 0.2466251 0.2467903 0.2469554 0.2471204 0.2472853 0.2474501 [386] 0.2476148 0.2477793 0.2479438 0.2481081 0.2482723 0.2484364 0.2486004 [393] 0.2487643 0.2489280 0.2490917 0.2492552 0.2494186 0.2495820 0.2497451 [400] 0.2499082 0.2500712 > mx [1] 0.2500712 > 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/rcomp/tmp/10f161257963869.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/rcomp/tmp/26ipt1257963869.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/rcomp/tmp/38gub1257963869.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/44hwl1257963869.tab") > > system("convert tmp/10f161257963869.ps tmp/10f161257963869.png") > system("convert tmp/26ipt1257963869.ps tmp/26ipt1257963869.png") > system("convert tmp/38gub1257963869.ps tmp/38gub1257963869.png") > > > proc.time() user system elapsed 0.830 0.770 1.474