R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(09.166456,07.970589,07.104091,06.621064,07.529215,08.170938,08.157450,07.378962,07.921496,08.156740,08.856365,08.817177,08.734347,09.345927,08.992970,10.785120,08.886867,08.818847,08.823744,09.165298,08.652657,08.173054,07.563416,07.595809,08.381467,07.216432,06.540178,06.238914,05.487288,05.759462,05.993215,07.474726,07.348907,07.303379,07.119314,06.993780,06.958153,07.595706,08.088153,07.555753,07.315433,07.893427,08.858794,08.839367,08.014733,07.873465,08.930377,10.500550,12.611440,11.417870,11.872490,11.060820,12.043310,09.776299,09.557194,09.202590,10.224020,09.350807,08.300913,08.365779,08.133595,07.660470,08.074839,07.848597,07.998220,07.396895,07.900419,08.100500,07.899453,07.599783,08.100929,09.002175,10.298900,10.101520,10.699150,09.698140,09.800951,10.900470,10.697850,09.297252,10.397440,10.900720,12.901270,13.099060,11.698280,11.099870,11.301570,10.702110,10.099310,09.591119) > #'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.4404325 0.4407713 0.4411093 0.4414466 0.4417831 0.4421189 0.4424539 [8] 0.4427882 0.4431217 0.4434545 0.4437865 0.4441178 0.4444483 0.4447780 [15] 0.4451069 0.4454351 0.4457625 0.4460892 0.4464150 0.4467401 0.4470643 [22] 0.4473878 0.4477105 0.4480324 0.4483535 0.4486739 0.4489934 0.4493121 [29] 0.4496300 0.4499471 0.4502634 0.4505789 0.4508935 0.4512074 0.4515204 [36] 0.4518326 0.4521440 0.4524546 0.4527643 0.4530732 0.4533813 0.4536885 [43] 0.4539949 0.4543004 0.4546052 0.4549090 0.4552121 0.4555142 0.4558156 [50] 0.4561160 0.4564157 0.4567144 0.4570123 0.4573094 0.4576056 0.4579009 [57] 0.4581953 0.4584889 0.4587817 0.4590735 0.4593645 0.4596546 0.4599438 [64] 0.4602321 0.4605196 0.4608062 0.4610918 0.4613766 0.4616606 0.4619436 [71] 0.4622257 0.4625069 0.4627873 0.4630667 0.4633453 0.4636229 0.4638996 [78] 0.4641755 0.4644504 0.4647244 0.4649975 0.4652697 0.4655410 0.4658114 [85] 0.4660808 0.4663494 0.4666170 0.4668837 0.4671494 0.4674143 0.4676782 [92] 0.4679412 0.4682033 0.4684644 0.4687247 0.4689839 0.4692423 0.4694997 [99] 0.4697562 0.4700117 0.4702663 0.4705200 0.4707727 0.4710245 0.4712753 [106] 0.4715252 0.4717741 0.4720221 0.4722691 0.4725152 0.4727604 0.4730046 [113] 0.4732478 0.4734901 0.4737314 0.4739718 0.4742112 0.4744496 0.4746871 [120] 0.4749236 0.4751592 0.4753938 0.4756274 0.4758601 0.4760918 0.4763226 [127] 0.4765523 0.4767811 0.4770090 0.4772358 0.4774617 0.4776866 0.4779106 [134] 0.4781335 0.4783555 0.4785766 0.4787966 0.4790157 0.4792337 0.4794509 [141] 0.4796670 0.4798821 0.4800963 0.4803095 0.4805217 0.4807329 0.4809431 [148] 0.4811524 0.4813607 0.4815679 0.4817742 0.4819795 0.4821839 0.4823872 [155] 0.4825895 0.4827909 0.4829913 0.4831906 0.4833890 0.4835864 0.4837828 [162] 0.4839783 0.4841727 0.4843661 0.4845585 0.4847500 0.4849404 0.4851299 [169] 0.4853184 0.4855058 0.4856923 0.4858778 0.4860623 0.4862458 0.4864282 [176] 0.4866097 0.4867902 0.4869697 0.4871483 0.4873258 0.4875023 0.4876778 [183] 0.4878523 0.4880258 0.4881983 0.4883699 0.4885404 0.4887099 0.4888785 [190] 0.4890460 0.4892125 0.4893781 0.4895426 0.4897061 0.4898687 0.4900302 [197] 0.4901908 0.4903503 0.4905089 0.4906664 0.4908230 0.4909786 0.4911331 [204] 0.4912867 0.4914392 0.4915908 0.4917414 0.4918910 0.4920395 0.4921871 [211] 0.4923337 0.4924793 0.4926239 0.4927675 0.4929101 0.4930517 0.4931923 [218] 0.4933319 0.4934705 0.4936082 0.4937448 0.4938804 0.4940151 0.4941488 [225] 0.4942814 0.4944131 0.4945438 0.4946735 0.4948022 0.4949299 0.4950566 [232] 0.4951823 0.4953071 0.4954308 0.4955536 0.4956754 0.4957961 0.4959159 [239] 0.4960348 0.4961526 0.4962694 0.4963853 0.4965002 0.4966141 0.4967270 [246] 0.4968389 0.4969499 0.4970598 0.4971688 0.4972768 0.4973839 0.4974899 [253] 0.4975950 0.4976991 0.4978022 0.4979043 0.4980055 0.4981057 0.4982049 [260] 0.4983032 0.4984004 0.4984967 0.4985921 0.4986864 0.4987798 0.4988723 [267] 0.4989637 0.4990542 0.4991437 0.4992323 0.4993199 0.4994065 0.4994922 [274] 0.4995769 0.4996606 0.4997434 0.4998252 0.4999061 0.4999860 0.5000649 [281] 0.5001429 0.5002200 0.5002961 0.5003712 0.5004454 0.5005186 0.5005909 [288] 0.5006622 0.5007326 0.5008020 0.5008705 0.5009381 0.5010047 0.5010703 [295] 0.5011350 0.5011988 0.5012616 0.5013235 0.5013845 0.5014445 0.5015036 [302] 0.5015617 0.5016189 0.5016752 0.5017305 0.5017849 0.5018384 0.5018910 [309] 0.5019426 0.5019933 0.5020431 0.5020919 0.5021399 0.5021869 0.5022329 [316] 0.5022781 0.5023224 0.5023657 0.5024081 0.5024496 0.5024902 0.5025299 [323] 0.5025686 0.5026065 0.5026434 0.5026795 0.5027146 0.5027488 0.5027821 [330] 0.5028145 0.5028461 0.5028767 0.5029064 0.5029352 0.5029631 0.5029902 [337] 0.5030163 0.5030415 0.5030659 0.5030893 0.5031119 0.5031336 0.5031544 [344] 0.5031743 0.5031933 0.5032115 0.5032287 0.5032451 0.5032606 0.5032753 [351] 0.5032890 0.5033019 0.5033139 0.5033251 0.5033353 0.5033447 0.5033533 [358] 0.5033609 0.5033677 0.5033737 0.5033788 0.5033830 0.5033863 0.5033888 [365] 0.5033905 0.5033913 0.5033912 0.5033903 0.5033885 0.5033859 0.5033825 [372] 0.5033782 0.5033730 0.5033670 0.5033602 0.5033525 0.5033440 0.5033347 [379] 0.5033245 0.5033135 0.5033016 0.5032890 0.5032755 0.5032611 0.5032460 [386] 0.5032300 0.5032132 0.5031955 0.5031771 0.5031578 0.5031377 0.5031168 [393] 0.5030951 0.5030726 0.5030492 0.5030251 0.5030001 0.5029744 0.5029478 [400] 0.5029204 0.5028922 > mx [1] 0.5033913 > mxli [1] 1.65 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1iejy1293626546.ps",horizontal=F,onefile=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/rcomp/tmp/2sn001293626546.ps",horizontal=F,onefile=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/rcomp/tmp/3sn001293626546.ps",horizontal=F,onefile=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/rcomp/tmp/4sn001293626546.ps",horizontal=F,onefile=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/rcomp/tmp/5lwi31293626546.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/67fyr1293626546.tab") > try(system("convert tmp/1iejy1293626546.ps tmp/1iejy1293626546.png",intern=TRUE)) character(0) > try(system("convert tmp/2sn001293626546.ps tmp/2sn001293626546.png",intern=TRUE)) character(0) > try(system("convert tmp/3sn001293626546.ps tmp/3sn001293626546.png",intern=TRUE)) character(0) > try(system("convert tmp/4sn001293626546.ps tmp/4sn001293626546.png",intern=TRUE)) character(0) > try(system("convert tmp/5lwi31293626546.ps tmp/5lwi31293626546.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.470 0.840 2.317