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(97.6,96.9,105.6,102.8,101.7,104.2,92.7,91.9,106.5,112.3,102.8,96.5,101,98.9,105.1,103,99,104.3,94.6,90.4,108.9,111.4,100.8,102.5,98.2,98.7,113.3,104.6,99.3,111.8,97.3,97.7,115.6,111.9,107,107.1,100.6,99.2,108.4,103,99.8,115,90.8,95.9,114.4,108.2,112.6,109.1,105,105,118.5,103.7,112.5,116.6,96.6,101.9,116.5,119.3,115.4,108.5,111.5,108.8,121.8,109.6,112.2,119.6,104.1,105.3,115,124.1,116.8,107.5,115.6) > x <- c(89.6,92.8,107.6,104.6,103,106.9,56.3,93.4,109.1,113.8,97.4,72.5,82.7,88.9,105.9,100.8,94,105,58.5,87.6,113.1,112.5,89.6,74.5,82.7,90.1,109.4,96,89.2,109.1,49.1,92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84,103.3,88.5,99,105.9,44.7,94,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3) > #'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.4888584 0.4892781 0.4896981 0.4901182 0.4905386 0.4909592 0.4913800 [8] 0.4918010 0.4922222 0.4926436 0.4930651 0.4934869 0.4939088 0.4943309 [15] 0.4947531 0.4951755 0.4955980 0.4960207 0.4964435 0.4968664 0.4972895 [22] 0.4977127 0.4981360 0.4985594 0.4989830 0.4994066 0.4998303 0.5002541 [29] 0.5006780 0.5011019 0.5015260 0.5019501 0.5023742 0.5027984 0.5032227 [36] 0.5036470 0.5040713 0.5044957 0.5049201 0.5053445 0.5057689 0.5061933 [43] 0.5066177 0.5070421 0.5074665 0.5078909 0.5083153 0.5087396 0.5091639 [50] 0.5095882 0.5100124 0.5104365 0.5108606 0.5112847 0.5117086 0.5121325 [57] 0.5125563 0.5129800 0.5134036 0.5138271 0.5142505 0.5146738 0.5150970 [64] 0.5155200 0.5159429 0.5163657 0.5167883 0.5172108 0.5176331 0.5180553 [71] 0.5184772 0.5188991 0.5193207 0.5197421 0.5201634 0.5205844 0.5210052 [78] 0.5214259 0.5218463 0.5222664 0.5226864 0.5231061 0.5235256 0.5239448 [85] 0.5243637 0.5247824 0.5252009 0.5256190 0.5260369 0.5264545 0.5268718 [92] 0.5272888 0.5277055 0.5281219 0.5285379 0.5289537 0.5293691 0.5297841 [99] 0.5301989 0.5306133 0.5310273 0.5314410 0.5318543 0.5322672 0.5326797 [106] 0.5330919 0.5335037 0.5339151 0.5343260 0.5347366 0.5351468 0.5355565 [113] 0.5359658 0.5363747 0.5367831 0.5371911 0.5375986 0.5380057 0.5384123 [120] 0.5388185 0.5392241 0.5396293 0.5400340 0.5404383 0.5408420 0.5412452 [127] 0.5416479 0.5420501 0.5424518 0.5428529 0.5432535 0.5436536 0.5440531 [134] 0.5444521 0.5448505 0.5452484 0.5456457 0.5460424 0.5464386 0.5468341 [141] 0.5472291 0.5476235 0.5480173 0.5484105 0.5488030 0.5491950 0.5495863 [148] 0.5499770 0.5503671 0.5507565 0.5511453 0.5515335 0.5519210 0.5523078 [155] 0.5526940 0.5530795 0.5534643 0.5538485 0.5542320 0.5546147 0.5549968 [162] 0.5553782 0.5557589 0.5561389 0.5565181 0.5568967 0.5572745 0.5576516 [169] 0.5580279 0.5584036 0.5587784 0.5591526 0.5595260 0.5598986 0.5602704 [176] 0.5606415 0.5610119 0.5613814 0.5617502 0.5621182 0.5624854 0.5628518 [183] 0.5632174 0.5635822 0.5639462 0.5643094 0.5646718 0.5650334 0.5653941 [190] 0.5657540 0.5661131 0.5664714 0.5668288 0.5671854 0.5675411 0.5678960 [197] 0.5682500 0.5686032 0.5689555 0.5693069 0.5696575 0.5700072 0.5703560 [204] 0.5707039 0.5710510 0.5713972 0.5717425 0.5720868 0.5724303 0.5727729 [211] 0.5731146 0.5734554 0.5737953 0.5741342 0.5744722 0.5748094 0.5751455 [218] 0.5754808 0.5758152 0.5761486 0.5764810 0.5768126 0.5771431 0.5774728 [225] 0.5778015 0.5781292 0.5784560 0.5787819 0.5791068 0.5794307 0.5797536 [232] 0.5800756 0.5803967 0.5807167 0.5810358 0.5813539 0.5816710 0.5819872 [239] 0.5823024 0.5826166 0.5829298 0.5832420 0.5835532 0.5838634 0.5841726 [246] 0.5844809 0.5847881 0.5850944 0.5853996 0.5857038 0.5860070 0.5863093 [253] 0.5866105 0.5869107 0.5872098 0.5875080 0.5878051 0.5881013 0.5883964 [260] 0.5886905 0.5889836 0.5892756 0.5895666 0.5898566 0.5901456 0.5904335 [267] 0.5907205 0.5910063 0.5912912 0.5915750 0.5918578 0.5921395 0.5924202 [274] 0.5926999 0.5929785 0.5932561 0.5935327 0.5938082 0.5940827 0.5943561 [281] 0.5946285 0.5948999 0.5951702 0.5954394 0.5957077 0.5959748 0.5962410 [288] 0.5965060 0.5967701 0.5970331 0.5972950 0.5975559 0.5978157 0.5980745 [295] 0.5983323 0.5985890 0.5988446 0.5990993 0.5993528 0.5996053 0.5998568 [302] 0.6001072 0.6003566 0.6006049 0.6008521 0.6010984 0.6013435 0.6015876 [309] 0.6018307 0.6020728 0.6023137 0.6025537 0.6027926 0.6030304 0.6032672 [316] 0.6035030 0.6037377 0.6039714 0.6042040 0.6044356 0.6046661 0.6048956 [323] 0.6051241 0.6053515 0.6055779 0.6058032 0.6060275 0.6062508 0.6064731 [330] 0.6066943 0.6069144 0.6071336 0.6073517 0.6075687 0.6077848 0.6079998 [337] 0.6082138 0.6084267 0.6086387 0.6088496 0.6090595 0.6092683 0.6094762 [344] 0.6096830 0.6098888 0.6100936 0.6102974 0.6105002 0.6107019 0.6109026 [351] 0.6111024 0.6113011 0.6114988 0.6116955 0.6118912 0.6120859 0.6122796 [358] 0.6124723 0.6126640 0.6128547 0.6130444 0.6132331 0.6134208 0.6136075 [365] 0.6137933 0.6139780 0.6141618 0.6143446 0.6145264 0.6147072 0.6148871 [372] 0.6150659 0.6152438 0.6154207 0.6155967 0.6157717 0.6159457 0.6161187 [379] 0.6162908 0.6164619 0.6166321 0.6168013 0.6169696 0.6171369 0.6173032 [386] 0.6174686 0.6176331 0.6177966 0.6179591 0.6181208 0.6182814 0.6184412 [393] 0.6186000 0.6187579 0.6189148 0.6190708 0.6192259 0.6193801 0.6195334 [400] 0.6196857 0.6198371 > mx [1] 0.6198371 > 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/1gte71261048346.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/24so31261048346.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/31ker1261048346.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/4d1sa1261048346.tab") > > try(system("convert tmp/1gte71261048346.ps tmp/1gte71261048346.png",intern=TRUE)) character(0) > try(system("convert tmp/24so31261048346.ps tmp/24so31261048346.png",intern=TRUE)) character(0) > try(system("convert tmp/31ker1261048346.ps tmp/31ker1261048346.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.803 0.531 2.131