R version 2.8.0 (2008-10-20) 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(93.4,101.1,114.2,104.8,113.3,118.2,83.6,73.9,99.5,97.7,103,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.6,101.2,105.9,126.3,111.9,108.9,127.2,94.2,85.7,116.2,107.2,110.5,112,104.4,112,132.8,110.8,128.7,136.8,94.8,88.8,123.2,125.3,122.7,125.8,116.3,118.6,142.1,127.9,132,152.4,110.8,99.1,134.9,133.2,131,133.9,119.9) > x <- c(109.6,103,111.6,106.3,97.9,108.8,103.9,101.2,122.9,123.9,111.7,120.9,99.6,103.3,119.4,106.5,101.9,124.6,106.5,107.8,127.4,120.1,118.5,127.7,107.7,104.5,118.8,110.3,109.6,119.1,96.5,106.7,126.3,116.2,118.8,115.2,110,111.4,129.6,108.1,117.8,122.9,100.6,111.8,127,128.6,124.8,118.5,114.7,112.6,128.7,111,115.8,126,111.1,113.2,120.1,130.6,124,119.4,116.7) > #'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.6463836 0.6464162 0.6464486 0.6464808 0.6465129 0.6465449 0.6465767 [8] 0.6466084 0.6466400 0.6466714 0.6467026 0.6467337 0.6467647 0.6467955 [15] 0.6468262 0.6468568 0.6468872 0.6469174 0.6469475 0.6469775 0.6470073 [22] 0.6470370 0.6470666 0.6470960 0.6471252 0.6471544 0.6471833 0.6472122 [29] 0.6472409 0.6472694 0.6472978 0.6473261 0.6473542 0.6473822 0.6474100 [36] 0.6474377 0.6474652 0.6474926 0.6475199 0.6475470 0.6475740 0.6476009 [43] 0.6476276 0.6476541 0.6476805 0.6477068 0.6477329 0.6477589 0.6477847 [50] 0.6478104 0.6478360 0.6478614 0.6478867 0.6479118 0.6479368 0.6479617 [57] 0.6479864 0.6480109 0.6480354 0.6480596 0.6480838 0.6481078 0.6481316 [64] 0.6481553 0.6481789 0.6482023 0.6482256 0.6482488 0.6482718 0.6482946 [71] 0.6483174 0.6483399 0.6483624 0.6483847 0.6484068 0.6484288 0.6484507 [78] 0.6484724 0.6484940 0.6485155 0.6485368 0.6485579 0.6485790 0.6485999 [85] 0.6486206 0.6486412 0.6486617 0.6486820 0.6487021 0.6487222 0.6487421 [92] 0.6487618 0.6487814 0.6488009 0.6488202 0.6488394 0.6488585 0.6488774 [99] 0.6488962 0.6489148 0.6489333 0.6489516 0.6489698 0.6489879 0.6490058 [106] 0.6490236 0.6490412 0.6490587 0.6490761 0.6490933 0.6491104 0.6491273 [113] 0.6491441 0.6491608 0.6491773 0.6491937 0.6492099 0.6492260 0.6492420 [120] 0.6492578 0.6492735 0.6492890 0.6493044 0.6493197 0.6493348 0.6493498 [127] 0.6493646 0.6493793 0.6493939 0.6494083 0.6494226 0.6494367 0.6494507 [134] 0.6494646 0.6494783 0.6494919 0.6495054 0.6495187 0.6495318 0.6495449 [141] 0.6495578 0.6495705 0.6495831 0.6495956 0.6496079 0.6496201 0.6496322 [148] 0.6496441 0.6496559 0.6496675 0.6496790 0.6496904 0.6497016 0.6497127 [155] 0.6497236 0.6497345 0.6497451 0.6497557 0.6497661 0.6497763 0.6497864 [162] 0.6497964 0.6498063 0.6498160 0.6498255 0.6498350 0.6498442 0.6498534 [169] 0.6498624 0.6498713 0.6498800 0.6498886 0.6498971 0.6499054 0.6499136 [176] 0.6499217 0.6499296 0.6499374 0.6499450 0.6499525 0.6499599 0.6499671 [183] 0.6499742 0.6499812 0.6499880 0.6499947 0.6500012 0.6500076 0.6500139 [190] 0.6500201 0.6500261 0.6500319 0.6500377 0.6500433 0.6500487 0.6500540 [197] 0.6500592 0.6500643 0.6500692 0.6500740 0.6500786 0.6500831 0.6500875 [204] 0.6500917 0.6500958 0.6500998 0.6501036 0.6501073 0.6501108 0.6501143 [211] 0.6501176 0.6501207 0.6501237 0.6501266 0.6501294 0.6501320 0.6501344 [218] 0.6501368 0.6501390 0.6501411 0.6501430 0.6501448 0.6501465 0.6501480 [225] 0.6501494 0.6501507 0.6501518 0.6501528 0.6501537 0.6501544 0.6501550 [232] 0.6501555 0.6501558 0.6501560 0.6501561 0.6501560 0.6501558 0.6501555 [239] 0.6501550 0.6501544 0.6501537 0.6501528 0.6501518 0.6501506 0.6501494 [246] 0.6501480 0.6501464 0.6501448 0.6501430 0.6501410 0.6501390 0.6501368 [253] 0.6501345 0.6501320 0.6501294 0.6501267 0.6501238 0.6501208 0.6501177 [260] 0.6501145 0.6501111 0.6501076 0.6501039 0.6501001 0.6500962 0.6500922 [267] 0.6500880 0.6500837 0.6500793 0.6500747 0.6500700 0.6500652 0.6500602 [274] 0.6500551 0.6500499 0.6500446 0.6500391 0.6500335 0.6500277 0.6500219 [281] 0.6500159 0.6500097 0.6500035 0.6499971 0.6499906 0.6499839 0.6499771 [288] 0.6499702 0.6499632 0.6499560 0.6499487 0.6499413 0.6499338 0.6499261 [295] 0.6499183 0.6499103 0.6499022 0.6498940 0.6498857 0.6498773 0.6498687 [302] 0.6498600 0.6498511 0.6498421 0.6498330 0.6498238 0.6498145 0.6498050 [309] 0.6497954 0.6497856 0.6497758 0.6497658 0.6497557 0.6497454 0.6497350 [316] 0.6497245 0.6497139 0.6497032 0.6496923 0.6496813 0.6496701 0.6496589 [323] 0.6496475 0.6496360 0.6496243 0.6496126 0.6496007 0.6495886 0.6495765 [330] 0.6495642 0.6495518 0.6495393 0.6495266 0.6495139 0.6495010 0.6494879 [337] 0.6494748 0.6494615 0.6494481 0.6494346 0.6494209 0.6494072 0.6493933 [344] 0.6493792 0.6493651 0.6493508 0.6493364 0.6493219 0.6493072 0.6492925 [351] 0.6492776 0.6492626 0.6492474 0.6492321 0.6492168 0.6492012 0.6491856 [358] 0.6491698 0.6491540 0.6491380 0.6491218 0.6491056 0.6490892 0.6490727 [365] 0.6490561 0.6490393 0.6490225 0.6490055 0.6489884 0.6489711 0.6489538 [372] 0.6489363 0.6489187 0.6489010 0.6488831 0.6488652 0.6488471 0.6488289 [379] 0.6488106 0.6487921 0.6487735 0.6487548 0.6487360 0.6487171 0.6486980 [386] 0.6486789 0.6486596 0.6486402 0.6486206 0.6486010 0.6485812 0.6485613 [393] 0.6485413 0.6485211 0.6485009 0.6484805 0.6484600 0.6484394 0.6484187 [400] 0.6483978 0.6483769 > mx [1] 0.6501561 > mxli [1] 0.34 > 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/1nt891227560125.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/2ciuh1227560125.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/3uj131227560125.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/4w8je1227560126.tab") > > system("convert tmp/1nt891227560125.ps tmp/1nt891227560125.png") > system("convert tmp/2ciuh1227560125.ps tmp/2ciuh1227560125.png") > system("convert tmp/3uj131227560125.ps tmp/3uj131227560125.png") > > > proc.time() user system elapsed 0.800 0.510 0.932