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(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) > x <- 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.7,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) > #'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.6226521 0.6225884 0.6225245 0.6224605 0.6223963 0.6223320 0.6222676 [8] 0.6222030 0.6221383 0.6220734 0.6220083 0.6219432 0.6218779 0.6218124 [15] 0.6217468 0.6216811 0.6216152 0.6215492 0.6214830 0.6214167 0.6213503 [22] 0.6212837 0.6212170 0.6211501 0.6210831 0.6210159 0.6209486 0.6208812 [29] 0.6208136 0.6207459 0.6206780 0.6206100 0.6205419 0.6204736 0.6204052 [36] 0.6203367 0.6202680 0.6201991 0.6201301 0.6200610 0.6199918 0.6199224 [43] 0.6198529 0.6197832 0.6197134 0.6196434 0.6195733 0.6195031 0.6194328 [50] 0.6193623 0.6192916 0.6192208 0.6191499 0.6190789 0.6190077 0.6189364 [57] 0.6188649 0.6187933 0.6187216 0.6186497 0.6185777 0.6185056 0.6184333 [64] 0.6183609 0.6182883 0.6182156 0.6181428 0.6180698 0.6179967 0.6179235 [71] 0.6178502 0.6177767 0.6177030 0.6176293 0.6175554 0.6174813 0.6174072 [78] 0.6173328 0.6172584 0.6171838 0.6171091 0.6170343 0.6169593 0.6168842 [85] 0.6168090 0.6167336 0.6166581 0.6165825 0.6165067 0.6164308 0.6163548 [92] 0.6162786 0.6162023 0.6161259 0.6160494 0.6159727 0.6158959 0.6158189 [99] 0.6157418 0.6156646 0.6155873 0.6155098 0.6154322 0.6153545 0.6152766 [106] 0.6151986 0.6151205 0.6150423 0.6149639 0.6148854 0.6148068 0.6147280 [113] 0.6146491 0.6145701 0.6144909 0.6144117 0.6143323 0.6142527 0.6141731 [120] 0.6140933 0.6140134 0.6139333 0.6138532 0.6137729 0.6136925 0.6136119 [127] 0.6135312 0.6134504 0.6133695 0.6132885 0.6132073 0.6131260 0.6130446 [134] 0.6129630 0.6128813 0.6127995 0.6127176 0.6126356 0.6125534 0.6124711 [141] 0.6123887 0.6123061 0.6122235 0.6121407 0.6120577 0.6119747 0.6118915 [148] 0.6118083 0.6117249 0.6116413 0.6115577 0.6114739 0.6113900 0.6113060 [155] 0.6112219 0.6111376 0.6110532 0.6109687 0.6108841 0.6107993 0.6107145 [162] 0.6106295 0.6105444 0.6104592 0.6103738 0.6102884 0.6102028 0.6101171 [169] 0.6100313 0.6099453 0.6098593 0.6097731 0.6096868 0.6096004 0.6095138 [176] 0.6094272 0.6093404 0.6092535 0.6091665 0.6090794 0.6089922 0.6089048 [183] 0.6088174 0.6087298 0.6086421 0.6085542 0.6084663 0.6083783 0.6082901 [190] 0.6082018 0.6081134 0.6080249 0.6079363 0.6078475 0.6077587 0.6076697 [197] 0.6075806 0.6074914 0.6074021 0.6073127 0.6072231 0.6071335 0.6070437 [204] 0.6069539 0.6068639 0.6067738 0.6066835 0.6065932 0.6065028 0.6064122 [211] 0.6063216 0.6062308 0.6061399 0.6060489 0.6059578 0.6058666 0.6057752 [218] 0.6056838 0.6055923 0.6055006 0.6054088 0.6053169 0.6052250 0.6051329 [225] 0.6050407 0.6049483 0.6048559 0.6047634 0.6046707 0.6045780 0.6044851 [232] 0.6043922 0.6042991 0.6042059 0.6041126 0.6040192 0.6039257 0.6038321 [239] 0.6037384 0.6036446 0.6035507 0.6034566 0.6033625 0.6032683 0.6031739 [246] 0.6030795 0.6029849 0.6028902 0.6027955 0.6027006 0.6026056 0.6025106 [253] 0.6024154 0.6023201 0.6022247 0.6021292 0.6020336 0.6019379 0.6018421 [260] 0.6017462 0.6016502 0.6015541 0.6014579 0.6013616 0.6012651 0.6011686 [267] 0.6010720 0.6009753 0.6008785 0.6007816 0.6006845 0.6005874 0.6004902 [274] 0.6003929 0.6002955 0.6001979 0.6001003 0.6000026 0.5999048 0.5998069 [281] 0.5997089 0.5996108 0.5995126 0.5994142 0.5993158 0.5992173 0.5991187 [288] 0.5990200 0.5989213 0.5988224 0.5987234 0.5986243 0.5985251 0.5984258 [295] 0.5983265 0.5982270 0.5981275 0.5980278 0.5979280 0.5978282 0.5977283 [302] 0.5976282 0.5975281 0.5974279 0.5973276 0.5972271 0.5971266 0.5970260 [309] 0.5969254 0.5968246 0.5967237 0.5966227 0.5965217 0.5964205 0.5963193 [316] 0.5962179 0.5961165 0.5960150 0.5959134 0.5958117 0.5957099 0.5956080 [323] 0.5955060 0.5954040 0.5953018 0.5951996 0.5950973 0.5949948 0.5948923 [330] 0.5947897 0.5946871 0.5945843 0.5944814 0.5943785 0.5942754 0.5941723 [337] 0.5940691 0.5939658 0.5938624 0.5937589 0.5936554 0.5935517 0.5934480 [344] 0.5933442 0.5932402 0.5931363 0.5930322 0.5929280 0.5928238 0.5927194 [351] 0.5926150 0.5925105 0.5924059 0.5923012 0.5921965 0.5920916 0.5919867 [358] 0.5918817 0.5917766 0.5916715 0.5915662 0.5914609 0.5913554 0.5912499 [365] 0.5911444 0.5910387 0.5909329 0.5908271 0.5907212 0.5906152 0.5905091 [372] 0.5904030 0.5902968 0.5901904 0.5900840 0.5899776 0.5898710 0.5897644 [379] 0.5896577 0.5895509 0.5894440 0.5893371 0.5892300 0.5891229 0.5890158 [386] 0.5889085 0.5888012 0.5886937 0.5885862 0.5884787 0.5883710 0.5882633 [393] 0.5881555 0.5880476 0.5879397 0.5878316 0.5877235 0.5876154 0.5875071 [400] 0.5873988 0.5872904 > mx [1] 0.6226521 > 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/15mls1257348333.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/25qg01257348333.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/3pmxm1257348333.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/48dph1257348333.tab") > > system("convert tmp/15mls1257348333.ps tmp/15mls1257348333.png") > system("convert tmp/25qg01257348333.ps tmp/25qg01257348333.png") > system("convert tmp/3pmxm1257348333.ps tmp/3pmxm1257348333.png") > > > proc.time() user system elapsed 0.787 0.503 0.983