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(7.1,6.8,6.9,7.2,7.4,7.3,6.9,6.9,6.8,7.1,7.2,7.1,7,6.9,7.1,7.3,7.5,7.5,7.5,7.3,7,6.7,6.5,6.5,6.5,6.6,6.8,6.9,6.9,6.8,6.8,6.5,6.1,6.1,5.9,5.7,5.9,5.9,6.1,6.3,6.2,5.9,5.7,5.4,5.6,6.2,6.3,6,5.6,5.5,5.9,6.5,6.8,6.8,6.5,6.2,6.2,6.5,6.7,6.6) > x <- c(23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24,23.2) > #'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.5571752 0.5570676 0.5569592 0.5568502 0.5567405 0.5566301 0.5565190 [8] 0.5564072 0.5562948 0.5561816 0.5560678 0.5559533 0.5558381 0.5557222 [15] 0.5556057 0.5554885 0.5553706 0.5552520 0.5551327 0.5550128 0.5548922 [22] 0.5547709 0.5546489 0.5545263 0.5544030 0.5542790 0.5541544 0.5540291 [29] 0.5539031 0.5537764 0.5536491 0.5535211 0.5533925 0.5532631 0.5531331 [36] 0.5530025 0.5528712 0.5527392 0.5526066 0.5524733 0.5523393 0.5522047 [43] 0.5520694 0.5519335 0.5517969 0.5516597 0.5515218 0.5513833 0.5512441 [50] 0.5511042 0.5509637 0.5508226 0.5506808 0.5505383 0.5503952 0.5502515 [57] 0.5501071 0.5499621 0.5498164 0.5496701 0.5495232 0.5493756 0.5492274 [64] 0.5490785 0.5489290 0.5487789 0.5486281 0.5484767 0.5483247 0.5481720 [71] 0.5480187 0.5478648 0.5477103 0.5475551 0.5473993 0.5472429 0.5470858 [78] 0.5469282 0.5467699 0.5466110 0.5464514 0.5462913 0.5461305 0.5459692 [85] 0.5458072 0.5456446 0.5454813 0.5453175 0.5451531 0.5449881 0.5448224 [92] 0.5446562 0.5444893 0.5443218 0.5441538 0.5439851 0.5438159 0.5436460 [99] 0.5434755 0.5433045 0.5431329 0.5429606 0.5427878 0.5426144 0.5424404 [106] 0.5422658 0.5420906 0.5419148 0.5417385 0.5415615 0.5413840 0.5412059 [113] 0.5410273 0.5408480 0.5406682 0.5404878 0.5403068 0.5401253 0.5399432 [120] 0.5397605 0.5395773 0.5393935 0.5392091 0.5390241 0.5388386 0.5386526 [127] 0.5384660 0.5382788 0.5380911 0.5379028 0.5377139 0.5375245 0.5373346 [134] 0.5371441 0.5369531 0.5367615 0.5365694 0.5363767 0.5361835 0.5359897 [141] 0.5357954 0.5356006 0.5354052 0.5352094 0.5350129 0.5348160 0.5346185 [148] 0.5344205 0.5342219 0.5340229 0.5338233 0.5336231 0.5334225 0.5332214 [155] 0.5330197 0.5328175 0.5326148 0.5324116 0.5322079 0.5320037 0.5317989 [162] 0.5315937 0.5313879 0.5311817 0.5309749 0.5307677 0.5305599 0.5303517 [169] 0.5301429 0.5299337 0.5297240 0.5295137 0.5293030 0.5290918 0.5288802 [176] 0.5286680 0.5284554 0.5282422 0.5280286 0.5278145 0.5276000 0.5273850 [183] 0.5271694 0.5269535 0.5267370 0.5265201 0.5263027 0.5260849 0.5258666 [190] 0.5256478 0.5254286 0.5252089 0.5249888 0.5247682 0.5245471 0.5243256 [197] 0.5241037 0.5238813 0.5236585 0.5234352 0.5232115 0.5229873 0.5227627 [204] 0.5225377 0.5223122 0.5220863 0.5218599 0.5216331 0.5214059 0.5211783 [211] 0.5209502 0.5207218 0.5204929 0.5202635 0.5200338 0.5198036 0.5195731 [218] 0.5193421 0.5191107 0.5188789 0.5186467 0.5184140 0.5181810 0.5179476 [225] 0.5177137 0.5174795 0.5172449 0.5170098 0.5167744 0.5165386 0.5163024 [232] 0.5160658 0.5158288 0.5155914 0.5153537 0.5151155 0.5148770 0.5146381 [239] 0.5143988 0.5141592 0.5139192 0.5136788 0.5134380 0.5131969 0.5129554 [246] 0.5127135 0.5124713 0.5122287 0.5119857 0.5117424 0.5114988 0.5112547 [253] 0.5110104 0.5107656 0.5105206 0.5102751 0.5100294 0.5097833 0.5095368 [260] 0.5092900 0.5090429 0.5087954 0.5085476 0.5082994 0.5080510 0.5078022 [267] 0.5075530 0.5073036 0.5070538 0.5068037 0.5065533 0.5063025 0.5060514 [274] 0.5058001 0.5055484 0.5052964 0.5050440 0.5047914 0.5045385 0.5042852 [281] 0.5040317 0.5037778 0.5035237 0.5032692 0.5030145 0.5027594 0.5025041 [288] 0.5022485 0.5019926 0.5017364 0.5014799 0.5012231 0.5009660 0.5007087 [295] 0.5004511 0.5001932 0.4999350 0.4996765 0.4994178 0.4991588 0.4988995 [302] 0.4986400 0.4983802 0.4981201 0.4978598 0.4975992 0.4973384 0.4970773 [309] 0.4968159 0.4965543 0.4962924 0.4960303 0.4957680 0.4955053 0.4952425 [316] 0.4949794 0.4947160 0.4944525 0.4941886 0.4939246 0.4936603 0.4933957 [323] 0.4931310 0.4928660 0.4926008 0.4923353 0.4920696 0.4918038 0.4915376 [330] 0.4912713 0.4910047 0.4907380 0.4904710 0.4902038 0.4899364 0.4896687 [337] 0.4894009 0.4891329 0.4888646 0.4885962 0.4883275 0.4880587 0.4877896 [344] 0.4875204 0.4872509 0.4869813 0.4867115 0.4864414 0.4861712 0.4859008 [351] 0.4856303 0.4853595 0.4850886 0.4848174 0.4845461 0.4842746 0.4840030 [358] 0.4837312 0.4834591 0.4831870 0.4829146 0.4826421 0.4823694 0.4820966 [365] 0.4818236 0.4815504 0.4812771 0.4810036 0.4807300 0.4804562 0.4801822 [372] 0.4799081 0.4796338 0.4793594 0.4790849 0.4788102 0.4785354 0.4782604 [379] 0.4779853 0.4777100 0.4774346 0.4771591 0.4768834 0.4766076 0.4763316 [386] 0.4760556 0.4757794 0.4755031 0.4752266 0.4749500 0.4746733 0.4743965 [393] 0.4741196 0.4738425 0.4735654 0.4732881 0.4730107 0.4727332 0.4724556 [400] 0.4721778 0.4719000 > mx [1] 0.5571752 > 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/1qrij1258119868.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/2rbxy1258119868.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/3mk0m1258119868.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/4sqsh1258119868.tab") > > system("convert tmp/1qrij1258119868.ps tmp/1qrij1258119868.png") > system("convert tmp/2rbxy1258119868.ps tmp/2rbxy1258119868.png") > system("convert tmp/3mk0m1258119868.ps tmp/3mk0m1258119868.png") > > > proc.time() user system elapsed 0.771 0.502 1.121