R version 2.7.2 (2008-08-25) 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(88.3,88.6,91,91.5,95.4,98.7,99.9,98.6,100.3,100.2,100.4,101.4,103,109.1,111.4,114.1,121.8,127.6,129.9,128,123.5,124,127.4,127.6,128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207,206.6,210.6,211.1,215,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221,213.6,243.4,253.8,265.3,268.2,268.5,266.9) > x <- c(4.43,4.61,4.54,4.2,4.08,3.95,4.19,4.23,3.89,3.92,4.14,4.24,4.08,4.37,4.43,4.3,4.27,4.06,3.96,4.21,4.31,4.35,4.25,4.06,4,3.87,3.71,3.63,3.48,3.6,3.66,3.45,3.3,3.14,3.21,3.12,3.14,3.4,3.42,3.29,3.49,3.52,3.81,4.03,3.98,4.1,3.96,3.83,3.72,3.82,3.76,3.98,4.14,4,4.13,4.28,4.46,4.63,4.49,4.41,4.5,4.39,4.33,4.45,4.17,4.13,4.33,4.47,4.63,4.9) > #'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.2016443 0.2017324 0.2018206 0.2019088 0.2019971 0.2020854 0.2021737 [8] 0.2022621 0.2023505 0.2024389 0.2025274 0.2026160 0.2027045 0.2027931 [15] 0.2028818 0.2029705 0.2030592 0.2031480 0.2032368 0.2033256 0.2034145 [22] 0.2035034 0.2035924 0.2036814 0.2037704 0.2038595 0.2039486 0.2040377 [29] 0.2041269 0.2042161 0.2043054 0.2043947 0.2044840 0.2045734 0.2046628 [36] 0.2047522 0.2048417 0.2049312 0.2050208 0.2051104 0.2052000 0.2052897 [43] 0.2053794 0.2054691 0.2055589 0.2056487 0.2057386 0.2058284 0.2059184 [50] 0.2060083 0.2060983 0.2061883 0.2062784 0.2063685 0.2064586 0.2065488 [57] 0.2066390 0.2067292 0.2068195 0.2069098 0.2070002 0.2070905 0.2071809 [64] 0.2072714 0.2073619 0.2074524 0.2075429 0.2076335 0.2077241 0.2078148 [71] 0.2079054 0.2079962 0.2080869 0.2081777 0.2082685 0.2083594 0.2084502 [78] 0.2085412 0.2086321 0.2087231 0.2088141 0.2089051 0.2089962 0.2090873 [85] 0.2091785 0.2092696 0.2093608 0.2094521 0.2095433 0.2096346 0.2097260 [92] 0.2098173 0.2099087 0.2100002 0.2100916 0.2101831 0.2102746 0.2103662 [99] 0.2104578 0.2105494 0.2106410 0.2107327 0.2108244 0.2109161 0.2110079 [106] 0.2110997 0.2111915 0.2112833 0.2113752 0.2114671 0.2115591 0.2116510 [113] 0.2117430 0.2118351 0.2119271 0.2120192 0.2121113 0.2122035 0.2122956 [120] 0.2123878 0.2124800 0.2125723 0.2126646 0.2127569 0.2128492 0.2129416 [127] 0.2130340 0.2131264 0.2132189 0.2133113 0.2134038 0.2134964 0.2135889 [134] 0.2136815 0.2137741 0.2138667 0.2139594 0.2140521 0.2141448 0.2142375 [141] 0.2143303 0.2144231 0.2145159 0.2146088 0.2147016 0.2147945 0.2148874 [148] 0.2149804 0.2150734 0.2151664 0.2152594 0.2153524 0.2154455 0.2155386 [155] 0.2156317 0.2157248 0.2158180 0.2159112 0.2160044 0.2160976 0.2161909 [162] 0.2162842 0.2163775 0.2164708 0.2165642 0.2166576 0.2167510 0.2168444 [169] 0.2169378 0.2170313 0.2171248 0.2172183 0.2173118 0.2174054 0.2174990 [176] 0.2175926 0.2176862 0.2177798 0.2178735 0.2179672 0.2180609 0.2181546 [183] 0.2182483 0.2183421 0.2184359 0.2185297 0.2186235 0.2187174 0.2188113 [190] 0.2189052 0.2189991 0.2190930 0.2191870 0.2192809 0.2193749 0.2194689 [197] 0.2195630 0.2196570 0.2197511 0.2198452 0.2199393 0.2200334 0.2201275 [204] 0.2202217 0.2203159 0.2204101 0.2205043 0.2205985 0.2206927 0.2207870 [211] 0.2208813 0.2209756 0.2210699 0.2211643 0.2212586 0.2213530 0.2214474 [218] 0.2215418 0.2216362 0.2217306 0.2218251 0.2219195 0.2220140 0.2221085 [225] 0.2222030 0.2222976 0.2223921 0.2224867 0.2225812 0.2226758 0.2227704 [232] 0.2228651 0.2229597 0.2230544 0.2231490 0.2232437 0.2233384 0.2234331 [239] 0.2235278 0.2236226 0.2237173 0.2238121 0.2239068 0.2240016 0.2240964 [246] 0.2241912 0.2242861 0.2243809 0.2244758 0.2245706 0.2246655 0.2247604 [253] 0.2248553 0.2249502 0.2250451 0.2251401 0.2252350 0.2253300 0.2254250 [260] 0.2255199 0.2256149 0.2257099 0.2258050 0.2259000 0.2259950 0.2260901 [267] 0.2261851 0.2262802 0.2263753 0.2264704 0.2265654 0.2266606 0.2267557 [274] 0.2268508 0.2269459 0.2270411 0.2271362 0.2272314 0.2273266 0.2274217 [281] 0.2275169 0.2276121 0.2277073 0.2278025 0.2278978 0.2279930 0.2280882 [288] 0.2281835 0.2282787 0.2283740 0.2284692 0.2285645 0.2286598 0.2287551 [295] 0.2288503 0.2289456 0.2290409 0.2291362 0.2292316 0.2293269 0.2294222 [302] 0.2295175 0.2296129 0.2297082 0.2298036 0.2298989 0.2299943 0.2300896 [309] 0.2301850 0.2302804 0.2303758 0.2304711 0.2305665 0.2306619 0.2307573 [316] 0.2308527 0.2309481 0.2310435 0.2311389 0.2312343 0.2313297 0.2314251 [323] 0.2315206 0.2316160 0.2317114 0.2318068 0.2319023 0.2319977 0.2320931 [330] 0.2321885 0.2322840 0.2323794 0.2324749 0.2325703 0.2326657 0.2327612 [337] 0.2328566 0.2329521 0.2330475 0.2331430 0.2332384 0.2333338 0.2334293 [344] 0.2335247 0.2336202 0.2337156 0.2338111 0.2339065 0.2340019 0.2340974 [351] 0.2341928 0.2342883 0.2343837 0.2344791 0.2345746 0.2346700 0.2347654 [358] 0.2348609 0.2349563 0.2350517 0.2351471 0.2352425 0.2353380 0.2354334 [365] 0.2355288 0.2356242 0.2357196 0.2358150 0.2359104 0.2360058 0.2361012 [372] 0.2361966 0.2362919 0.2363873 0.2364827 0.2365781 0.2366734 0.2367688 [379] 0.2368641 0.2369595 0.2370548 0.2371502 0.2372455 0.2373408 0.2374361 [386] 0.2375315 0.2376268 0.2377221 0.2378174 0.2379127 0.2380079 0.2381032 [393] 0.2381985 0.2382938 0.2383890 0.2384843 0.2385795 0.2386747 0.2387700 [400] 0.2388652 0.2389604 > mx [1] 0.2389604 > 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/freestat/rcomp/tmp/1mhxd1226314714.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/freestat/rcomp/tmp/2qotq1226314714.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/freestat/rcomp/tmp/3j8vl1226314714.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/47m6a1226314714.tab") > > system("convert tmp/1mhxd1226314714.ps tmp/1mhxd1226314714.png") > system("convert tmp/2qotq1226314714.ps tmp/2qotq1226314714.png") > system("convert tmp/3j8vl1226314714.ps tmp/3j8vl1226314714.png") > > > proc.time() user system elapsed 1.470 0.791 2.217