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(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) > x <- 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) > #'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.9465556 0.9465538 0.9465521 0.9465503 0.9465485 0.9465467 0.9465449 [8] 0.9465431 0.9465413 0.9465395 0.9465377 0.9465359 0.9465340 0.9465322 [15] 0.9465304 0.9465285 0.9465266 0.9465248 0.9465229 0.9465210 0.9465191 [22] 0.9465172 0.9465153 0.9465134 0.9465115 0.9465096 0.9465077 0.9465057 [29] 0.9465038 0.9465018 0.9464999 0.9464979 0.9464959 0.9464940 0.9464920 [36] 0.9464900 0.9464880 0.9464860 0.9464840 0.9464820 0.9464799 0.9464779 [43] 0.9464759 0.9464738 0.9464718 0.9464697 0.9464677 0.9464656 0.9464635 [50] 0.9464614 0.9464593 0.9464572 0.9464551 0.9464530 0.9464509 0.9464488 [57] 0.9464466 0.9464445 0.9464424 0.9464402 0.9464380 0.9464359 0.9464337 [64] 0.9464315 0.9464293 0.9464271 0.9464249 0.9464227 0.9464205 0.9464183 [71] 0.9464161 0.9464138 0.9464116 0.9464094 0.9464071 0.9464048 0.9464026 [78] 0.9464003 0.9463980 0.9463957 0.9463934 0.9463911 0.9463888 0.9463865 [85] 0.9463842 0.9463819 0.9463795 0.9463772 0.9463748 0.9463725 0.9463701 [92] 0.9463678 0.9463654 0.9463630 0.9463606 0.9463582 0.9463558 0.9463534 [99] 0.9463510 0.9463486 0.9463461 0.9463437 0.9463412 0.9463388 0.9463363 [106] 0.9463339 0.9463314 0.9463289 0.9463264 0.9463240 0.9463215 0.9463190 [113] 0.9463164 0.9463139 0.9463114 0.9463089 0.9463063 0.9463038 0.9463012 [120] 0.9462987 0.9462961 0.9462935 0.9462910 0.9462884 0.9462858 0.9462832 [127] 0.9462806 0.9462780 0.9462753 0.9462727 0.9462701 0.9462674 0.9462648 [134] 0.9462621 0.9462595 0.9462568 0.9462541 0.9462515 0.9462488 0.9462461 [141] 0.9462434 0.9462407 0.9462380 0.9462352 0.9462325 0.9462298 0.9462270 [148] 0.9462243 0.9462215 0.9462188 0.9462160 0.9462132 0.9462104 0.9462077 [155] 0.9462049 0.9462021 0.9461993 0.9461964 0.9461936 0.9461908 0.9461880 [162] 0.9461851 0.9461823 0.9461794 0.9461765 0.9461737 0.9461708 0.9461679 [169] 0.9461650 0.9461621 0.9461592 0.9461563 0.9461534 0.9461505 0.9461475 [176] 0.9461446 0.9461417 0.9461387 0.9461358 0.9461328 0.9461298 0.9461268 [183] 0.9461239 0.9461209 0.9461179 0.9461149 0.9461118 0.9461088 0.9461058 [190] 0.9461028 0.9460997 0.9460967 0.9460936 0.9460906 0.9460875 0.9460844 [197] 0.9460814 0.9460783 0.9460752 0.9460721 0.9460690 0.9460659 0.9460627 [204] 0.9460596 0.9460565 0.9460533 0.9460502 0.9460470 0.9460439 0.9460407 [211] 0.9460375 0.9460344 0.9460312 0.9460280 0.9460248 0.9460216 0.9460184 [218] 0.9460151 0.9460119 0.9460087 0.9460054 0.9460022 0.9459989 0.9459957 [225] 0.9459924 0.9459891 0.9459858 0.9459826 0.9459793 0.9459760 0.9459727 [232] 0.9459693 0.9459660 0.9459627 0.9459594 0.9459560 0.9459527 0.9459493 [239] 0.9459459 0.9459426 0.9459392 0.9459358 0.9459324 0.9459290 0.9459256 [246] 0.9459222 0.9459188 0.9459154 0.9459119 0.9459085 0.9459051 0.9459016 [253] 0.9458982 0.9458947 0.9458912 0.9458877 0.9458843 0.9458808 0.9458773 [260] 0.9458738 0.9458703 0.9458667 0.9458632 0.9458597 0.9458562 0.9458526 [267] 0.9458491 0.9458455 0.9458419 0.9458384 0.9458348 0.9458312 0.9458276 [274] 0.9458240 0.9458204 0.9458168 0.9458132 0.9458095 0.9458059 0.9458023 [281] 0.9457986 0.9457950 0.9457913 0.9457877 0.9457840 0.9457803 0.9457766 [288] 0.9457729 0.9457692 0.9457655 0.9457618 0.9457581 0.9457544 0.9457506 [295] 0.9457469 0.9457431 0.9457394 0.9457356 0.9457319 0.9457281 0.9457243 [302] 0.9457205 0.9457167 0.9457129 0.9457091 0.9457053 0.9457015 0.9456976 [309] 0.9456938 0.9456900 0.9456861 0.9456823 0.9456784 0.9456745 0.9456707 [316] 0.9456668 0.9456629 0.9456590 0.9456551 0.9456512 0.9456473 0.9456434 [323] 0.9456394 0.9456355 0.9456316 0.9456276 0.9456237 0.9456197 0.9456157 [330] 0.9456117 0.9456078 0.9456038 0.9455998 0.9455958 0.9455918 0.9455878 [337] 0.9455837 0.9455797 0.9455757 0.9455716 0.9455676 0.9455635 0.9455595 [344] 0.9455554 0.9455513 0.9455472 0.9455431 0.9455390 0.9455349 0.9455308 [351] 0.9455267 0.9455226 0.9455185 0.9455143 0.9455102 0.9455060 0.9455019 [358] 0.9454977 0.9454935 0.9454894 0.9454852 0.9454810 0.9454768 0.9454726 [365] 0.9454684 0.9454642 0.9454599 0.9454557 0.9454515 0.9454472 0.9454430 [372] 0.9454387 0.9454344 0.9454302 0.9454259 0.9454216 0.9454173 0.9454130 [379] 0.9454087 0.9454044 0.9454001 0.9453958 0.9453914 0.9453871 0.9453828 [386] 0.9453784 0.9453740 0.9453697 0.9453653 0.9453609 0.9453565 0.9453522 [393] 0.9453478 0.9453433 0.9453389 0.9453345 0.9453301 0.9453257 0.9453212 [400] 0.9453168 0.9453123 > mx [1] 0.9465556 > 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/1qhx01226327329.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/2m1b41226327329.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/3q8ts1226327329.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/4p4d91226327329.tab") > > system("convert tmp/1qhx01226327329.ps tmp/1qhx01226327329.png") > system("convert tmp/2m1b41226327329.ps tmp/2m1b41226327329.png") > system("convert tmp/3q8ts1226327329.ps tmp/3q8ts1226327329.png") > > > proc.time() user system elapsed 0.993 0.498 1.609