R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. > x <- c(10967.87,10433.56,10665.78,10666.71,10682.74,10777.22,10052.6,10213.97,10546.82,10767.2,10444.5,10314.68,9042.56,9220.75,9721.84,9978.53,9923.81,9892.56,10500.98,10179.35,10080.48,9492.44,8616.49,8685.4,8160.67,8048.1,8641.21,8526.63,8474.21,7916.13,7977.64,8334.59,8623.36,9098.03,9154.34,9284.73,9492.49,9682.35,9762.12,10124.63,10540.05,10601.61,10323.73,10418.4,10092.96,10364.91,10152.09,10032.8,10204.59,10001.6,10411.75,10673.38,10539.51,10723.78,10682.06,10283.19,10377.18,10486.64,10545.38,10554.27,10532.54,10324.31,10695.25,10827.81,10872.48,10971.19,11145.65,11234.68,11333.88,10997.97,11036.89,11257.35,11533.59,11963.12,12185.15,12377.62,12512.89,12631.48,12268.53,12754.8,13407.75,13480.21,13673.28,13239.71,13557.69,13901.28,13200.58,13406.97,12538.12,12419.57,12193.88,12656.63,12812.48,12056.67,11322.38,11530.75,11114.08,9181.73,8614.55) > #'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(qnorm(ppoints(x), mean=0, sd=1),x1) + if (mx < c[i]) + { + mx <- c[i] + mxli <- l[i] + } + } > c [1] 0.4528373 0.4531375 0.4534375 0.4537372 0.4540366 0.4543359 0.4546349 [8] 0.4549336 0.4552322 0.4555304 0.4558285 0.4561262 0.4564238 0.4567211 [15] 0.4570181 0.4573149 0.4576114 0.4579077 0.4582037 0.4584995 0.4587950 [22] 0.4590902 0.4593852 0.4596799 0.4599743 0.4602685 0.4605624 0.4608560 [29] 0.4611494 0.4614425 0.4617353 0.4620278 0.4623201 0.4626121 0.4629038 [36] 0.4631952 0.4634863 0.4637771 0.4640677 0.4643580 0.4646479 0.4649376 [43] 0.4652270 0.4655161 0.4658049 0.4660934 0.4663816 0.4666695 0.4669571 [50] 0.4672443 0.4675313 0.4678180 0.4681044 0.4683904 0.4686762 0.4689616 [57] 0.4692467 0.4695315 0.4698160 0.4701001 0.4703840 0.4706675 0.4709507 [64] 0.4712336 0.4715161 0.4717983 0.4720802 0.4723618 0.4726430 0.4729239 [71] 0.4732044 0.4734846 0.4737645 0.4740441 0.4743233 0.4746021 0.4748806 [78] 0.4751588 0.4754366 0.4757141 0.4759912 0.4762680 0.4765444 0.4768205 [85] 0.4770962 0.4773715 0.4776465 0.4779211 0.4781954 0.4784693 0.4787429 [92] 0.4790161 0.4792889 0.4795613 0.4798334 0.4801051 0.4803764 0.4806474 [99] 0.4809180 0.4811882 0.4814580 0.4817275 0.4819966 0.4822653 0.4825336 [106] 0.4828015 0.4830690 0.4833362 0.4836030 0.4838693 0.4841353 0.4844009 [113] 0.4846661 0.4849309 0.4851953 0.4854594 0.4857230 0.4859862 0.4862490 [120] 0.4865114 0.4867734 0.4870350 0.4872962 0.4875570 0.4878174 0.4880774 [127] 0.4883369 0.4885961 0.4888548 0.4891131 0.4893710 0.4896285 0.4898856 [134] 0.4901422 0.4903984 0.4906542 0.4909096 0.4911645 0.4914191 0.4916732 [141] 0.4919268 0.4921801 0.4924329 0.4926853 0.4929372 0.4931887 0.4934398 [148] 0.4936904 0.4939406 0.4941904 0.4944397 0.4946886 0.4949370 0.4951850 [155] 0.4954326 0.4956797 0.4959263 0.4961725 0.4964183 0.4966636 0.4969084 [162] 0.4971528 0.4973968 0.4976403 0.4978833 0.4981259 0.4983680 0.4986097 [169] 0.4988509 0.4990916 0.4993319 0.4995717 0.4998111 0.5000500 0.5002884 [176] 0.5005263 0.5007638 0.5010008 0.5012374 0.5014734 0.5017090 0.5019442 [183] 0.5021788 0.5024130 0.5026467 0.5028799 0.5031126 0.5033449 0.5035767 [190] 0.5038080 0.5040388 0.5042691 0.5044990 0.5047284 0.5049572 0.5051856 [197] 0.5054135 0.5056409 0.5058679 0.5060943 0.5063202 0.5065457 0.5067706 [204] 0.5069951 0.5072191 0.5074425 0.5076655 0.5078880 0.5081100 0.5083314 [211] 0.5085524 0.5087729 0.5089928 0.5092123 0.5094313 0.5096497 0.5098677 [218] 0.5100851 0.5103021 0.5105185 0.5107344 0.5109498 0.5111648 0.5113791 [225] 0.5115930 0.5118064 0.5120193 0.5122316 0.5124434 0.5126547 0.5128655 [232] 0.5130758 0.5132856 0.5134948 0.5137035 0.5139117 0.5141194 0.5143266 [239] 0.5145332 0.5147393 0.5149449 0.5151500 0.5153545 0.5155585 0.5157620 [246] 0.5159650 0.5161674 0.5163693 0.5165707 0.5167716 0.5169719 0.5171717 [253] 0.5173709 0.5175696 0.5177678 0.5179655 0.5181626 0.5183592 0.5185553 [260] 0.5187508 0.5189458 0.5191402 0.5193342 0.5195275 0.5197204 0.5199127 [267] 0.5201044 0.5202956 0.5204863 0.5206765 0.5208661 0.5210551 0.5212436 [274] 0.5214316 0.5216190 0.5218059 0.5219923 0.5221780 0.5223633 0.5225480 [281] 0.5227322 0.5229158 0.5230988 0.5232814 0.5234633 0.5236447 0.5238256 [288] 0.5240059 0.5241857 0.5243649 0.5245436 0.5247217 0.5248993 0.5250763 [295] 0.5252528 0.5254287 0.5256041 0.5257789 0.5259531 0.5261269 0.5263000 [302] 0.5264726 0.5266446 0.5268161 0.5269871 0.5271574 0.5273273 0.5274965 [309] 0.5276652 0.5278334 0.5280010 0.5281680 0.5283345 0.5285004 0.5286658 [316] 0.5288306 0.5289948 0.5291585 0.5293217 0.5294842 0.5296462 0.5298077 [323] 0.5299686 0.5301289 0.5302887 0.5304479 0.5306065 0.5307646 0.5309222 [330] 0.5310791 0.5312355 0.5313914 0.5315467 0.5317014 0.5318555 0.5320091 [337] 0.5321622 0.5323146 0.5324665 0.5326179 0.5327687 0.5329189 0.5330686 [344] 0.5332177 0.5333662 0.5335142 0.5336616 0.5338084 0.5339547 0.5341004 [351] 0.5342455 0.5343901 0.5345342 0.5346776 0.5348205 0.5349629 0.5351046 [358] 0.5352458 0.5353865 0.5355265 0.5356661 0.5358050 0.5359434 0.5360812 [365] 0.5362185 0.5363552 0.5364913 0.5366269 0.5367619 0.5368963 0.5370302 [372] 0.5371635 0.5372963 0.5374284 0.5375601 0.5376911 0.5378216 0.5379516 [379] 0.5380809 0.5382097 0.5383380 0.5384657 0.5385928 0.5387193 0.5388453 [386] 0.5389708 0.5390956 0.5392200 0.5393437 0.5394669 0.5395895 0.5397116 [393] 0.5398331 0.5399540 0.5400744 0.5401942 0.5403135 0.5404322 0.5405503 [400] 0.5406679 0.5407849 > mx [1] 0.5407849 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1xxf81229169561.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Normality Plot',xlab='Lambda',ylab='correlation') > mtext(paste('Optimal Lambda =',mxli)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2sd5a1229169561.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x,main='Histogram of Original Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3hdz31229169561.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x1,main='Histogram of Transformed Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4msrw1229169561.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/54w4v1229169561.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > qqline(x1) > grid() > mtext('Transformed Data') > 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 Normality 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',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/6lzc01229169561.tab") > > system("convert tmp/1xxf81229169561.ps tmp/1xxf81229169561.png") > system("convert tmp/2sd5a1229169561.ps tmp/2sd5a1229169561.png") > system("convert tmp/3hdz31229169561.ps tmp/3hdz31229169561.png") > system("convert tmp/4msrw1229169561.ps tmp/4msrw1229169561.png") > system("convert tmp/54w4v1229169561.ps tmp/54w4v1229169561.png") > > > proc.time() user system elapsed 1.090 0.803 1.301