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(105.15,105.24,105.57,105.62,106.17,106.27,106.41,106.94,107.16,107.32,107.32,107.35,107.55,107.87,108.37,108.38,107.92,108.03,108.14,108.3,108.64,108.66,109.04,109.03,109.03,109.54,109.75,109.83,109.65,109.82,109.95,110.12,110.15,110.21,109.99,110.14,110.14,110.81,110.97,110.99,109.73,109.81,110.02,110.18,110.21,110.25,110.36,110.51,110.6,110.95,111.18,111.19,111.69,111.7,111.83,111.77,111.73,112.01,111.86,112.04) > x <- c(107.06,109.98,112.64,112.89,112.9,112.9,112.91,112.99,113.01,113,113.07,113.07,113.21,114.13,114.59,114.88,115.3,115.33,115.36,115.41,115.43,115.43,115.43,115.43,115.56,115.88,116.02,116.09,116.28,116.28,116.28,116.25,116.07,116.08,116.07,115.92,116.07,117.22,117.75,117.78,117.78,117.81,117.81,117.74,117.75,117.76,117.76,117.75,117.8,118.09,118.95,119.03,118.9,118.9,118.9,118.87,118.88,119.36,119.39,119.47) > #'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.9372272 0.9372613 0.9372954 0.9373295 0.9373635 0.9373975 0.9374315 [8] 0.9374654 0.9374993 0.9375331 0.9375669 0.9376007 0.9376344 0.9376681 [15] 0.9377017 0.9377353 0.9377688 0.9378024 0.9378358 0.9378693 0.9379027 [22] 0.9379360 0.9379693 0.9380026 0.9380358 0.9380690 0.9381022 0.9381353 [29] 0.9381684 0.9382014 0.9382344 0.9382673 0.9383002 0.9383331 0.9383659 [36] 0.9383987 0.9384315 0.9384642 0.9384969 0.9385295 0.9385621 0.9385947 [43] 0.9386272 0.9386596 0.9386921 0.9387245 0.9387568 0.9387891 0.9388214 [50] 0.9388537 0.9388858 0.9389180 0.9389501 0.9389822 0.9390142 0.9390462 [57] 0.9390782 0.9391101 0.9391420 0.9391738 0.9392056 0.9392374 0.9392691 [64] 0.9393008 0.9393324 0.9393640 0.9393956 0.9394271 0.9394586 0.9394900 [71] 0.9395214 0.9395528 0.9395841 0.9396154 0.9396466 0.9396779 0.9397090 [78] 0.9397401 0.9397712 0.9398023 0.9398333 0.9398643 0.9398952 0.9399261 [85] 0.9399569 0.9399877 0.9400185 0.9400493 0.9400800 0.9401106 0.9401412 [92] 0.9401718 0.9402023 0.9402328 0.9402633 0.9402937 0.9403241 0.9403544 [99] 0.9403847 0.9404150 0.9404452 0.9404754 0.9405056 0.9405357 0.9405657 [106] 0.9405958 0.9406258 0.9406557 0.9406856 0.9407155 0.9407453 0.9407751 [113] 0.9408049 0.9408346 0.9408643 0.9408939 0.9409235 0.9409531 0.9409826 [120] 0.9410121 0.9410416 0.9410710 0.9411003 0.9411297 0.9411590 0.9411882 [127] 0.9412174 0.9412466 0.9412757 0.9413048 0.9413339 0.9413629 0.9413919 [134] 0.9414209 0.9414498 0.9414786 0.9415075 0.9415362 0.9415650 0.9415937 [141] 0.9416224 0.9416510 0.9416796 0.9417082 0.9417367 0.9417652 0.9417936 [148] 0.9418220 0.9418504 0.9418787 0.9419070 0.9419353 0.9419635 0.9419916 [155] 0.9420198 0.9420479 0.9420759 0.9421040 0.9421319 0.9421599 0.9421878 [162] 0.9422157 0.9422435 0.9422713 0.9422990 0.9423268 0.9423544 0.9423821 [169] 0.9424097 0.9424372 0.9424648 0.9424923 0.9425197 0.9425471 0.9425745 [176] 0.9426018 0.9426291 0.9426564 0.9426836 0.9427108 0.9427379 0.9427650 [183] 0.9427921 0.9428191 0.9428461 0.9428731 0.9429000 0.9429269 0.9429537 [190] 0.9429805 0.9430073 0.9430340 0.9430607 0.9430874 0.9431140 0.9431406 [197] 0.9431671 0.9431936 0.9432201 0.9432465 0.9432729 0.9432993 0.9433256 [204] 0.9433518 0.9433781 0.9434043 0.9434305 0.9434566 0.9434827 0.9435087 [211] 0.9435347 0.9435607 0.9435867 0.9436126 0.9436384 0.9436642 0.9436900 [218] 0.9437158 0.9437415 0.9437672 0.9437928 0.9438184 0.9438440 0.9438695 [225] 0.9438950 0.9439205 0.9439459 0.9439713 0.9439966 0.9440219 0.9440472 [232] 0.9440724 0.9440976 0.9441227 0.9441479 0.9441729 0.9441980 0.9442230 [239] 0.9442480 0.9442729 0.9442978 0.9443227 0.9443475 0.9443723 0.9443970 [246] 0.9444217 0.9444464 0.9444710 0.9444956 0.9445202 0.9445447 0.9445692 [253] 0.9445937 0.9446181 0.9446425 0.9446668 0.9446911 0.9447154 0.9447396 [260] 0.9447638 0.9447880 0.9448121 0.9448362 0.9448602 0.9448842 0.9449082 [267] 0.9449321 0.9449560 0.9449799 0.9450037 0.9450275 0.9450513 0.9450750 [274] 0.9450987 0.9451223 0.9451459 0.9451695 0.9451930 0.9452165 0.9452400 [281] 0.9452634 0.9452868 0.9453102 0.9453335 0.9453568 0.9453800 0.9454032 [288] 0.9454264 0.9454495 0.9454726 0.9454957 0.9455187 0.9455417 0.9455646 [295] 0.9455876 0.9456104 0.9456333 0.9456561 0.9456789 0.9457016 0.9457243 [302] 0.9457470 0.9457696 0.9457922 0.9458147 0.9458373 0.9458597 0.9458822 [309] 0.9459046 0.9459270 0.9459493 0.9459716 0.9459939 0.9460161 0.9460383 [316] 0.9460605 0.9460826 0.9461047 0.9461267 0.9461487 0.9461707 0.9461927 [323] 0.9462146 0.9462364 0.9462583 0.9462801 0.9463019 0.9463236 0.9463453 [330] 0.9463669 0.9463886 0.9464101 0.9464317 0.9464532 0.9464747 0.9464961 [337] 0.9465175 0.9465389 0.9465602 0.9465815 0.9466028 0.9466240 0.9466452 [344] 0.9466664 0.9466875 0.9467086 0.9467297 0.9467507 0.9467717 0.9467926 [351] 0.9468135 0.9468344 0.9468552 0.9468760 0.9468968 0.9469175 0.9469382 [358] 0.9469589 0.9469795 0.9470001 0.9470207 0.9470412 0.9470617 0.9470821 [365] 0.9471026 0.9471229 0.9471433 0.9471636 0.9471839 0.9472041 0.9472243 [372] 0.9472445 0.9472646 0.9472847 0.9473048 0.9473248 0.9473448 0.9473648 [379] 0.9473847 0.9474046 0.9474245 0.9474443 0.9474641 0.9474838 0.9475035 [386] 0.9475232 0.9475429 0.9475625 0.9475821 0.9476016 0.9476211 0.9476406 [393] 0.9476600 0.9476794 0.9476988 0.9477181 0.9477374 0.9477567 0.9477759 [400] 0.9477951 0.9478143 > mx [1] 0.9478143 > 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/freestat/rcomp/tmp/19xqr1226328820.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/2v64u1226328820.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/36yvf1226328820.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/4swgc1226328820.tab") > > system("convert tmp/19xqr1226328820.ps tmp/19xqr1226328820.png") > system("convert tmp/2v64u1226328820.ps tmp/2v64u1226328820.png") > system("convert tmp/36yvf1226328820.ps tmp/36yvf1226328820.png") > > > proc.time() user system elapsed 1.528 0.844 1.675