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(5.7,6.1,6,5.9,5.8,5.7,5.6,5.4,5.4,5.5,5.6,5.7,5.9,6.1,6,5.8,5.8,5.7,5.5,5.3,5.2,5.2,5,5.1,5.1,5.2,4.9,4.8,4.5,4.5,4.4,4.4,4.2,4.1,3.9,3.8,3.9,4.2,4.1,3.8,3.6,3.7,3.5,3.4,3.1,3.1,3.1,3.2,3.3,3.5,3.6,3.5,3.3,3.2,3.1,3.2,3,3,3.1,3.4) > x <- c(91.4,91.1,104.4,97.6,93.7,104.5,95.4,86.5,102.9,101.9,103.7,100.7,94.2,93.6,104.7,101,97.6,105.8,93.7,91.2,106.3,103.4,107.4,101.2,96.9,96.3,109.8,97.9,105.1,107.9,95,95.2,105.8,110.1,112.2,102.5,103.7,102,112.3,103.3,106.9,104.6,100.7,99,106.5,114.9,114.1,102.2,107,107.4,107.4,110.1,105.6,110.9,101.9,93.2,110.5,113.1,101.7,96.7) > #'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.5056788 -0.5057286 -0.5057783 -0.5058280 -0.5058776 -0.5059271 [7] -0.5059766 -0.5060260 -0.5060754 -0.5061246 -0.5061739 -0.5062230 [13] -0.5062721 -0.5063211 -0.5063701 -0.5064190 -0.5064678 -0.5065166 [19] -0.5065653 -0.5066140 -0.5066625 -0.5067110 -0.5067595 -0.5068079 [25] -0.5068562 -0.5069045 -0.5069526 -0.5070008 -0.5070488 -0.5070968 [31] -0.5071448 -0.5071926 -0.5072404 -0.5072882 -0.5073359 -0.5073835 [37] -0.5074310 -0.5074785 -0.5075259 -0.5075733 -0.5076206 -0.5076678 [43] -0.5077149 -0.5077620 -0.5078091 -0.5078560 -0.5079029 -0.5079498 [49] -0.5079966 -0.5080433 -0.5080899 -0.5081365 -0.5081830 -0.5082295 [55] -0.5082758 -0.5083222 -0.5083684 -0.5084146 -0.5084607 -0.5085068 [61] -0.5085528 -0.5085987 -0.5086446 -0.5086904 -0.5087362 -0.5087818 [67] -0.5088274 -0.5088730 -0.5089185 -0.5089639 -0.5090092 -0.5090545 [73] -0.5090998 -0.5091449 -0.5091900 -0.5092350 -0.5092800 -0.5093249 [79] -0.5093697 -0.5094145 -0.5094592 -0.5095039 -0.5095484 -0.5095930 [85] -0.5096374 -0.5096818 -0.5097261 -0.5097704 -0.5098146 -0.5098587 [91] -0.5099028 -0.5099467 -0.5099907 -0.5100345 -0.5100784 -0.5101221 [97] -0.5101658 -0.5102094 -0.5102529 -0.5102964 -0.5103398 -0.5103832 [103] -0.5104264 -0.5104697 -0.5105128 -0.5105559 -0.5105989 -0.5106419 [109] -0.5106848 -0.5107276 -0.5107704 -0.5108131 -0.5108558 -0.5108983 [115] -0.5109408 -0.5109833 -0.5110257 -0.5110680 -0.5111102 -0.5111524 [121] -0.5111945 -0.5112366 -0.5112786 -0.5113205 -0.5113624 -0.5114042 [127] -0.5114459 -0.5114876 -0.5115292 -0.5115707 -0.5116122 -0.5116536 [133] -0.5116950 -0.5117362 -0.5117775 -0.5118186 -0.5118597 -0.5119007 [139] -0.5119417 -0.5119826 -0.5120234 -0.5120642 -0.5121049 -0.5121455 [145] -0.5121861 -0.5122266 -0.5122670 -0.5123074 -0.5123477 -0.5123880 [151] -0.5124281 -0.5124683 -0.5125083 -0.5125483 -0.5125882 -0.5126281 [157] -0.5126679 -0.5127076 -0.5127473 -0.5127869 -0.5128264 -0.5128659 [163] -0.5129053 -0.5129446 -0.5129839 -0.5130231 -0.5130623 -0.5131014 [169] -0.5131404 -0.5131793 -0.5132182 -0.5132570 -0.5132958 -0.5133345 [175] -0.5133731 -0.5134117 -0.5134502 -0.5134886 -0.5135270 -0.5135653 [181] -0.5136035 -0.5136417 -0.5136798 -0.5137179 -0.5137559 -0.5137938 [187] -0.5138316 -0.5138694 -0.5139072 -0.5139448 -0.5139824 -0.5140200 [193] -0.5140574 -0.5140948 -0.5141322 -0.5141694 -0.5142066 -0.5142438 [199] -0.5142809 -0.5143179 -0.5143548 -0.5143917 -0.5144285 -0.5144653 [205] -0.5145020 -0.5145386 -0.5145752 -0.5146117 -0.5146481 -0.5146845 [211] -0.5147208 -0.5147570 -0.5147932 -0.5148293 -0.5148654 -0.5149014 [217] -0.5149373 -0.5149731 -0.5150089 -0.5150446 -0.5150803 -0.5151159 [223] -0.5151514 -0.5151869 -0.5152223 -0.5152576 -0.5152929 -0.5153281 [229] -0.5153633 -0.5153983 -0.5154334 -0.5154683 -0.5155032 -0.5155380 [235] -0.5155728 -0.5156075 -0.5156421 -0.5156767 -0.5157112 -0.5157456 [241] -0.5157800 -0.5158143 -0.5158485 -0.5158827 -0.5159168 -0.5159508 [247] -0.5159848 -0.5160187 -0.5160526 -0.5160864 -0.5161201 -0.5161538 [253] -0.5161874 -0.5162209 -0.5162544 -0.5162878 -0.5163211 -0.5163544 [259] -0.5163876 -0.5164208 -0.5164538 -0.5164869 -0.5165198 -0.5165527 [265] -0.5165855 -0.5166183 -0.5166510 -0.5166836 -0.5167162 -0.5167487 [271] -0.5167811 -0.5168135 -0.5168458 -0.5168781 -0.5169103 -0.5169424 [277] -0.5169744 -0.5170064 -0.5170383 -0.5170702 -0.5171020 -0.5171337 [283] -0.5171654 -0.5171970 -0.5172286 -0.5172600 -0.5172914 -0.5173228 [289] -0.5173541 -0.5173853 -0.5174165 -0.5174475 -0.5174786 -0.5175095 [295] -0.5175404 -0.5175713 -0.5176020 -0.5176328 -0.5176634 -0.5176940 [301] -0.5177245 -0.5177549 -0.5177853 -0.5178157 -0.5178459 -0.5178761 [307] -0.5179062 -0.5179363 -0.5179663 -0.5179962 -0.5180261 -0.5180559 [313] -0.5180857 -0.5181154 -0.5181450 -0.5181745 -0.5182040 -0.5182335 [319] -0.5182628 -0.5182921 -0.5183214 -0.5183505 -0.5183796 -0.5184087 [325] -0.5184377 -0.5184666 -0.5184954 -0.5185242 -0.5185529 -0.5185816 [331] -0.5186102 -0.5186387 -0.5186672 -0.5186956 -0.5187239 -0.5187522 [337] -0.5187804 -0.5188086 -0.5188367 -0.5188647 -0.5188927 -0.5189206 [343] -0.5189484 -0.5189762 -0.5190039 -0.5190315 -0.5190591 -0.5190866 [349] -0.5191140 -0.5191414 -0.5191687 -0.5191960 -0.5192232 -0.5192503 [355] -0.5192774 -0.5193044 -0.5193313 -0.5193582 -0.5193850 -0.5194118 [361] -0.5194385 -0.5194651 -0.5194917 -0.5195182 -0.5195446 -0.5195710 [367] -0.5195973 -0.5196235 -0.5196497 -0.5196758 -0.5197019 -0.5197278 [373] -0.5197538 -0.5197796 -0.5198054 -0.5198312 -0.5198568 -0.5198824 [379] -0.5199080 -0.5199335 -0.5199589 -0.5199842 -0.5200095 -0.5200348 [385] -0.5200599 -0.5200850 -0.5201101 -0.5201350 -0.5201600 -0.5201848 [391] -0.5202096 -0.5202343 -0.5202590 -0.5202836 -0.5203081 -0.5203326 [397] -0.5203570 -0.5203813 -0.5204056 -0.5204298 -0.5204540 > mx [1] 0.520454 > 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/18hc31258012799.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/2ac0h1258012799.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/39o711258012799.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/48jnx1258012799.tab") > > system("convert tmp/18hc31258012799.ps tmp/18hc31258012799.png") > system("convert tmp/2ac0h1258012799.ps tmp/2ac0h1258012799.png") > system("convert tmp/39o711258012799.ps tmp/39o711258012799.png") > > > proc.time() user system elapsed 0.768 0.499 0.931