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. > x <- c(128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207,206.6,210.6,211.1,215,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221,213.6,243.4,253.8,265.3,268.2,268.5,266.9,268.4,250.8,231.2,192,171.4,160,148.1,144.8,147.2,155.1,161.1,169.9,176.2,193.1,194.9) > #'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.5126381 0.5123812 0.5121242 0.5118670 0.5116096 0.5113520 0.5110943 [8] 0.5108364 0.5105782 0.5103200 0.5100615 0.5098029 0.5095440 0.5092850 [15] 0.5090259 0.5087665 0.5085070 0.5082473 0.5079875 0.5077275 0.5074673 [22] 0.5072069 0.5069464 0.5066857 0.5064248 0.5061638 0.5059026 0.5056412 [29] 0.5053797 0.5051180 0.5048562 0.5045942 0.5043320 0.5040697 0.5038072 [36] 0.5035445 0.5032817 0.5030188 0.5027557 0.5024924 0.5022290 0.5019654 [43] 0.5017016 0.5014378 0.5011737 0.5009095 0.5006452 0.5003807 0.5001161 [50] 0.4998513 0.4995864 0.4993213 0.4990561 0.4987907 0.4985252 0.4982595 [57] 0.4979937 0.4977278 0.4974617 0.4971955 0.4969292 0.4966627 0.4963961 [64] 0.4961293 0.4958624 0.4955953 0.4953282 0.4950609 0.4947934 0.4945259 [71] 0.4942582 0.4939903 0.4937224 0.4934543 0.4931861 0.4929177 0.4926493 [78] 0.4923807 0.4921120 0.4918431 0.4915742 0.4913051 0.4910359 0.4907665 [85] 0.4904971 0.4902275 0.4899578 0.4896880 0.4894181 0.4891481 0.4888779 [92] 0.4886077 0.4883373 0.4880668 0.4877962 0.4875255 0.4872547 0.4869837 [99] 0.4867127 0.4864416 0.4861703 0.4858990 0.4856275 0.4853559 0.4850842 [106] 0.4848125 0.4845406 0.4842686 0.4839966 0.4837244 0.4834521 0.4831797 [113] 0.4829073 0.4826347 0.4823620 0.4820893 0.4818165 0.4815435 0.4812705 [120] 0.4809974 0.4807242 0.4804509 0.4801775 0.4799040 0.4796304 0.4793568 [127] 0.4790831 0.4788092 0.4785353 0.4782614 0.4779873 0.4777132 0.4774389 [134] 0.4771646 0.4768902 0.4766158 0.4763413 0.4760666 0.4757920 0.4755172 [141] 0.4752424 0.4749675 0.4746925 0.4744175 0.4741423 0.4738672 0.4735919 [148] 0.4733166 0.4730412 0.4727658 0.4724902 0.4722147 0.4719390 0.4716633 [155] 0.4713876 0.4711117 0.4708359 0.4705599 0.4702839 0.4700079 0.4697318 [162] 0.4694556 0.4691794 0.4689031 0.4686268 0.4683504 0.4680740 0.4677975 [169] 0.4675210 0.4672444 0.4669678 0.4666911 0.4664144 0.4661377 0.4658609 [176] 0.4655840 0.4653071 0.4650302 0.4647533 0.4644762 0.4641992 0.4639221 [183] 0.4636450 0.4633679 0.4630907 0.4628135 0.4625362 0.4622589 0.4619816 [190] 0.4617043 0.4614269 0.4611495 0.4608720 0.4605946 0.4603171 0.4600396 [197] 0.4597620 0.4594845 0.4592069 0.4589293 0.4586517 0.4583740 0.4580964 [204] 0.4578187 0.4575410 0.4572633 0.4569856 0.4567078 0.4564301 0.4561523 [211] 0.4558745 0.4555967 0.4553189 0.4550411 0.4547633 0.4544855 0.4542076 [218] 0.4539298 0.4536519 0.4533741 0.4530962 0.4528184 0.4525405 0.4522627 [225] 0.4519848 0.4517070 0.4514291 0.4511513 0.4508734 0.4505956 0.4503178 [232] 0.4500399 0.4497621 0.4494843 0.4492065 0.4489287 0.4486509 0.4483732 [239] 0.4480954 0.4478177 0.4475399 0.4472622 0.4469845 0.4467069 0.4464292 [246] 0.4461516 0.4458740 0.4455964 0.4453188 0.4450412 0.4447637 0.4444862 [253] 0.4442087 0.4439313 0.4436538 0.4433764 0.4430991 0.4428217 0.4425444 [260] 0.4422672 0.4419899 0.4417127 0.4414355 0.4411584 0.4408813 0.4406042 [267] 0.4403272 0.4400502 0.4397732 0.4394963 0.4392195 0.4389426 0.4386658 [274] 0.4383891 0.4381124 0.4378358 0.4375592 0.4372826 0.4370061 0.4367296 [281] 0.4364532 0.4361769 0.4359006 0.4356243 0.4353481 0.4350720 0.4347959 [288] 0.4345199 0.4342439 0.4339680 0.4336921 0.4334163 0.4331406 0.4328649 [295] 0.4325893 0.4323137 0.4320382 0.4317628 0.4314875 0.4312122 0.4309370 [302] 0.4306618 0.4303867 0.4301117 0.4298368 0.4295619 0.4292871 0.4290124 [309] 0.4287377 0.4284632 0.4281887 0.4279142 0.4276399 0.4273656 0.4270914 [316] 0.4268173 0.4265433 0.4262694 0.4259955 0.4257218 0.4254481 0.4251745 [323] 0.4249010 0.4246275 0.4243542 0.4240809 0.4238078 0.4235347 0.4232617 [330] 0.4229889 0.4227161 0.4224434 0.4221708 0.4218983 0.4216258 0.4213535 [337] 0.4210813 0.4208092 0.4205372 0.4202653 0.4199935 0.4197218 0.4194502 [344] 0.4191787 0.4189073 0.4186360 0.4183648 0.4180937 0.4178228 0.4175519 [351] 0.4172811 0.4170105 0.4167400 0.4164696 0.4161993 0.4159291 0.4156590 [358] 0.4153891 0.4151192 0.4148495 0.4145799 0.4143104 0.4140411 0.4137718 [365] 0.4135027 0.4132337 0.4129648 0.4126961 0.4124275 0.4121590 0.4118906 [372] 0.4116223 0.4113542 0.4110862 0.4108184 0.4105506 0.4102830 0.4100156 [379] 0.4097482 0.4094810 0.4092140 0.4089470 0.4086802 0.4084136 0.4081471 [386] 0.4078807 0.4076144 0.4073483 0.4070824 0.4068165 0.4065509 0.4062853 [393] 0.4060199 0.4057547 0.4054896 0.4052246 0.4049598 0.4046951 0.4044306 [400] 0.4041663 0.4039020 > mx [1] 0.5126381 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1pg201261398160.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/2pv5j1261398160.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/3glbv1261398160.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/4usqc1261398160.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/5py651261398160.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/68vda1261398160.tab") > > try(system("convert tmp/1pg201261398160.ps tmp/1pg201261398160.png",intern=TRUE)) character(0) > try(system("convert tmp/2pv5j1261398160.ps tmp/2pv5j1261398160.png",intern=TRUE)) character(0) > try(system("convert tmp/3glbv1261398160.ps tmp/3glbv1261398160.png",intern=TRUE)) character(0) > try(system("convert tmp/4usqc1261398160.ps tmp/4usqc1261398160.png",intern=TRUE)) character(0) > try(system("convert tmp/5py651261398160.ps tmp/5py651261398160.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.059 0.763 1.292