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(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,8.4) > x <- c(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,8) > #'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.5970832 0.5969946 0.5969059 0.5968170 0.5967280 0.5966388 0.5965496 [8] 0.5964601 0.5963706 0.5962809 0.5961910 0.5961011 0.5960109 0.5959207 [15] 0.5958303 0.5957398 0.5956491 0.5955583 0.5954674 0.5953763 0.5952851 [22] 0.5951937 0.5951022 0.5950106 0.5949188 0.5948269 0.5947349 0.5946427 [29] 0.5945504 0.5944580 0.5943654 0.5942727 0.5941799 0.5940869 0.5939938 [36] 0.5939005 0.5938071 0.5937136 0.5936200 0.5935262 0.5934322 0.5933382 [43] 0.5932440 0.5931497 0.5930552 0.5929607 0.5928659 0.5927711 0.5926761 [50] 0.5925810 0.5924857 0.5923904 0.5922948 0.5921992 0.5921034 0.5920075 [57] 0.5919115 0.5918153 0.5917190 0.5916226 0.5915260 0.5914294 0.5913325 [64] 0.5912356 0.5911385 0.5910413 0.5909440 0.5908465 0.5907489 0.5906512 [71] 0.5905533 0.5904554 0.5903573 0.5902590 0.5901607 0.5900622 0.5899636 [78] 0.5898648 0.5897659 0.5896669 0.5895678 0.5894686 0.5893692 0.5892697 [85] 0.5891700 0.5890703 0.5889704 0.5888704 0.5887702 0.5886700 0.5885696 [92] 0.5884691 0.5883685 0.5882677 0.5881668 0.5880658 0.5879647 0.5878634 [99] 0.5877620 0.5876605 0.5875589 0.5874572 0.5873553 0.5872533 0.5871512 [106] 0.5870490 0.5869466 0.5868441 0.5867415 0.5866388 0.5865359 0.5864330 [113] 0.5863299 0.5862267 0.5861233 0.5860199 0.5859163 0.5858126 0.5857088 [120] 0.5856049 0.5855008 0.5853967 0.5852924 0.5851880 0.5850835 0.5849788 [127] 0.5848741 0.5847692 0.5846642 0.5845591 0.5844538 0.5843485 0.5842430 [134] 0.5841374 0.5840317 0.5839259 0.5838200 0.5837139 0.5836077 0.5835015 [141] 0.5833951 0.5832885 0.5831819 0.5830752 0.5829683 0.5828613 0.5827543 [148] 0.5826470 0.5825397 0.5824323 0.5823248 0.5822171 0.5821093 0.5820014 [155] 0.5818934 0.5817853 0.5816771 0.5815688 0.5814603 0.5813518 0.5812431 [162] 0.5811343 0.5810254 0.5809164 0.5808073 0.5806981 0.5805887 0.5804793 [169] 0.5803697 0.5802601 0.5801503 0.5800404 0.5799304 0.5798203 0.5797101 [176] 0.5795998 0.5794893 0.5793788 0.5792681 0.5791574 0.5790465 0.5789356 [183] 0.5788245 0.5787133 0.5786020 0.5784906 0.5783791 0.5782675 0.5781558 [190] 0.5780439 0.5779320 0.5778200 0.5777078 0.5775956 0.5774832 0.5773708 [197] 0.5772582 0.5771455 0.5770328 0.5769199 0.5768069 0.5766938 0.5765807 [204] 0.5764674 0.5763540 0.5762405 0.5761269 0.5760132 0.5758994 0.5757855 [211] 0.5756715 0.5755574 0.5754432 0.5753289 0.5752145 0.5751000 0.5749854 [218] 0.5748707 0.5747558 0.5746409 0.5745259 0.5744108 0.5742956 0.5741803 [225] 0.5740649 0.5739494 0.5738338 0.5737181 0.5736023 0.5734864 0.5733704 [232] 0.5732543 0.5731381 0.5730219 0.5729055 0.5727890 0.5726724 0.5725558 [239] 0.5724390 0.5723221 0.5722052 0.5720881 0.5719710 0.5718537 0.5717364 [246] 0.5716190 0.5715015 0.5713838 0.5712661 0.5711483 0.5710304 0.5709124 [253] 0.5707943 0.5706762 0.5705579 0.5704395 0.5703211 0.5702025 0.5700839 [260] 0.5699652 0.5698464 0.5697274 0.5696084 0.5694893 0.5693702 0.5692509 [267] 0.5691315 0.5690121 0.5688925 0.5687729 0.5686532 0.5685334 0.5684135 [274] 0.5682935 0.5681734 0.5680532 0.5679330 0.5678127 0.5676922 0.5675717 [281] 0.5674511 0.5673304 0.5672097 0.5670888 0.5669679 0.5668468 0.5667257 [288] 0.5666045 0.5664832 0.5663618 0.5662404 0.5661188 0.5659972 0.5658755 [295] 0.5657537 0.5656318 0.5655099 0.5653878 0.5652657 0.5651435 0.5650212 [302] 0.5648988 0.5647764 0.5646538 0.5645312 0.5644085 0.5642857 0.5641628 [309] 0.5640399 0.5639169 0.5637937 0.5636706 0.5635473 0.5634239 0.5633005 [316] 0.5631770 0.5630534 0.5629297 0.5628060 0.5626822 0.5625583 0.5624343 [323] 0.5623102 0.5621861 0.5620619 0.5619376 0.5618132 0.5616888 0.5615642 [330] 0.5614396 0.5613150 0.5611902 0.5610654 0.5609405 0.5608155 0.5606904 [337] 0.5605653 0.5604401 0.5603148 0.5601895 0.5600641 0.5599386 0.5598130 [344] 0.5596873 0.5595616 0.5594358 0.5593100 0.5591840 0.5590580 0.5589319 [351] 0.5588058 0.5586795 0.5585532 0.5584269 0.5583004 0.5581739 0.5580473 [358] 0.5579207 0.5577939 0.5576672 0.5575403 0.5574134 0.5572864 0.5571593 [365] 0.5570321 0.5569049 0.5567776 0.5566503 0.5565229 0.5563954 0.5562679 [372] 0.5561402 0.5560126 0.5558848 0.5557570 0.5556291 0.5555011 0.5553731 [379] 0.5552450 0.5551169 0.5549887 0.5548604 0.5547320 0.5546036 0.5544752 [386] 0.5543466 0.5542180 0.5540893 0.5539606 0.5538318 0.5537030 0.5535740 [393] 0.5534451 0.5533160 0.5531869 0.5530577 0.5529285 0.5527992 0.5526698 [400] 0.5525404 0.5524109 > mx [1] 0.5970832 > 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/1nt3t1258137240.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/2lxk61258137240.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/31i711258137240.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/4lij21258137240.tab") > > system("convert tmp/1nt3t1258137240.ps tmp/1nt3t1258137240.png") > system("convert tmp/2lxk61258137240.ps tmp/2lxk61258137240.png") > system("convert tmp/31i711258137240.ps tmp/31i711258137240.png") > > > proc.time() user system elapsed 0.778 0.510 3.361