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(8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8,8.1) > x <- c(11.1,10.9,10,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.8,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8,7.9,7.6,7.1,6.8,6.5,6.9,8.2,8.7,8.3,7.9,7.5,7.8,8.3,8.4,8.2,7.7,7.2,7.3,8.1,8.5) > #'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.6128751 0.6128593 0.6128432 0.6128267 0.6128099 0.6127927 0.6127753 [8] 0.6127575 0.6127394 0.6127209 0.6127021 0.6126830 0.6126635 0.6126438 [15] 0.6126236 0.6126032 0.6125824 0.6125613 0.6125399 0.6125181 0.6124960 [22] 0.6124736 0.6124508 0.6124277 0.6124043 0.6123805 0.6123564 0.6123320 [29] 0.6123072 0.6122821 0.6122567 0.6122310 0.6122049 0.6121785 0.6121517 [36] 0.6121246 0.6120972 0.6120695 0.6120414 0.6120130 0.6119842 0.6119551 [43] 0.6119257 0.6118960 0.6118659 0.6118355 0.6118047 0.6117736 0.6117422 [50] 0.6117105 0.6116784 0.6116460 0.6116132 0.6115801 0.6115467 0.6115130 [57] 0.6114789 0.6114444 0.6114097 0.6113746 0.6113392 0.6113034 0.6112673 [64] 0.6112309 0.6111942 0.6111571 0.6111197 0.6110819 0.6110438 0.6110054 [71] 0.6109666 0.6109275 0.6108881 0.6108483 0.6108082 0.6107678 0.6107270 [78] 0.6106859 0.6106445 0.6106027 0.6105606 0.6105182 0.6104754 0.6104323 [85] 0.6103889 0.6103451 0.6103010 0.6102566 0.6102118 0.6101667 0.6101213 [92] 0.6100755 0.6100294 0.6099829 0.6099362 0.6098890 0.6098416 0.6097938 [99] 0.6097457 0.6096973 0.6096485 0.6095994 0.6095499 0.6095001 0.6094500 [106] 0.6093996 0.6093488 0.6092977 0.6092462 0.6091944 0.6091423 0.6090899 [113] 0.6090371 0.6089840 0.6089305 0.6088767 0.6088226 0.6087682 0.6087134 [120] 0.6086583 0.6086028 0.6085470 0.6084909 0.6084345 0.6083777 0.6083206 [127] 0.6082631 0.6082054 0.6081472 0.6080888 0.6080300 0.6079709 0.6079115 [134] 0.6078517 0.6077916 0.6077312 0.6076704 0.6076093 0.6075479 0.6074861 [141] 0.6074240 0.6073616 0.6072988 0.6072357 0.6071723 0.6071086 0.6070445 [148] 0.6069801 0.6069153 0.6068502 0.6067848 0.6067191 0.6066530 0.6065866 [155] 0.6065199 0.6064529 0.6063855 0.6063178 0.6062497 0.6061813 0.6061126 [162] 0.6060436 0.6059742 0.6059045 0.6058345 0.6057641 0.6056935 0.6056224 [169] 0.6055511 0.6054794 0.6054074 0.6053351 0.6052625 0.6051895 0.6051162 [176] 0.6050425 0.6049686 0.6048943 0.6048196 0.6047447 0.6046694 0.6045938 [183] 0.6045179 0.6044416 0.6043651 0.6042881 0.6042109 0.6041333 0.6040555 [190] 0.6039772 0.6038987 0.6038198 0.6037407 0.6036611 0.6035813 0.6035011 [197] 0.6034206 0.6033398 0.6032587 0.6031772 0.6030954 0.6030133 0.6029309 [204] 0.6028481 0.6027650 0.6026816 0.6025979 0.6025139 0.6024295 0.6023448 [211] 0.6022598 0.6021744 0.6020888 0.6020028 0.6019165 0.6018298 0.6017429 [218] 0.6016556 0.6015680 0.6014801 0.6013919 0.6013033 0.6012144 0.6011252 [225] 0.6010357 0.6009459 0.6008557 0.6007652 0.6006745 0.6005833 0.6004919 [232] 0.6004002 0.6003081 0.6002157 0.6001230 0.6000300 0.5999366 0.5998430 [239] 0.5997490 0.5996547 0.5995601 0.5994652 0.5993700 0.5992744 0.5991785 [246] 0.5990824 0.5989859 0.5988890 0.5987919 0.5986945 0.5985967 0.5984986 [253] 0.5984002 0.5983015 0.5982025 0.5981032 0.5980036 0.5979036 0.5978033 [260] 0.5977028 0.5976019 0.5975007 0.5973991 0.5972973 0.5971952 0.5970927 [267] 0.5969900 0.5968869 0.5967835 0.5966798 0.5965759 0.5964715 0.5963669 [274] 0.5962620 0.5961568 0.5960512 0.5959454 0.5958392 0.5957328 0.5956260 [281] 0.5955189 0.5954115 0.5953038 0.5951958 0.5950875 0.5949789 0.5948700 [288] 0.5947608 0.5946513 0.5945414 0.5944313 0.5943209 0.5942101 0.5940991 [295] 0.5939877 0.5938761 0.5937641 0.5936519 0.5935393 0.5934265 0.5933133 [302] 0.5931999 0.5930861 0.5929720 0.5928577 0.5927430 0.5926280 0.5925128 [309] 0.5923972 0.5922814 0.5921652 0.5920488 0.5919320 0.5918150 0.5916976 [316] 0.5915800 0.5914620 0.5913438 0.5912253 0.5911064 0.5909873 0.5908679 [323] 0.5907482 0.5906282 0.5905079 0.5903873 0.5902664 0.5901452 0.5900237 [330] 0.5899019 0.5897799 0.5896575 0.5895349 0.5894120 0.5892887 0.5891652 [337] 0.5890414 0.5889173 0.5887929 0.5886682 0.5885433 0.5884180 0.5882925 [344] 0.5881667 0.5880405 0.5879141 0.5877875 0.5876605 0.5875332 0.5874057 [351] 0.5872778 0.5871497 0.5870213 0.5868926 0.5867637 0.5866344 0.5865049 [358] 0.5863750 0.5862449 0.5861145 0.5859839 0.5858529 0.5857217 0.5855902 [365] 0.5854584 0.5853263 0.5851940 0.5850613 0.5849284 0.5847952 0.5846618 [372] 0.5845280 0.5843940 0.5842597 0.5841251 0.5839903 0.5838551 0.5837197 [379] 0.5835841 0.5834481 0.5833119 0.5831754 0.5830386 0.5829015 0.5827642 [386] 0.5826266 0.5824888 0.5823506 0.5822122 0.5820735 0.5819346 0.5817953 [393] 0.5816558 0.5815161 0.5813761 0.5812358 0.5810952 0.5809543 0.5808132 [400] 0.5806719 0.5805302 > mx [1] 0.6128751 > 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/19axy1258116299.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/2kg9r1258116299.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/3zuyy1258116299.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/491wv1258116299.tab") > > system("convert tmp/19axy1258116299.ps tmp/19axy1258116299.png") > system("convert tmp/2kg9r1258116299.ps tmp/2kg9r1258116299.png") > system("convert tmp/3zuyy1258116299.ps tmp/3zuyy1258116299.png") > > > proc.time() user system elapsed 0.795 0.517 1.669