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(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) > x <- 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) > #'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.5713099 0.5715754 0.5718401 0.5721039 0.5723668 0.5726289 0.5728901 [8] 0.5731504 0.5734099 0.5736685 0.5739263 0.5741831 0.5744391 0.5746943 [15] 0.5749485 0.5752019 0.5754544 0.5757061 0.5759569 0.5762067 0.5764558 [22] 0.5767039 0.5769512 0.5771976 0.5774431 0.5776877 0.5779315 0.5781743 [29] 0.5784163 0.5786574 0.5788977 0.5791370 0.5793755 0.5796131 0.5798498 [36] 0.5800856 0.5803205 0.5805545 0.5807877 0.5810199 0.5812513 0.5814818 [43] 0.5817114 0.5819401 0.5821679 0.5823949 0.5826209 0.5828460 0.5830703 [50] 0.5832937 0.5835161 0.5837377 0.5839584 0.5841782 0.5843971 0.5846151 [57] 0.5848322 0.5850484 0.5852637 0.5854782 0.5856917 0.5859043 0.5861160 [64] 0.5863269 0.5865368 0.5867459 0.5869540 0.5871612 0.5873676 0.5875730 [71] 0.5877776 0.5879812 0.5881840 0.5883858 0.5885868 0.5887868 0.5889860 [78] 0.5891842 0.5893815 0.5895780 0.5897735 0.5899682 0.5901619 0.5903547 [85] 0.5905467 0.5907377 0.5909278 0.5911170 0.5913054 0.5914928 0.5916793 [92] 0.5918649 0.5920496 0.5922334 0.5924163 0.5925984 0.5927794 0.5929596 [99] 0.5931389 0.5933173 0.5934948 0.5936714 0.5938471 0.5940219 0.5941957 [106] 0.5943687 0.5945408 0.5947119 0.5948822 0.5950515 0.5952200 0.5953875 [113] 0.5955542 0.5957199 0.5958848 0.5960487 0.5962118 0.5963739 0.5965351 [120] 0.5966954 0.5968549 0.5970134 0.5971710 0.5973277 0.5974836 0.5976385 [127] 0.5977925 0.5979456 0.5980978 0.5982491 0.5983996 0.5985491 0.5986977 [134] 0.5988454 0.5989922 0.5991381 0.5992832 0.5994273 0.5995705 0.5997128 [141] 0.5998542 0.5999948 0.6001344 0.6002731 0.6004109 0.6005479 0.6006839 [148] 0.6008191 0.6009533 0.6010867 0.6012191 0.6013507 0.6014814 0.6016111 [155] 0.6017400 0.6018680 0.6019951 0.6021213 0.6022466 0.6023710 0.6024945 [162] 0.6026172 0.6027389 0.6028598 0.6029797 0.6030988 0.6032170 0.6033343 [169] 0.6034507 0.6035662 0.6036809 0.6037946 0.6039075 0.6040195 0.6041306 [176] 0.6042408 0.6043501 0.6044585 0.6045661 0.6046728 0.6047785 0.6048835 [183] 0.6049875 0.6050906 0.6051929 0.6052943 0.6053948 0.6054944 0.6055932 [190] 0.6056910 0.6057880 0.6058842 0.6059794 0.6060738 0.6061673 0.6062599 [197] 0.6063516 0.6064425 0.6065325 0.6066217 0.6067099 0.6067973 0.6068838 [204] 0.6069695 0.6070543 0.6071382 0.6072212 0.6073034 0.6073847 0.6074652 [211] 0.6075448 0.6076235 0.6077014 0.6077784 0.6078545 0.6079298 0.6080042 [218] 0.6080777 0.6081504 0.6082223 0.6082933 0.6083634 0.6084326 0.6085011 [225] 0.6085686 0.6086353 0.6087012 0.6087662 0.6088303 0.6088936 0.6089561 [232] 0.6090177 0.6090784 0.6091383 0.6091974 0.6092556 0.6093129 0.6093695 [239] 0.6094251 0.6094800 0.6095340 0.6095871 0.6096394 0.6096909 0.6097415 [246] 0.6097913 0.6098403 0.6098884 0.6099357 0.6099821 0.6100277 0.6100725 [253] 0.6101164 0.6101596 0.6102018 0.6102433 0.6102839 0.6103237 0.6103627 [260] 0.6104009 0.6104382 0.6104747 0.6105103 0.6105452 0.6105792 0.6106124 [267] 0.6106448 0.6106764 0.6107072 0.6107371 0.6107662 0.6107945 0.6108220 [274] 0.6108487 0.6108745 0.6108996 0.6109238 0.6109473 0.6109699 0.6109917 [281] 0.6110127 0.6110329 0.6110523 0.6110709 0.6110887 0.6111057 0.6111219 [288] 0.6111373 0.6111519 0.6111657 0.6111787 0.6111909 0.6112023 0.6112129 [295] 0.6112227 0.6112318 0.6112400 0.6112474 0.6112541 0.6112600 0.6112651 [302] 0.6112694 0.6112729 0.6112756 0.6112776 0.6112787 0.6112791 0.6112787 [309] 0.6112775 0.6112756 0.6112729 0.6112694 0.6112651 0.6112601 0.6112542 [316] 0.6112476 0.6112403 0.6112322 0.6112233 0.6112136 0.6112032 0.6111920 [323] 0.6111800 0.6111673 0.6111538 0.6111396 0.6111246 0.6111088 0.6110923 [330] 0.6110750 0.6110570 0.6110382 0.6110187 0.6109984 0.6109774 0.6109556 [337] 0.6109331 0.6109098 0.6108858 0.6108610 0.6108355 0.6108092 0.6107823 [344] 0.6107545 0.6107261 0.6106968 0.6106669 0.6106362 0.6106048 0.6105727 [351] 0.6105398 0.6105062 0.6104718 0.6104368 0.6104010 0.6103645 0.6103272 [358] 0.6102892 0.6102506 0.6102111 0.6101710 0.6101302 0.6100886 0.6100463 [365] 0.6100033 0.6099596 0.6099152 0.6098700 0.6098242 0.6097776 0.6097303 [372] 0.6096824 0.6096337 0.6095843 0.6095342 0.6094834 0.6094319 0.6093798 [379] 0.6093269 0.6092733 0.6092190 0.6091640 0.6091084 0.6090520 0.6089949 [386] 0.6089372 0.6088788 0.6088197 0.6087598 0.6086994 0.6086382 0.6085763 [393] 0.6085138 0.6084506 0.6083867 0.6083221 0.6082569 0.6081909 0.6081243 [400] 0.6080571 0.6079891 > mx [1] 0.6112791 > mxli [1] 1.06 > 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/1prad1226428242.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/24z2v1226428242.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/36xrj1226428242.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/4dvh51226428242.tab") > > system("convert tmp/1prad1226428242.ps tmp/1prad1226428242.png") > system("convert tmp/24z2v1226428242.ps tmp/24z2v1226428242.png") > system("convert tmp/36xrj1226428242.ps tmp/36xrj1226428242.png") > > > proc.time() user system elapsed 1.244 0.828 1.465