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(517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478) > x <- c(86,92.1,106.9,112.6,101.7,92,97.4,97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.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.2305338 -0.2305099 -0.2304860 -0.2304621 -0.2304382 -0.2304142 [7] -0.2303903 -0.2303663 -0.2303423 -0.2303182 -0.2302942 -0.2302701 [13] -0.2302460 -0.2302219 -0.2301978 -0.2301737 -0.2301495 -0.2301253 [19] -0.2301011 -0.2300769 -0.2300527 -0.2300284 -0.2300041 -0.2299798 [25] -0.2299555 -0.2299312 -0.2299069 -0.2298825 -0.2298581 -0.2298337 [31] -0.2298093 -0.2297849 -0.2297604 -0.2297359 -0.2297115 -0.2296869 [37] -0.2296624 -0.2296379 -0.2296133 -0.2295887 -0.2295641 -0.2295395 [43] -0.2295149 -0.2294903 -0.2294656 -0.2294409 -0.2294162 -0.2293915 [49] -0.2293668 -0.2293420 -0.2293173 -0.2292925 -0.2292677 -0.2292429 [55] -0.2292180 -0.2291932 -0.2291683 -0.2291434 -0.2291185 -0.2290936 [61] -0.2290687 -0.2290438 -0.2290188 -0.2289938 -0.2289688 -0.2289438 [67] -0.2289188 -0.2288938 -0.2288687 -0.2288436 -0.2288185 -0.2287934 [73] -0.2287683 -0.2287432 -0.2287180 -0.2286929 -0.2286677 -0.2286425 [79] -0.2286173 -0.2285921 -0.2285668 -0.2285416 -0.2285163 -0.2284910 [85] -0.2284657 -0.2284404 -0.2284151 -0.2283897 -0.2283644 -0.2283390 [91] -0.2283136 -0.2282882 -0.2282628 -0.2282374 -0.2282119 -0.2281865 [97] -0.2281610 -0.2281355 -0.2281100 -0.2280845 -0.2280590 -0.2280334 [103] -0.2280079 -0.2279823 -0.2279567 -0.2279312 -0.2279055 -0.2278799 [109] -0.2278543 -0.2278286 -0.2278030 -0.2277773 -0.2277516 -0.2277259 [115] -0.2277002 -0.2276745 -0.2276488 -0.2276230 -0.2275972 -0.2275715 [121] -0.2275457 -0.2275199 -0.2274941 -0.2274682 -0.2274424 -0.2274166 [127] -0.2273907 -0.2273648 -0.2273389 -0.2273130 -0.2272871 -0.2272612 [133] -0.2272353 -0.2272093 -0.2271834 -0.2271574 -0.2271314 -0.2271054 [139] -0.2270794 -0.2270534 -0.2270274 -0.2270014 -0.2269753 -0.2269493 [145] -0.2269232 -0.2268971 -0.2268710 -0.2268449 -0.2268188 -0.2267927 [151] -0.2267665 -0.2267404 -0.2267142 -0.2266881 -0.2266619 -0.2266357 [157] -0.2266095 -0.2265833 -0.2265571 -0.2265309 -0.2265046 -0.2264784 [163] -0.2264521 -0.2264258 -0.2263996 -0.2263733 -0.2263470 -0.2263207 [169] -0.2262944 -0.2262680 -0.2262417 -0.2262154 -0.2261890 -0.2261626 [175] -0.2261363 -0.2261099 -0.2260835 -0.2260571 -0.2260307 -0.2260043 [181] -0.2259778 -0.2259514 -0.2259250 -0.2258985 -0.2258721 -0.2258456 [187] -0.2258191 -0.2257926 -0.2257661 -0.2257396 -0.2257131 -0.2256866 [193] -0.2256601 -0.2256335 -0.2256070 -0.2255804 -0.2255539 -0.2255273 [199] -0.2255007 -0.2254741 -0.2254475 -0.2254210 -0.2253943 -0.2253677 [205] -0.2253411 -0.2253145 -0.2252878 -0.2252612 -0.2252346 -0.2252079 [211] -0.2251812 -0.2251546 -0.2251279 -0.2251012 -0.2250745 -0.2250478 [217] -0.2250211 -0.2249944 -0.2249677 -0.2249409 -0.2249142 -0.2248875 [223] -0.2248607 -0.2248340 -0.2248072 -0.2247805 -0.2247537 -0.2247269 [229] -0.2247001 -0.2246733 -0.2246465 -0.2246197 -0.2245929 -0.2245661 [235] -0.2245393 -0.2245125 -0.2244857 -0.2244588 -0.2244320 -0.2244051 [241] -0.2243783 -0.2243514 -0.2243246 -0.2242977 -0.2242708 -0.2242440 [247] -0.2242171 -0.2241902 -0.2241633 -0.2241364 -0.2241095 -0.2240826 [253] -0.2240557 -0.2240288 -0.2240019 -0.2239749 -0.2239480 -0.2239211 [259] -0.2238942 -0.2238672 -0.2238403 -0.2238133 -0.2237864 -0.2237594 [265] -0.2237324 -0.2237055 -0.2236785 -0.2236515 -0.2236246 -0.2235976 [271] -0.2235706 -0.2235436 -0.2235166 -0.2234896 -0.2234626 -0.2234356 [277] -0.2234086 -0.2233816 -0.2233546 -0.2233276 -0.2233006 -0.2232736 [283] -0.2232465 -0.2232195 -0.2231925 -0.2231655 -0.2231384 -0.2231114 [289] -0.2230843 -0.2230573 -0.2230303 -0.2230032 -0.2229762 -0.2229491 [295] -0.2229221 -0.2228950 -0.2228679 -0.2228409 -0.2228138 -0.2227867 [301] -0.2227597 -0.2227326 -0.2227055 -0.2226785 -0.2226514 -0.2226243 [307] -0.2225972 -0.2225702 -0.2225431 -0.2225160 -0.2224889 -0.2224618 [313] -0.2224347 -0.2224077 -0.2223806 -0.2223535 -0.2223264 -0.2222993 [319] -0.2222722 -0.2222451 -0.2222180 -0.2221909 -0.2221638 -0.2221367 [325] -0.2221096 -0.2220825 -0.2220554 -0.2220283 -0.2220012 -0.2219741 [331] -0.2219470 -0.2219199 -0.2218928 -0.2218657 -0.2218386 -0.2218115 [337] -0.2217844 -0.2217573 -0.2217302 -0.2217031 -0.2216760 -0.2216488 [343] -0.2216217 -0.2215946 -0.2215675 -0.2215404 -0.2215133 -0.2214862 [349] -0.2214591 -0.2214320 -0.2214049 -0.2213778 -0.2213507 -0.2213236 [355] -0.2212965 -0.2212694 -0.2212423 -0.2212152 -0.2211881 -0.2211610 [361] -0.2211340 -0.2211069 -0.2210798 -0.2210527 -0.2210256 -0.2209985 [367] -0.2209714 -0.2209443 -0.2209172 -0.2208902 -0.2208631 -0.2208360 [373] -0.2208089 -0.2207819 -0.2207548 -0.2207277 -0.2207006 -0.2206736 [379] -0.2206465 -0.2206194 -0.2205924 -0.2205653 -0.2205383 -0.2205112 [385] -0.2204842 -0.2204571 -0.2204301 -0.2204030 -0.2203760 -0.2203489 [391] -0.2203219 -0.2202948 -0.2202678 -0.2202408 -0.2202137 -0.2201867 [397] -0.2201597 -0.2201327 -0.2201057 -0.2200786 -0.2200516 > mx [1] 0.2305338 > 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/1n4i81226402591.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/29v5e1226402591.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/333zk1226402591.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/4ihzs1226402591.tab") > > system("convert tmp/1n4i81226402591.ps tmp/1n4i81226402591.png") > system("convert tmp/29v5e1226402591.ps tmp/29v5e1226402591.png") > system("convert tmp/333zk1226402591.ps tmp/333zk1226402591.png") > > > proc.time() user system elapsed 0.976 0.510 1.441