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(581,597,587,536,524,537,536,533,528,516,502,506,518,534,528,478,469,490,493,508,517,514,510,527,542,565,555,499,511,526,532,549,561,557,566,588,620,626,620,573,573,574,580,590,593,597,595,612,628,629,621,569,567,573,584,589,591,595,594,611) > x <- c(103.5,104.6,118.6,106.3,110.7,121.6,107,107.6,125.6,113.5,129.2,130.9,104.7,115.2,124.5,112.3,127.5,120.6,117.5,117.7,120.4,125,131.6,121.1,114.2,112.1,127,116.8,112,129.7,113.6,115.7,119.5,125.8,129.6,128,112.8,101.6,123.9,118.8,109.1,130.6,112.4,111,116.2,119.8,117.2,127.3,107.7,97.5,120.1,110.6,111.3,119.8,105.5,108.7,128.7,119.5,121.1,128.4) > #'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.2406456 -0.2405762 -0.2405068 -0.2404375 -0.2403681 -0.2402988 [7] -0.2402294 -0.2401601 -0.2400908 -0.2400215 -0.2399522 -0.2398829 [13] -0.2398136 -0.2397443 -0.2396750 -0.2396057 -0.2395364 -0.2394672 [19] -0.2393979 -0.2393287 -0.2392595 -0.2391902 -0.2391210 -0.2390518 [25] -0.2389826 -0.2389134 -0.2388442 -0.2387750 -0.2387059 -0.2386367 [31] -0.2385675 -0.2384984 -0.2384293 -0.2383601 -0.2382910 -0.2382219 [37] -0.2381528 -0.2380837 -0.2380146 -0.2379455 -0.2378765 -0.2378074 [43] -0.2377384 -0.2376693 -0.2376003 -0.2375313 -0.2374623 -0.2373933 [49] -0.2373243 -0.2372553 -0.2371864 -0.2371174 -0.2370485 -0.2369795 [55] -0.2369106 -0.2368417 -0.2367728 -0.2367039 -0.2366350 -0.2365661 [61] -0.2364973 -0.2364284 -0.2363596 -0.2362907 -0.2362219 -0.2361531 [67] -0.2360843 -0.2360155 -0.2359468 -0.2358780 -0.2358092 -0.2357405 [73] -0.2356718 -0.2356031 -0.2355344 -0.2354657 -0.2353970 -0.2353283 [79] -0.2352597 -0.2351910 -0.2351224 -0.2350538 -0.2349851 -0.2349165 [85] -0.2348480 -0.2347794 -0.2347108 -0.2346423 -0.2345738 -0.2345052 [91] -0.2344367 -0.2343682 -0.2342998 -0.2342313 -0.2341628 -0.2340944 [97] -0.2340260 -0.2339575 -0.2338891 -0.2338208 -0.2337524 -0.2336840 [103] -0.2336157 -0.2335473 -0.2334790 -0.2334107 -0.2333424 -0.2332741 [109] -0.2332059 -0.2331376 -0.2330694 -0.2330012 -0.2329330 -0.2328648 [115] -0.2327966 -0.2327284 -0.2326603 -0.2325921 -0.2325240 -0.2324559 [121] -0.2323878 -0.2323198 -0.2322517 -0.2321837 -0.2321156 -0.2320476 [127] -0.2319796 -0.2319116 -0.2318437 -0.2317757 -0.2317078 -0.2316399 [133] -0.2315720 -0.2315041 -0.2314362 -0.2313683 -0.2313005 -0.2312327 [139] -0.2311649 -0.2310971 -0.2310293 -0.2309615 -0.2308938 -0.2308261 [145] -0.2307583 -0.2306907 -0.2306230 -0.2305553 -0.2304877 -0.2304200 [151] -0.2303524 -0.2302848 -0.2302173 -0.2301497 -0.2300822 -0.2300146 [157] -0.2299471 -0.2298796 -0.2298122 -0.2297447 -0.2296773 -0.2296098 [163] -0.2295424 -0.2294751 -0.2294077 -0.2293403 -0.2292730 -0.2292057 [169] -0.2291384 -0.2290711 -0.2290039 -0.2289366 -0.2288694 -0.2288022 [175] -0.2287350 -0.2286678 -0.2286007 -0.2285336 -0.2284665 -0.2283994 [181] -0.2283323 -0.2282652 -0.2281982 -0.2281312 -0.2280642 -0.2279972 [187] -0.2279302 -0.2278633 -0.2277964 -0.2277295 -0.2276626 -0.2275957 [193] -0.2275289 -0.2274621 -0.2273953 -0.2273285 -0.2272617 -0.2271950 [199] -0.2271282 -0.2270615 -0.2269949 -0.2269282 -0.2268615 -0.2267949 [205] -0.2267283 -0.2266617 -0.2265952 -0.2265286 -0.2264621 -0.2263956 [211] -0.2263291 -0.2262627 -0.2261962 -0.2261298 -0.2260634 -0.2259970 [217] -0.2259307 -0.2258643 -0.2257980 -0.2257317 -0.2256654 -0.2255992 [223] -0.2255330 -0.2254668 -0.2254006 -0.2253344 -0.2252683 -0.2252021 [229] -0.2251360 -0.2250700 -0.2250039 -0.2249379 -0.2248718 -0.2248059 [235] -0.2247399 -0.2246739 -0.2246080 -0.2245421 -0.2244762 -0.2244104 [241] -0.2243445 -0.2242787 -0.2242129 -0.2241472 -0.2240814 -0.2240157 [247] -0.2239500 -0.2238843 -0.2238186 -0.2237530 -0.2236874 -0.2236218 [253] -0.2235563 -0.2234907 -0.2234252 -0.2233597 -0.2232942 -0.2232288 [259] -0.2231634 -0.2230980 -0.2230326 -0.2229672 -0.2229019 -0.2228366 [265] -0.2227713 -0.2227060 -0.2226408 -0.2225756 -0.2225104 -0.2224452 [271] -0.2223801 -0.2223150 -0.2222499 -0.2221848 -0.2221198 -0.2220547 [277] -0.2219897 -0.2219248 -0.2218598 -0.2217949 -0.2217300 -0.2216651 [283] -0.2216003 -0.2215355 -0.2214707 -0.2214059 -0.2213411 -0.2212764 [289] -0.2212117 -0.2211470 -0.2210824 -0.2210178 -0.2209532 -0.2208886 [295] -0.2208240 -0.2207595 -0.2206950 -0.2206305 -0.2205661 -0.2205017 [301] -0.2204373 -0.2203729 -0.2203085 -0.2202442 -0.2201799 -0.2201157 [307] -0.2200514 -0.2199872 -0.2199230 -0.2198588 -0.2197947 -0.2197306 [313] -0.2196665 -0.2196024 -0.2195384 -0.2194744 -0.2194104 -0.2193464 [319] -0.2192825 -0.2192186 -0.2191547 -0.2190909 -0.2190271 -0.2189633 [325] -0.2188995 -0.2188358 -0.2187720 -0.2187083 -0.2186447 -0.2185810 [331] -0.2185174 -0.2184539 -0.2183903 -0.2183268 -0.2182633 -0.2181998 [337] -0.2181363 -0.2180729 -0.2180095 -0.2179462 -0.2178828 -0.2178195 [343] -0.2177562 -0.2176930 -0.2176298 -0.2175666 -0.2175034 -0.2174402 [349] -0.2173771 -0.2173140 -0.2172510 -0.2171879 -0.2171249 -0.2170620 [355] -0.2169990 -0.2169361 -0.2168732 -0.2168103 -0.2167475 -0.2166847 [361] -0.2166219 -0.2165592 -0.2164964 -0.2164338 -0.2163711 -0.2163085 [367] -0.2162458 -0.2161833 -0.2161207 -0.2160582 -0.2159957 -0.2159332 [373] -0.2158708 -0.2158084 -0.2157460 -0.2156837 -0.2156213 -0.2155591 [379] -0.2154968 -0.2154346 -0.2153724 -0.2153102 -0.2152480 -0.2151859 [385] -0.2151238 -0.2150618 -0.2149998 -0.2149378 -0.2148758 -0.2148139 [391] -0.2147519 -0.2146901 -0.2146282 -0.2145664 -0.2145046 -0.2144429 [397] -0.2143811 -0.2143194 -0.2142577 -0.2141961 -0.2141345 > mx [1] 0.2406456 > 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/1kakg1258116845.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/2dyxa1258116845.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/3u6r31258116845.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/4cip81258116845.tab") > > system("convert tmp/1kakg1258116845.ps tmp/1kakg1258116845.png") > system("convert tmp/2dyxa1258116845.ps tmp/2dyxa1258116845.png") > system("convert tmp/3u6r31258116845.ps tmp/3u6r31258116845.png") > > > proc.time() user system elapsed 0.774 0.490 1.164