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(10570,10297,10635,10872,10296,10383,10431,10574,10653,10805,10872,10625,10407,10463,10556,10646,10702,11353,11346,11451,11964,12574,13031,13812,14544,14931,14886,16005,17064,15168,16050,15839,15137,14954,15648,15305,15579,16348,15928,16171,15937,15713,15594,15683,16438,17032,17696,17745,19394,20148,20108,18584,18441,18391,19178,18079,18483,19644,19195,19650) > x <- c(6802.96,7132.68,7073.29,7264.5,7105.33,7218.71,7225.72,7354.25,7745.46,8070.26,8366.33,8667.51,8854.34,9218.1,9332.9,9358.31,9248.66,9401.2,9652.04,9957.38,10110.63,10169.26,10343.78,10750.21,11337.5,11786.96,12083.04,12007.74,11745.93,11051.51,11445.9,11924.88,12247.63,12690.91,12910.7,13202.12,13654.67,13862.82,13523.93,14211.17,14510.35,14289.23,14111.82,13086.59,13351.54,13747.69,12855.61,12926.93,12121.95,11731.65,11639.51,12163.78,12029.53,11234.18,9852.13,9709.04,9332.75,7108.6,6691.49,6143.05) > #'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.4098529 0.4103099 0.4107661 0.4112214 0.4116759 0.4121296 0.4125824 [8] 0.4130344 0.4134856 0.4139359 0.4143853 0.4148339 0.4152817 0.4157286 [15] 0.4161746 0.4166197 0.4170640 0.4175074 0.4179499 0.4183916 0.4188323 [22] 0.4192722 0.4197112 0.4201492 0.4205864 0.4210227 0.4214580 0.4218925 [29] 0.4223260 0.4227586 0.4231904 0.4236211 0.4240510 0.4244799 0.4249079 [36] 0.4253349 0.4257610 0.4261862 0.4266104 0.4270337 0.4274560 0.4278773 [43] 0.4282977 0.4287172 0.4291356 0.4295531 0.4299696 0.4303851 0.4307997 [50] 0.4312133 0.4316258 0.4320374 0.4324480 0.4328576 0.4332662 0.4336738 [57] 0.4340804 0.4344860 0.4348905 0.4352941 0.4356966 0.4360981 0.4364986 [64] 0.4368980 0.4372965 0.4376938 0.4380902 0.4384855 0.4388797 0.4392729 [71] 0.4396651 0.4400562 0.4404462 0.4408352 0.4412231 0.4416100 0.4419958 [78] 0.4423805 0.4427641 0.4431467 0.4435282 0.4439086 0.4442879 0.4446661 [85] 0.4450432 0.4454192 0.4457942 0.4461680 0.4465407 0.4469123 0.4472828 [92] 0.4476522 0.4480205 0.4483877 0.4487537 0.4491186 0.4494824 0.4498451 [99] 0.4502066 0.4505670 0.4509263 0.4512844 0.4516414 0.4519972 0.4523519 [106] 0.4527054 0.4530578 0.4534090 0.4537591 0.4541080 0.4544557 0.4548023 [113] 0.4551477 0.4554919 0.4558350 0.4561768 0.4565175 0.4568571 0.4571954 [120] 0.4575326 0.4578685 0.4582033 0.4585369 0.4588693 0.4592005 0.4595305 [127] 0.4598592 0.4601868 0.4605132 0.4608384 0.4611623 0.4614851 0.4618066 [134] 0.4621269 0.4624460 0.4627639 0.4630805 0.4633959 0.4637101 0.4640231 [141] 0.4643348 0.4646453 0.4649546 0.4652626 0.4655694 0.4658749 0.4661792 [148] 0.4664823 0.4667841 0.4670846 0.4673839 0.4676819 0.4679787 0.4682743 [155] 0.4685685 0.4688615 0.4691533 0.4694438 0.4697330 0.4700209 0.4703076 [162] 0.4705930 0.4708772 0.4711600 0.4714416 0.4717219 0.4720009 0.4722787 [169] 0.4725551 0.4728303 0.4731042 0.4733768 0.4736481 0.4739182 0.4741869 [176] 0.4744543 0.4747205 0.4749854 0.4752489 0.4755112 0.4757721 0.4760318 [183] 0.4762902 0.4765472 0.4768030 0.4770574 0.4773105 0.4775624 0.4778129 [190] 0.4780621 0.4783100 0.4785566 0.4788019 0.4790458 0.4792885 0.4795298 [197] 0.4797698 0.4800085 0.4802459 0.4804819 0.4807166 0.4809501 0.4811821 [204] 0.4814129 0.4816423 0.4818704 0.4820972 0.4823227 0.4825468 0.4827696 [211] 0.4829911 0.4832112 0.4834300 0.4836475 0.4838637 0.4840785 0.4842920 [218] 0.4845041 0.4847149 0.4849244 0.4851326 0.4853394 0.4855448 0.4857490 [225] 0.4859518 0.4861532 0.4863534 0.4865522 0.4867496 0.4869457 0.4871405 [232] 0.4873339 0.4875260 0.4877168 0.4879062 0.4880943 0.4882810 0.4884664 [239] 0.4886504 0.4888332 0.4890145 0.4891946 0.4893732 0.4895506 0.4897266 [246] 0.4899013 0.4900746 0.4902466 0.4904172 0.4905865 0.4907545 0.4909211 [253] 0.4910864 0.4912504 0.4914130 0.4915742 0.4917341 0.4918927 0.4920500 [260] 0.4922059 0.4923605 0.4925137 0.4926656 0.4928162 0.4929654 0.4931133 [267] 0.4932598 0.4934050 0.4935489 0.4936915 0.4938327 0.4939726 0.4941111 [274] 0.4942483 0.4943842 0.4945188 0.4946520 0.4947839 0.4949144 0.4950437 [281] 0.4951716 0.4952982 0.4954234 0.4955473 0.4956699 0.4957912 0.4959112 [288] 0.4960298 0.4961471 0.4962631 0.4963778 0.4964912 0.4966032 0.4967139 [295] 0.4968233 0.4969314 0.4970382 0.4971437 0.4972478 0.4973507 0.4974522 [302] 0.4975524 0.4976514 0.4977490 0.4978453 0.4979403 0.4980340 0.4981264 [309] 0.4982175 0.4983073 0.4983958 0.4984830 0.4985689 0.4986535 0.4987369 [316] 0.4988189 0.4988997 0.4989791 0.4990573 0.4991342 0.4992098 0.4992841 [323] 0.4993572 0.4994289 0.4994994 0.4995686 0.4996365 0.4997032 0.4997686 [330] 0.4998327 0.4998955 0.4999571 0.5000174 0.5000765 0.5001343 0.5001908 [337] 0.5002461 0.5003001 0.5003529 0.5004044 0.5004546 0.5005036 0.5005514 [344] 0.5005979 0.5006431 0.5006872 0.5007299 0.5007715 0.5008118 0.5008508 [351] 0.5008887 0.5009253 0.5009607 0.5009948 0.5010277 0.5010594 0.5010899 [358] 0.5011191 0.5011472 0.5011740 0.5011996 0.5012240 0.5012472 0.5012692 [365] 0.5012899 0.5013095 0.5013279 0.5013450 0.5013610 0.5013758 0.5013894 [372] 0.5014018 0.5014130 0.5014230 0.5014318 0.5014395 0.5014460 0.5014513 [379] 0.5014554 0.5014583 0.5014601 0.5014607 0.5014602 0.5014585 0.5014556 [386] 0.5014516 0.5014464 0.5014400 0.5014325 0.5014239 0.5014141 0.5014032 [393] 0.5013911 0.5013779 0.5013635 0.5013480 0.5013314 0.5013136 0.5012948 [400] 0.5012748 0.5012536 > mx [1] 0.5014607 > mxli [1] 1.81 > 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/1111f1257849390.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/2488q1257849390.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/32ors1257849390.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/4n21h1257849391.tab") > > system("convert tmp/1111f1257849390.ps tmp/1111f1257849390.png") > system("convert tmp/2488q1257849390.ps tmp/2488q1257849390.png") > system("convert tmp/32ors1257849390.ps tmp/32ors1257849390.png") > > > proc.time() user system elapsed 0.768 0.498 0.978