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(24,23,24,24,27,28,25,19,19,19,20,16,22,21,25,29,28,25,26,24,28,28,28,28,32,31,22,29,31,29,32,32,31,29,28,28,29,22,26,24,27,27,23,21,19,17,19,21,13,8,5,10,6,6,8,11,12,13,19,19,18) > #'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.3869506 -0.3876282 -0.3883064 -0.3889852 -0.3896646 -0.3903445 [7] -0.3910250 -0.3917059 -0.3923873 -0.3930691 -0.3937514 -0.3944340 [13] -0.3951171 -0.3958004 -0.3964841 -0.3971681 -0.3978523 -0.3985367 [19] -0.3992214 -0.3999062 -0.4005911 -0.4012762 -0.4019614 -0.4026466 [25] -0.4033318 -0.4040171 -0.4047023 -0.4053874 -0.4060725 -0.4067574 [31] -0.4074421 -0.4081267 -0.4088111 -0.4094951 -0.4101789 -0.4108624 [37] -0.4115455 -0.4122283 -0.4129106 -0.4135924 -0.4142738 -0.4149546 [43] -0.4156349 -0.4163145 -0.4169936 -0.4176720 -0.4183496 -0.4190266 [49] -0.4197027 -0.4203781 -0.4210526 -0.4217262 -0.4223989 -0.4230706 [55] -0.4237414 -0.4244111 -0.4250797 -0.4257472 -0.4264136 -0.4270787 [61] -0.4277427 -0.4284054 -0.4290667 -0.4297268 -0.4303854 -0.4310426 [67] -0.4316984 -0.4323526 -0.4330053 -0.4336565 -0.4343060 -0.4349538 [73] -0.4355999 -0.4362443 -0.4368869 -0.4375277 -0.4381666 -0.4388036 [79] -0.4394386 -0.4400717 -0.4407027 -0.4413316 -0.4419584 -0.4425831 [85] -0.4432056 -0.4438258 -0.4444437 -0.4450593 -0.4456726 -0.4462834 [91] -0.4468918 -0.4474977 -0.4481011 -0.4487019 -0.4493000 -0.4498956 [97] -0.4504884 -0.4510785 -0.4516658 -0.4522503 -0.4528319 -0.4534106 [103] -0.4539863 -0.4545591 -0.4551289 -0.4556955 -0.4562591 -0.4568195 [109] -0.4573768 -0.4579308 -0.4584815 -0.4590289 -0.4595730 -0.4601137 [115] -0.4606509 -0.4611847 -0.4617150 -0.4622417 -0.4627649 -0.4632844 [121] -0.4638002 -0.4643124 -0.4648208 -0.4653255 -0.4658263 -0.4663233 [127] -0.4668165 -0.4673057 -0.4677909 -0.4682721 -0.4687494 -0.4692225 [133] -0.4696916 -0.4701565 -0.4706173 -0.4710738 -0.4715262 -0.4719742 [139] -0.4724180 -0.4728575 -0.4732925 -0.4737232 -0.4741495 -0.4745713 [145] -0.4749886 -0.4754014 -0.4758097 -0.4762133 -0.4766124 -0.4770069 [151] -0.4773967 -0.4777818 -0.4781622 -0.4785378 -0.4789087 -0.4792748 [157] -0.4796361 -0.4799925 -0.4803441 -0.4806908 -0.4810326 -0.4813694 [163] -0.4817013 -0.4820282 -0.4823501 -0.4826670 -0.4829789 -0.4832857 [169] -0.4835874 -0.4838840 -0.4841755 -0.4844619 -0.4847431 -0.4850192 [175] -0.4852901 -0.4855557 -0.4858162 -0.4860715 -0.4863215 -0.4865662 [181] -0.4868057 -0.4870399 -0.4872689 -0.4874925 -0.4877108 -0.4879238 [187] -0.4881315 -0.4883338 -0.4885308 -0.4887224 -0.4889087 -0.4890896 [193] -0.4892651 -0.4894353 -0.4896000 -0.4897594 -0.4899134 -0.4900620 [199] -0.4902052 -0.4903430 -0.4904754 -0.4906024 -0.4907239 -0.4908401 [205] -0.4909509 -0.4910563 -0.4911563 -0.4912509 -0.4913400 -0.4914238 [211] -0.4915022 -0.4915753 -0.4916429 -0.4917052 -0.4917621 -0.4918136 [217] -0.4918598 -0.4919007 -0.4919362 -0.4919663 -0.4919912 -0.4920107 [223] -0.4920249 -0.4920338 -0.4920375 -0.4920359 -0.4920290 -0.4920168 [229] -0.4919995 -0.4919769 -0.4919491 -0.4919161 -0.4918779 -0.4918345 [235] -0.4917860 -0.4917324 -0.4916736 -0.4916098 -0.4915408 -0.4914668 [241] -0.4913877 -0.4913036 -0.4912145 -0.4911203 -0.4910212 -0.4909172 [247] -0.4908081 -0.4906942 -0.4905754 -0.4904517 -0.4903231 -0.4901897 [253] -0.4900515 -0.4899084 -0.4897606 -0.4896081 -0.4894508 -0.4892889 [259] -0.4891222 -0.4889509 -0.4887749 -0.4885944 -0.4884093 -0.4882196 [265] -0.4880253 -0.4878266 -0.4876234 -0.4874157 -0.4872036 -0.4869871 [271] -0.4867662 -0.4865409 -0.4863114 -0.4860775 -0.4858393 -0.4855969 [277] -0.4853503 -0.4850995 -0.4848446 -0.4845855 -0.4843223 -0.4840550 [283] -0.4837836 -0.4835083 -0.4832289 -0.4829456 -0.4826584 -0.4823672 [289] -0.4820722 -0.4817733 -0.4814706 -0.4811641 -0.4808538 -0.4805398 [295] -0.4802221 -0.4799008 -0.4795758 -0.4792471 -0.4789149 -0.4785792 [301] -0.4782399 -0.4778971 -0.4775508 -0.4772012 -0.4768481 -0.4764916 [307] -0.4761318 -0.4757687 -0.4754023 -0.4750326 -0.4746597 -0.4742837 [313] -0.4739044 -0.4735220 -0.4731365 -0.4727480 -0.4723564 -0.4719617 [319] -0.4715641 -0.4711635 -0.4707601 -0.4703537 -0.4699444 -0.4695323 [325] -0.4691174 -0.4686997 -0.4682793 -0.4678561 -0.4674303 -0.4670017 [331] -0.4665706 -0.4661369 -0.4657005 -0.4652617 -0.4648203 -0.4643764 [337] -0.4639301 -0.4634813 -0.4630301 -0.4625766 -0.4621207 -0.4616624 [343] -0.4612019 -0.4607392 -0.4602742 -0.4598069 -0.4593376 -0.4588660 [349] -0.4583923 -0.4579166 -0.4574387 -0.4569588 -0.4564769 -0.4559930 [355] -0.4555071 -0.4550193 -0.4545296 -0.4540380 -0.4535446 -0.4530493 [361] -0.4525522 -0.4520533 -0.4515526 -0.4510502 -0.4505462 -0.4500404 [367] -0.4495330 -0.4490239 -0.4485132 -0.4480010 -0.4474872 -0.4469718 [373] -0.4464549 -0.4459366 -0.4454168 -0.4448955 -0.4443729 -0.4438488 [379] -0.4433234 -0.4427966 -0.4422685 -0.4417391 -0.4412084 -0.4406764 [385] -0.4401432 -0.4396088 -0.4390732 -0.4385365 -0.4379985 -0.4374595 [391] -0.4369194 -0.4363781 -0.4358358 -0.4352925 -0.4347481 -0.4342027 [397] -0.4336564 -0.4331091 -0.4325608 -0.4320116 -0.4314615 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/15dre1257953191.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/freestat/rcomp/tmp/2ysgp1257953191.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/freestat/rcomp/tmp/39okj1257953191.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/freestat/rcomp/tmp/4zin51257953191.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/freestat/rcomp/tmp/5e2cq1257953191.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6k6sx1257953191.tab") > > system("convert tmp/15dre1257953191.ps tmp/15dre1257953191.png") > system("convert tmp/2ysgp1257953191.ps tmp/2ysgp1257953191.png") > system("convert tmp/39okj1257953191.ps tmp/39okj1257953191.png") > system("convert tmp/4zin51257953191.ps tmp/4zin51257953191.png") > system("convert tmp/5e2cq1257953191.ps tmp/5e2cq1257953191.png") > > > proc.time() user system elapsed 1.709 1.293 2.019