R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17056,16077.7,13348.2,16402.4,16559.1,16579,17561.2,16129.6,18484.3,16402.6,14032.3,17109.1,17157.2,13879.8,12362.4,12683.5,12608.8,13583.7,12846.3,12347.1,13967,13114.3) > x <- c(10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16093.4,15413.6,14705.7,15972.8,16241.4,16626.4,17136.2,15622.9,18003.9,16136.1,14423.7,16789.4,16782.2,14133.8,12607,12004.5,12175.4,13268,12299.3,11800.6,13873.3,12269.6) > #'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.9253217 0.9254703 0.9256184 0.9257661 0.9259132 0.9260599 0.9262061 [8] 0.9263518 0.9264970 0.9266417 0.9267859 0.9269297 0.9270730 0.9272158 [15] 0.9273581 0.9274999 0.9276412 0.9277821 0.9279224 0.9280623 0.9282017 [22] 0.9283406 0.9284790 0.9286169 0.9287544 0.9288913 0.9290278 0.9291638 [29] 0.9292993 0.9294343 0.9295688 0.9297028 0.9298364 0.9299694 0.9301020 [36] 0.9302340 0.9303656 0.9304967 0.9306273 0.9307574 0.9308870 0.9310162 [43] 0.9311448 0.9312729 0.9314006 0.9315278 0.9316544 0.9317806 0.9319063 [50] 0.9320315 0.9321562 0.9322804 0.9324041 0.9325274 0.9326501 0.9327724 [57] 0.9328941 0.9330154 0.9331361 0.9332564 0.9333762 0.9334955 0.9336143 [64] 0.9337326 0.9338504 0.9339677 0.9340845 0.9342008 0.9343167 0.9344320 [71] 0.9345468 0.9346612 0.9347750 0.9348884 0.9350013 0.9351136 0.9352255 [78] 0.9353369 0.9354478 0.9355581 0.9356680 0.9357774 0.9358863 0.9359947 [85] 0.9361027 0.9362101 0.9363170 0.9364234 0.9365293 0.9366348 0.9367397 [92] 0.9368442 0.9369481 0.9370516 0.9371545 0.9372570 0.9373589 0.9374604 [99] 0.9375614 0.9376618 0.9377618 0.9378613 0.9379603 0.9380588 0.9381567 [106] 0.9382542 0.9383512 0.9384477 0.9385437 0.9386393 0.9387343 0.9388288 [113] 0.9389228 0.9390163 0.9391094 0.9392019 0.9392939 0.9393855 0.9394765 [120] 0.9395670 0.9396571 0.9397466 0.9398357 0.9399243 0.9400123 0.9400999 [127] 0.9401870 0.9402735 0.9403596 0.9404452 0.9405303 0.9406149 0.9406990 [134] 0.9407826 0.9408657 0.9409483 0.9410304 0.9411120 0.9411931 0.9412737 [141] 0.9413539 0.9414335 0.9415126 0.9415913 0.9416694 0.9417471 0.9418242 [148] 0.9419009 0.9419771 0.9420527 0.9421279 0.9422026 0.9422768 0.9423505 [155] 0.9424237 0.9424964 0.9425686 0.9426403 0.9427115 0.9427822 0.9428525 [162] 0.9429222 0.9429914 0.9430602 0.9431285 0.9431962 0.9432635 0.9433303 [169] 0.9433965 0.9434623 0.9435276 0.9435924 0.9436568 0.9437206 0.9437839 [176] 0.9438468 0.9439091 0.9439709 0.9440323 0.9440932 0.9441536 0.9442134 [183] 0.9442728 0.9443318 0.9443902 0.9444481 0.9445055 0.9445625 0.9446189 [190] 0.9446749 0.9447304 0.9447853 0.9448398 0.9448938 0.9449474 0.9450004 [197] 0.9450529 0.9451050 0.9451565 0.9452076 0.9452582 0.9453083 0.9453579 [204] 0.9454070 0.9454557 0.9455038 0.9455515 0.9455986 0.9456453 0.9456915 [211] 0.9457373 0.9457825 0.9458272 0.9458715 0.9459153 0.9459585 0.9460014 [218] 0.9460437 0.9460855 0.9461269 0.9461677 0.9462081 0.9462480 0.9462874 [225] 0.9463264 0.9463648 0.9464028 0.9464403 0.9464773 0.9465138 0.9465498 [232] 0.9465854 0.9466205 0.9466551 0.9466892 0.9467228 0.9467560 0.9467887 [239] 0.9468209 0.9468526 0.9468838 0.9469146 0.9469449 0.9469747 0.9470040 [246] 0.9470328 0.9470612 0.9470891 0.9471165 0.9471435 0.9471699 0.9471959 [253] 0.9472214 0.9472465 0.9472710 0.9472951 0.9473187 0.9473419 0.9473645 [260] 0.9473867 0.9474084 0.9474297 0.9474505 0.9474708 0.9474906 0.9475099 [267] 0.9475288 0.9475472 0.9475652 0.9475826 0.9475996 0.9476162 0.9476322 [274] 0.9476478 0.9476630 0.9476776 0.9476918 0.9477055 0.9477188 0.9477315 [281] 0.9477439 0.9477557 0.9477671 0.9477780 0.9477885 0.9477984 0.9478080 [288] 0.9478170 0.9478256 0.9478337 0.9478414 0.9478486 0.9478553 0.9478616 [295] 0.9478674 0.9478728 0.9478777 0.9478821 0.9478861 0.9478896 0.9478926 [302] 0.9478952 0.9478973 0.9478990 0.9479002 0.9479010 0.9479012 0.9479011 [309] 0.9479005 0.9478994 0.9478978 0.9478959 0.9478934 0.9478905 0.9478872 [316] 0.9478833 0.9478791 0.9478744 0.9478692 0.9478636 0.9478575 0.9478510 [323] 0.9478440 0.9478365 0.9478287 0.9478203 0.9478115 0.9478023 0.9477926 [330] 0.9477825 0.9477719 0.9477609 0.9477494 0.9477375 0.9477251 0.9477123 [337] 0.9476990 0.9476853 0.9476712 0.9476566 0.9476415 0.9476260 0.9476101 [344] 0.9475937 0.9475769 0.9475596 0.9475419 0.9475238 0.9475052 0.9474862 [351] 0.9474667 0.9474468 0.9474265 0.9474057 0.9473845 0.9473628 0.9473407 [358] 0.9473182 0.9472952 0.9472718 0.9472479 0.9472237 0.9471989 0.9471738 [365] 0.9471482 0.9471222 0.9470957 0.9470689 0.9470415 0.9470138 0.9469856 [372] 0.9469570 0.9469280 0.9468985 0.9468686 0.9468383 0.9468075 0.9467763 [379] 0.9467447 0.9467127 0.9466802 0.9466473 0.9466140 0.9465803 0.9465461 [386] 0.9465115 0.9464765 0.9464410 0.9464052 0.9463689 0.9463322 0.9462950 [393] 0.9462575 0.9462195 0.9461811 0.9461423 0.9461031 0.9460634 0.9460234 [400] 0.9459829 0.9459420 > mx [1] 0.9479012 > 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/rcomp/tmp/1c35e1258212054.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/2yu331258212054.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/3zr2a1258212054.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/4x72q1258212054.tab") > > system("convert tmp/1c35e1258212054.ps tmp/1c35e1258212054.png") > system("convert tmp/2yu331258212054.ps tmp/2yu331258212054.png") > system("convert tmp/3zr2a1258212054.ps tmp/3zr2a1258212054.png") > > > proc.time() user system elapsed 0.784 0.514 0.922