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(100,91.74,84.40,84.40,87.16,88.07,87.16,83.49,81.65,82.57,92.66,94.50,93.58,88.07,84.40,85.32,86.24,86.24,84.40,82.57,82.57,82.57,89.91,91.74,89.91,85.32,82.57,82.57,83.49,83.49,83.49,84.40,80.73,76.15,77.06,74.31,70.64,72.48,72.48,73.39,72.48,69.72,65.14,62.39,59.63,63.30,75.23,79.82,76.15,72.48,68.81,71.56,76.15,77.06,75.23,70.64,66.06,66.97,74.31,77.98) > x <- c(100,95.06,92.59,93.83,96.30,96.30,96.30,92.59,92.59,87.65,92.59,92.59,93.83,95.06,95.06,97.53,100.00,101.23,101.23,101.23,97.53,90.12,85.19,81.48,82.72,85.19,86.42,87.65,88.89,87.65,85.19,86.42,83.95,79.01,82.72,81.48,79.01,77.78,76.54,80.25,83.95,83.95,79.01,75.31,71.60,75.31,88.89,90.12,85.19,75.31,71.60,76.54,87.65,95.06,97.53,95.06,91.36,92.59,98.77,100.00) > #'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.6095463 0.6094648 0.6093832 0.6093015 0.6092195 0.6091375 0.6090553 [8] 0.6089730 0.6088905 0.6088079 0.6087251 0.6086422 0.6085592 0.6084760 [15] 0.6083927 0.6083092 0.6082256 0.6081419 0.6080580 0.6079740 0.6078898 [22] 0.6078055 0.6077211 0.6076365 0.6075518 0.6074669 0.6073819 0.6072968 [29] 0.6072115 0.6071261 0.6070405 0.6069548 0.6068690 0.6067830 0.6066969 [36] 0.6066107 0.6065243 0.6064378 0.6063511 0.6062643 0.6061774 0.6060903 [43] 0.6060031 0.6059157 0.6058283 0.6057407 0.6056529 0.6055650 0.6054770 [50] 0.6053888 0.6053005 0.6052121 0.6051235 0.6050348 0.6049460 0.6048570 [57] 0.6047679 0.6046787 0.6045893 0.6044998 0.6044102 0.6043204 0.6042305 [64] 0.6041405 0.6040503 0.6039600 0.6038695 0.6037790 0.6036882 0.6035974 [71] 0.6035064 0.6034153 0.6033241 0.6032327 0.6031412 0.6030496 0.6029578 [78] 0.6028659 0.6027739 0.6026818 0.6025895 0.6024971 0.6024045 0.6023118 [85] 0.6022190 0.6021261 0.6020330 0.6019398 0.6018465 0.6017531 0.6016595 [92] 0.6015658 0.6014719 0.6013780 0.6012839 0.6011896 0.6010953 0.6010008 [99] 0.6009062 0.6008114 0.6007166 0.6006216 0.6005265 0.6004312 0.6003359 [106] 0.6002404 0.6001447 0.6000490 0.5999531 0.5998571 0.5997610 0.5996647 [113] 0.5995683 0.5994718 0.5993752 0.5992784 0.5991816 0.5990846 0.5989874 [120] 0.5988902 0.5987928 0.5986953 0.5985977 0.5984999 0.5984021 0.5983041 [127] 0.5982060 0.5981077 0.5980094 0.5979109 0.5978123 0.5977136 0.5976147 [134] 0.5975157 0.5974167 0.5973174 0.5972181 0.5971187 0.5970191 0.5969194 [141] 0.5968196 0.5967196 0.5966196 0.5965194 0.5964191 0.5963187 0.5962182 [148] 0.5961175 0.5960167 0.5959158 0.5958148 0.5957137 0.5956125 0.5955111 [155] 0.5954096 0.5953080 0.5952063 0.5951045 0.5950025 0.5949004 0.5947983 [162] 0.5946960 0.5945935 0.5944910 0.5943884 0.5942856 0.5941827 0.5940797 [169] 0.5939766 0.5938734 0.5937700 0.5936666 0.5935630 0.5934593 0.5933555 [176] 0.5932516 0.5931476 0.5930435 0.5929392 0.5928348 0.5927304 0.5926258 [183] 0.5925211 0.5924163 0.5923113 0.5922063 0.5921011 0.5919959 0.5918905 [190] 0.5917850 0.5916794 0.5915737 0.5914679 0.5913620 0.5912559 0.5911498 [197] 0.5910435 0.5909372 0.5908307 0.5907241 0.5906174 0.5905106 0.5904037 [204] 0.5902967 0.5901895 0.5900823 0.5899749 0.5898675 0.5897599 0.5896523 [211] 0.5895445 0.5894366 0.5893286 0.5892205 0.5891123 0.5890040 0.5888956 [218] 0.5887871 0.5886784 0.5885697 0.5884609 0.5883519 0.5882429 0.5881337 [225] 0.5880245 0.5879151 0.5878056 0.5876961 0.5875864 0.5874766 0.5873668 [232] 0.5872568 0.5871467 0.5870365 0.5869262 0.5868158 0.5867053 0.5865947 [239] 0.5864840 0.5863732 0.5862623 0.5861513 0.5860402 0.5859290 0.5858177 [246] 0.5857063 0.5855948 0.5854832 0.5853715 0.5852597 0.5851478 0.5850358 [253] 0.5849237 0.5848115 0.5846992 0.5845868 0.5844743 0.5843618 0.5842491 [260] 0.5841363 0.5840234 0.5839104 0.5837973 0.5836842 0.5835709 0.5834575 [267] 0.5833441 0.5832305 0.5831169 0.5830031 0.5828893 0.5827753 0.5826613 [274] 0.5825472 0.5824330 0.5823186 0.5822042 0.5820897 0.5819751 0.5818604 [281] 0.5817457 0.5816308 0.5815158 0.5814008 0.5812856 0.5811704 0.5810550 [288] 0.5809396 0.5808241 0.5807084 0.5805927 0.5804769 0.5803611 0.5802451 [295] 0.5801290 0.5800129 0.5798966 0.5797803 0.5796639 0.5795473 0.5794307 [302] 0.5793140 0.5791973 0.5790804 0.5789634 0.5788464 0.5787293 0.5786120 [309] 0.5784947 0.5783773 0.5782598 0.5781423 0.5780246 0.5779069 0.5777890 [316] 0.5776711 0.5775531 0.5774350 0.5773169 0.5771986 0.5770803 0.5769618 [323] 0.5768433 0.5767247 0.5766060 0.5764873 0.5763684 0.5762495 0.5761305 [330] 0.5760114 0.5758922 0.5757729 0.5756536 0.5755342 0.5754147 0.5752951 [337] 0.5751754 0.5750556 0.5749358 0.5748159 0.5746959 0.5745758 0.5744557 [344] 0.5743354 0.5742151 0.5740947 0.5739742 0.5738537 0.5737330 0.5736123 [351] 0.5734915 0.5733706 0.5732497 0.5731287 0.5730075 0.5728864 0.5727651 [358] 0.5726438 0.5725223 0.5724008 0.5722793 0.5721576 0.5720359 0.5719141 [365] 0.5717922 0.5716703 0.5715482 0.5714261 0.5713040 0.5711817 0.5710594 [372] 0.5709370 0.5708145 0.5706920 0.5705693 0.5704466 0.5703239 0.5702010 [379] 0.5700781 0.5699551 0.5698321 0.5697089 0.5695857 0.5694624 0.5693391 [386] 0.5692157 0.5690922 0.5689686 0.5688450 0.5687213 0.5685975 0.5684737 [393] 0.5683497 0.5682258 0.5681017 0.5679776 0.5678534 0.5677291 0.5676048 [400] 0.5674804 0.5673559 > mx [1] 0.6095463 > 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/1yto21257945752.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/2110z1257945752.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/3lv1n1257945752.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/4ww7z1257945752.tab") > > system("convert tmp/1yto21257945752.ps tmp/1yto21257945752.png") > system("convert tmp/2110z1257945752.ps tmp/2110z1257945752.png") > system("convert tmp/3lv1n1257945752.ps tmp/3lv1n1257945752.png") > > > proc.time() user system elapsed 0.771 0.499 0.920