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(119.5,125,145,105.3,116.9,120.1,88.9,78.4,114.6,113.3,117,99.6,99.4,101.9,115.2,108.5,113.8,121,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > x <- c(98.6,98,106.8,96.6,100.1,107.7,91.5,97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.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.5992544 0.5993141 0.5993735 0.5994329 0.5994921 0.5995512 0.5996102 [8] 0.5996690 0.5997277 0.5997863 0.5998448 0.5999031 0.5999613 0.6000194 [15] 0.6000774 0.6001352 0.6001929 0.6002505 0.6003079 0.6003652 0.6004224 [22] 0.6004795 0.6005364 0.6005932 0.6006499 0.6007064 0.6007629 0.6008192 [29] 0.6008753 0.6009314 0.6009873 0.6010431 0.6010987 0.6011543 0.6012097 [36] 0.6012649 0.6013201 0.6013751 0.6014300 0.6014847 0.6015394 0.6015939 [43] 0.6016482 0.6017025 0.6017566 0.6018106 0.6018644 0.6019182 0.6019717 [50] 0.6020252 0.6020786 0.6021318 0.6021848 0.6022378 0.6022906 0.6023433 [57] 0.6023959 0.6024483 0.6025006 0.6025528 0.6026048 0.6026567 0.6027085 [64] 0.6027602 0.6028117 0.6028631 0.6029144 0.6029655 0.6030165 0.6030674 [71] 0.6031181 0.6031688 0.6032192 0.6032696 0.6033198 0.6033699 0.6034199 [78] 0.6034697 0.6035194 0.6035690 0.6036184 0.6036677 0.6037169 0.6037659 [85] 0.6038149 0.6038637 0.6039123 0.6039608 0.6040092 0.6040575 0.6041056 [92] 0.6041536 0.6042015 0.6042492 0.6042968 0.6043443 0.6043917 0.6044389 [99] 0.6044859 0.6045329 0.6045797 0.6046264 0.6046730 0.6047194 0.6047657 [106] 0.6048118 0.6048579 0.6049038 0.6049495 0.6049951 0.6050406 0.6050860 [113] 0.6051313 0.6051764 0.6052213 0.6052662 0.6053109 0.6053555 0.6053999 [120] 0.6054442 0.6054884 0.6055324 0.6055764 0.6056201 0.6056638 0.6057073 [127] 0.6057507 0.6057939 0.6058371 0.6058800 0.6059229 0.6059656 0.6060082 [134] 0.6060507 0.6060930 0.6061352 0.6061772 0.6062192 0.6062610 0.6063026 [141] 0.6063442 0.6063856 0.6064268 0.6064679 0.6065089 0.6065498 0.6065905 [148] 0.6066311 0.6066716 0.6067119 0.6067521 0.6067922 0.6068321 0.6068719 [155] 0.6069116 0.6069511 0.6069905 0.6070298 0.6070689 0.6071079 0.6071468 [162] 0.6071855 0.6072241 0.6072626 0.6073009 0.6073391 0.6073771 0.6074151 [169] 0.6074529 0.6074905 0.6075281 0.6075655 0.6076027 0.6076398 0.6076768 [176] 0.6077137 0.6077504 0.6077870 0.6078235 0.6078598 0.6078960 0.6079321 [183] 0.6079680 0.6080038 0.6080394 0.6080749 0.6081103 0.6081456 0.6081807 [190] 0.6082157 0.6082505 0.6082853 0.6083199 0.6083543 0.6083886 0.6084228 [197] 0.6084568 0.6084908 0.6085245 0.6085582 0.6085917 0.6086251 0.6086583 [204] 0.6086914 0.6087244 0.6087573 0.6087900 0.6088225 0.6088550 0.6088873 [211] 0.6089194 0.6089515 0.6089834 0.6090152 0.6090468 0.6090783 0.6091097 [218] 0.6091409 0.6091720 0.6092029 0.6092338 0.6092645 0.6092950 0.6093255 [225] 0.6093557 0.6093859 0.6094159 0.6094458 0.6094756 0.6095052 0.6095347 [232] 0.6095640 0.6095932 0.6096223 0.6096513 0.6096801 0.6097088 0.6097373 [239] 0.6097657 0.6097940 0.6098221 0.6098501 0.6098780 0.6099058 0.6099334 [246] 0.6099608 0.6099882 0.6100154 0.6100424 0.6100694 0.6100962 0.6101228 [253] 0.6101494 0.6101758 0.6102020 0.6102282 0.6102542 0.6102800 0.6103057 [260] 0.6103313 0.6103568 0.6103821 0.6104073 0.6104324 0.6104573 0.6104821 [267] 0.6105067 0.6105312 0.6105556 0.6105799 0.6106040 0.6106279 0.6106518 [274] 0.6106755 0.6106991 0.6107225 0.6107458 0.6107690 0.6107921 0.6108150 [281] 0.6108377 0.6108604 0.6108829 0.6109053 0.6109275 0.6109496 0.6109716 [288] 0.6109934 0.6110151 0.6110367 0.6110581 0.6110794 0.6111006 0.6111216 [295] 0.6111425 0.6111633 0.6111839 0.6112044 0.6112247 0.6112450 0.6112651 [302] 0.6112850 0.6113049 0.6113245 0.6113441 0.6113635 0.6113828 0.6114020 [309] 0.6114210 0.6114399 0.6114587 0.6114773 0.6114958 0.6115141 0.6115324 [316] 0.6115504 0.6115684 0.6115862 0.6116039 0.6116215 0.6116389 0.6116562 [323] 0.6116733 0.6116904 0.6117072 0.6117240 0.6117406 0.6117571 0.6117735 [330] 0.6117897 0.6118058 0.6118217 0.6118376 0.6118533 0.6118688 0.6118842 [337] 0.6118995 0.6119147 0.6119297 0.6119446 0.6119594 0.6119740 0.6119885 [344] 0.6120029 0.6120171 0.6120312 0.6120452 0.6120590 0.6120727 0.6120863 [351] 0.6120997 0.6121130 0.6121262 0.6121392 0.6121521 0.6121649 0.6121775 [358] 0.6121900 0.6122024 0.6122146 0.6122267 0.6122387 0.6122506 0.6122623 [365] 0.6122739 0.6122853 0.6122966 0.6123078 0.6123189 0.6123298 0.6123406 [372] 0.6123512 0.6123618 0.6123722 0.6123824 0.6123926 0.6124026 0.6124124 [379] 0.6124222 0.6124318 0.6124412 0.6124506 0.6124598 0.6124689 0.6124778 [386] 0.6124866 0.6124953 0.6125039 0.6125123 0.6125206 0.6125288 0.6125368 [393] 0.6125447 0.6125524 0.6125601 0.6125676 0.6125750 0.6125822 0.6125893 [400] 0.6125963 0.6126032 > mx [1] 0.6126032 > 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/1k35k1227368475.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/2c9hh1227368475.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/39yel1227368475.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/4bmww1227368475.tab") > > system("convert tmp/1k35k1227368475.ps tmp/1k35k1227368475.png") > system("convert tmp/2c9hh1227368475.ps tmp/2c9hh1227368475.png") > system("convert tmp/39yel1227368475.ps tmp/39yel1227368475.png") > > > proc.time() user system elapsed 0.833 0.523 1.049