R version 2.7.0 (2008-04-22) 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(78.4,114.6,113.3,117.0,99.6,99.4,101.9,115.2,108.5,113.8,121.0,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98.0,106.6,90.1,96.9,125.9,112.0,100.0,123.9,79.8,83.4,113.6,112.9,104.0,109.9,99.0,106.3,128.9,111.1,102.9,130.0,87.0,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137.0,91.0,90.5,122.4,123.3,124.3,120.0,118.1,119.0,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128.0,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > #'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.4424287 0.4427571 0.4430851 0.4434128 0.4437401 0.4440670 0.4443935 [8] 0.4447196 0.4450454 0.4453707 0.4456957 0.4460203 0.4463445 0.4466683 [15] 0.4469918 0.4473148 0.4476374 0.4479597 0.4482815 0.4486030 0.4489240 [22] 0.4492447 0.4495649 0.4498847 0.4502042 0.4505232 0.4508418 0.4511601 [29] 0.4514779 0.4517953 0.4521123 0.4524289 0.4527450 0.4530608 0.4533761 [36] 0.4536910 0.4540055 0.4543196 0.4546333 0.4549465 0.4552593 0.4555717 [43] 0.4558837 0.4561952 0.4565063 0.4568170 0.4571273 0.4574371 0.4577465 [50] 0.4580554 0.4583640 0.4586721 0.4589797 0.4592869 0.4595937 0.4599001 [57] 0.4602060 0.4605114 0.4608164 0.4611210 0.4614251 0.4617288 0.4620320 [64] 0.4623348 0.4626371 0.4629390 0.4632405 0.4635414 0.4638420 0.4641421 [71] 0.4644417 0.4647408 0.4650395 0.4653378 0.4656356 0.4659329 0.4662298 [78] 0.4665262 0.4668221 0.4671176 0.4674126 0.4677071 0.4680012 0.4682948 [85] 0.4685879 0.4688806 0.4691728 0.4694645 0.4697558 0.4700466 0.4703369 [92] 0.4706267 0.4709160 0.4712049 0.4714933 0.4717812 0.4720687 0.4723556 [99] 0.4726421 0.4729281 0.4732136 0.4734986 0.4737831 0.4740672 0.4743507 [106] 0.4746338 0.4749164 0.4751984 0.4754800 0.4757611 0.4760418 0.4763219 [113] 0.4766015 0.4768806 0.4771593 0.4774374 0.4777150 0.4779922 0.4782688 [120] 0.4785449 0.4788206 0.4790957 0.4793703 0.4796445 0.4799181 0.4801912 [127] 0.4804638 0.4807359 0.4810075 0.4812786 0.4815492 0.4818192 0.4820888 [134] 0.4823578 0.4826264 0.4828944 0.4831619 0.4834289 0.4836954 0.4839613 [141] 0.4842268 0.4844917 0.4847561 0.4850200 0.4852833 0.4855462 0.4858085 [148] 0.4860703 0.4863316 0.4865924 0.4868526 0.4871123 0.4873715 0.4876301 [155] 0.4878883 0.4881459 0.4884029 0.4886595 0.4889155 0.4891710 0.4894259 [162] 0.4896804 0.4899343 0.4901876 0.4904404 0.4906927 0.4909445 0.4911957 [169] 0.4914464 0.4916965 0.4919462 0.4921952 0.4924438 0.4926917 0.4929392 [176] 0.4931861 0.4934325 0.4936783 0.4939236 0.4941684 0.4944126 0.4946562 [183] 0.4948993 0.4951419 0.4953839 0.4956254 0.4958663 0.4961067 0.4963465 [190] 0.4965858 0.4968246 0.4970627 0.4973004 0.4975375 0.4977740 0.4980100 [197] 0.4982454 0.4984803 0.4987146 0.4989484 0.4991816 0.4994143 0.4996464 [204] 0.4998779 0.5001089 0.5003393 0.5005692 0.5007985 0.5010273 0.5012555 [211] 0.5014831 0.5017102 0.5019368 0.5021627 0.5023881 0.5026129 0.5028372 [218] 0.5030609 0.5032841 0.5035067 0.5037287 0.5039502 0.5041710 0.5043914 [225] 0.5046111 0.5048303 0.5050490 0.5052670 0.5054845 0.5057014 0.5059178 [232] 0.5061336 0.5063488 0.5065635 0.5067775 0.5069910 0.5072040 0.5074163 [239] 0.5076281 0.5078394 0.5080500 0.5082601 0.5084696 0.5086785 0.5088869 [246] 0.5090947 0.5093019 0.5095085 0.5097146 0.5099201 0.5101250 0.5103293 [253] 0.5105330 0.5107362 0.5109388 0.5111408 0.5113423 0.5115431 0.5117434 [260] 0.5119431 0.5121423 0.5123408 0.5125388 0.5127362 0.5129330 0.5131292 [267] 0.5133249 0.5135199 0.5137144 0.5139083 0.5141016 0.5142944 0.5144865 [274] 0.5146781 0.5148691 0.5150595 0.5152493 0.5154385 0.5156272 0.5158153 [281] 0.5160027 0.5161896 0.5163759 0.5165617 0.5167468 0.5169314 0.5171153 [288] 0.5172987 0.5174815 0.5176637 0.5178453 0.5180264 0.5182068 0.5183867 [295] 0.5185659 0.5187446 0.5189227 0.5191002 0.5192771 0.5194535 0.5196292 [302] 0.5198043 0.5199789 0.5201529 0.5203262 0.5204990 0.5206712 0.5208428 [309] 0.5210138 0.5211843 0.5213541 0.5215233 0.5216920 0.5218601 0.5220275 [316] 0.5221944 0.5223607 0.5225264 0.5226915 0.5228560 0.5230199 0.5231832 [323] 0.5233460 0.5235081 0.5236697 0.5238306 0.5239910 0.5241507 0.5243099 [330] 0.5244685 0.5246265 0.5247839 0.5249407 0.5250969 0.5252525 0.5254075 [337] 0.5255620 0.5257158 0.5258690 0.5260217 0.5261737 0.5263252 0.5264760 [344] 0.5266263 0.5267760 0.5269251 0.5270735 0.5272214 0.5273687 0.5275154 [351] 0.5276615 0.5278071 0.5279520 0.5280963 0.5282400 0.5283832 0.5285257 [358] 0.5286676 0.5288090 0.5289497 0.5290899 0.5292295 0.5293684 0.5295068 [365] 0.5296446 0.5297818 0.5299184 0.5300544 0.5301898 0.5303246 0.5304588 [372] 0.5305924 0.5307254 0.5308579 0.5309897 0.5311209 0.5312516 0.5313816 [379] 0.5315111 0.5316399 0.5317682 0.5318959 0.5320230 0.5321495 0.5322753 [386] 0.5324006 0.5325253 0.5326495 0.5327730 0.5328959 0.5330182 0.5331400 [393] 0.5332611 0.5333817 0.5335016 0.5336210 0.5337398 0.5338579 0.5339755 [400] 0.5340925 0.5342089 > mx [1] 0.5342089 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/192iy1226509359.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/21oi71226509359.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/3g7q31226509359.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/403v41226509359.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/5j6en1226509359.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/6x00d1226509359.tab") > > system("convert tmp/192iy1226509359.ps tmp/192iy1226509359.png") > system("convert tmp/21oi71226509359.ps tmp/21oi71226509359.png") > system("convert tmp/3g7q31226509359.ps tmp/3g7q31226509359.png") > system("convert tmp/403v41226509359.ps tmp/403v41226509359.png") > system("convert tmp/5j6en1226509359.ps tmp/5j6en1226509359.png") > > > proc.time() user system elapsed 2.397 1.293 2.569