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(106.2 + ,101.6 + ,99 + ,96.4 + ,94 + ,93.2 + ,103 + ,103.6 + ,103.2 + ,102.2 + ,100 + ,99.6 + ,98.8 + ,95.2 + ,91.6 + ,88.6 + ,86 + ,84.8 + ,95.2 + ,96.2 + ,94 + ,92 + ,90.2 + ,90 + ,88.8 + ,85.8 + ,84.2 + ,80 + ,77.8 + ,76.8 + ,86.4 + ,89.2 + ,86.2 + ,84.6 + ,83.2 + ,83.2 + ,82.6 + ,79.8 + ,77.2 + ,74.8 + ,73 + ,73 + ,83.6 + ,85.6 + ,84.8 + ,84.2 + ,83.4 + ,84.6 + ,84.6 + ,83.8 + ,81.2 + ,79.6 + ,78 + ,78.2 + ,88.8 + ,92 + ,91 + ,91.2 + ,90.4 + ,91.8 + ,92.2 + ,90.2 + ,88.6 + ,87.8 + ,86 + ,87.2 + ,97.6 + ,101.2 + ,100.4 + ,100.2 + ,100.2 + ,103 + ,104.2 + ,104 + ,102.4 + ,101.8 + ,101 + ,102.2 + ,114 + ,118.4 + ,118.8 + ,117.2 + ,117.2 + ,118.4 + ,118.8 + ,117.2 + ,114.4 + ,112.6 + ,111 + ,110.8 + ,120.2 + ,124.4 + ,123.4 + ,121.2 + ,119 + ,119.8 + ,120 + ,118.4 + ,115 + ,113.4 + ,111 + ,111 + ,121.6 + ,126.2 + ,125.8 + ,124.8 + ,122 + ,123.2 + ,124.2 + ,120.8 + ,116.8 + ,114.8 + ,111 + ,109 + ,119.8 + ,124 + ,121.6 + ,118 + ,115.8 + ,116 + ,115.8 + ,114.4 + ,112 + ,110.2 + ,107.4 + ,108.2 + ,117.6 + ,121.4 + ,119.8 + ,115.6 + ,112.6 + ,113.2 + ,112.2 + ,110.8 + ,108 + ,105.2 + ,102.4 + ,101 + ,110.8 + ,116.8 + ,113.8 + ,108 + ,104.4 + ,105.2 + ,105.4 + ,103.2 + ,100.6 + ,97.8 + ,95.8 + ,95 + ,104.8 + ,110.4 + ,106.4 + ,102.2 + ,98.4 + ,98.4 + ,98.6 + ,96.2 + ,92.4 + ,91.4 + ,88.4 + ,87.8 + ,97.6 + ,104.2 + ,100.2 + ,97 + ,92.8 + ,92 + ,93.4 + ,92 + ,89.6 + ,88.6 + ,87.2 + ,86.2 + ,96.8 + ,102 + ,102.6 + ,100.6 + ,94.2 + ,94.2 + ,95.2 + ,95 + ,94 + ,92.2 + ,91 + ,91.2 + ,103.4 + ,105 + ,104.6 + ,103.8 + ,101.8 + ,102.4 + ,103.8 + ,103.4 + ,102 + ,101.8 + ,100.2 + ,101.4 + ,113.8 + ,116 + ,115.6 + ,113 + ,109.4 + ,111 + ,112.4 + ,112.2 + ,111 + ,108.8 + ,107.4 + ,108.6 + ,118.8 + ,122.2 + ,122.6 + ,122.2 + ,118.8 + ,119 + ,118.2 + ,117.8 + ,116.8 + ,114.6 + ,113.4 + ,113.8 + ,124.2 + ,125.8 + ,125.6 + ,122.4 + ,119 + ,119.4 + ,118.6 + ,118 + ,116 + ,114.8 + ,114.6 + ,114.6 + ,124 + ,125.2 + ,124 + ,117.6 + ,113.2 + ,111.4 + ,112.2 + ,109.8 + ,106.4 + ,105.2 + ,102.2 + ,99.8 + ,111 + ,113 + ,108.4 + ,105.4 + ,102 + ,102.8) > #'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.4694821 0.4694881 0.4694938 0.4694991 0.4695041 0.4695087 0.4695130 [8] 0.4695170 0.4695206 0.4695239 0.4695268 0.4695294 0.4695316 0.4695335 [15] 0.4695351 0.4695363 0.4695372 0.4695378 0.4695380 0.4695378 0.4695374 [22] 0.4695365 0.4695354 0.4695339 0.4695321 0.4695299 0.4695274 0.4695245 [29] 0.4695213 0.4695178 0.4695140 0.4695098 0.4695052 0.4695004 0.4694951 [36] 0.4694896 0.4694837 0.4694775 0.4694709 0.4694640 0.4694568 0.4694492 [43] 0.4694413 0.4694331 0.4694245 0.4694156 0.4694064 0.4693968 0.4693869 [50] 0.4693767 0.4693661 0.4693552 0.4693439 0.4693324 0.4693204 0.4693082 [57] 0.4692956 0.4692827 0.4692695 0.4692559 0.4692420 0.4692278 0.4692132 [64] 0.4691983 0.4691831 0.4691676 0.4691517 0.4691355 0.4691189 0.4691020 [71] 0.4690848 0.4690673 0.4690494 0.4690313 0.4690127 0.4689939 0.4689747 [78] 0.4689552 0.4689354 0.4689153 0.4688948 0.4688740 0.4688529 0.4688314 [85] 0.4688096 0.4687875 0.4687651 0.4687423 0.4687193 0.4686959 0.4686721 [92] 0.4686481 0.4686237 0.4685990 0.4685740 0.4685487 0.4685230 0.4684971 [99] 0.4684708 0.4684441 0.4684172 0.4683899 0.4683623 0.4683344 0.4683062 [106] 0.4682777 0.4682488 0.4682197 0.4681902 0.4681604 0.4681302 0.4680998 [113] 0.4680690 0.4680379 0.4680065 0.4679748 0.4679428 0.4679105 0.4678778 [120] 0.4678448 0.4678116 0.4677780 0.4677440 0.4677098 0.4676753 0.4676404 [127] 0.4676053 0.4675698 0.4675340 0.4674979 0.4674615 0.4674248 0.4673878 [134] 0.4673504 0.4673128 0.4672748 0.4672366 0.4671980 0.4671591 0.4671199 [141] 0.4670804 0.4670406 0.4670005 0.4669601 0.4669194 0.4668784 0.4668370 [148] 0.4667954 0.4667535 0.4667112 0.4666687 0.4666258 0.4665827 0.4665392 [155] 0.4664955 0.4664514 0.4664071 0.4663624 0.4663175 0.4662722 0.4662266 [162] 0.4661808 0.4661346 0.4660882 0.4660414 0.4659944 0.4659470 0.4658994 [169] 0.4658514 0.4658032 0.4657547 0.4657058 0.4656567 0.4656073 0.4655576 [176] 0.4655076 0.4654573 0.4654067 0.4653558 0.4653046 0.4652531 0.4652014 [183] 0.4651493 0.4650970 0.4650444 0.4649914 0.4649382 0.4648847 0.4648309 [190] 0.4647769 0.4647225 0.4646678 0.4646129 0.4645577 0.4645022 0.4644464 [197] 0.4643903 0.4643339 0.4642773 0.4642203 0.4641631 0.4641056 0.4640478 [204] 0.4639898 0.4639314 0.4638728 0.4638139 0.4637547 0.4636952 0.4636355 [211] 0.4635755 0.4635152 0.4634546 0.4633937 0.4633326 0.4632712 0.4632095 [218] 0.4631475 0.4630853 0.4630227 0.4629600 0.4628969 0.4628335 0.4627699 [225] 0.4627060 0.4626419 0.4625775 0.4625128 0.4624478 0.4623825 0.4623170 [232] 0.4622512 0.4621852 0.4621189 0.4620523 0.4619854 0.4619183 0.4618509 [239] 0.4617832 0.4617153 0.4616471 0.4615787 0.4615099 0.4614410 0.4613717 [246] 0.4613022 0.4612324 0.4611624 0.4610921 0.4610215 0.4609507 0.4608796 [253] 0.4608083 0.4607367 0.4606648 0.4605927 0.4605203 0.4604477 0.4603748 [260] 0.4603017 0.4602283 0.4601546 0.4600807 0.4600065 0.4599321 0.4598574 [267] 0.4597825 0.4597073 0.4596319 0.4595562 0.4594802 0.4594040 0.4593276 [274] 0.4592509 0.4591740 0.4590968 0.4590193 0.4589417 0.4588637 0.4587855 [281] 0.4587071 0.4586284 0.4585495 0.4584704 0.4583910 0.4583113 0.4582314 [288] 0.4581513 0.4580709 0.4579903 0.4579094 0.4578283 0.4577469 0.4576654 [295] 0.4575835 0.4575015 0.4574192 0.4573366 0.4572538 0.4571708 0.4570876 [302] 0.4570041 0.4569203 0.4568364 0.4567522 0.4566678 0.4565831 0.4564982 [309] 0.4564131 0.4563277 0.4562421 0.4561563 0.4560702 0.4559839 0.4558974 [316] 0.4558107 0.4557237 0.4556365 0.4555491 0.4554614 0.4553735 0.4552854 [323] 0.4551971 0.4551085 0.4550197 0.4549307 0.4548415 0.4547520 0.4546623 [330] 0.4545724 0.4544823 0.4543920 0.4543014 0.4542106 0.4541196 0.4540284 [337] 0.4539369 0.4538453 0.4537534 0.4536613 0.4535690 0.4534765 0.4533837 [344] 0.4532908 0.4531976 0.4531042 0.4530106 0.4529168 0.4528228 0.4527285 [351] 0.4526341 0.4525394 0.4524445 0.4523494 0.4522542 0.4521586 0.4520629 [358] 0.4519670 0.4518709 0.4517746 0.4516780 0.4515813 0.4514843 0.4513872 [365] 0.4512898 0.4511922 0.4510945 0.4509965 0.4508983 0.4508000 0.4507014 [372] 0.4506026 0.4505036 0.4504045 0.4503051 0.4502055 0.4501057 0.4500058 [379] 0.4499056 0.4498052 0.4497047 0.4496039 0.4495030 0.4494018 0.4493005 [386] 0.4491990 0.4490972 0.4489953 0.4488932 0.4487909 0.4486884 0.4485857 [393] 0.4484828 0.4483798 0.4482765 0.4481731 0.4480695 0.4479656 0.4478616 [400] 0.4477574 0.4476531 > mx [1] 0.469538 > mxli [1] -1.82 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/19je61229608274.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/2gwya1229608274.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/3ki9q1229608274.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/4394e1229608274.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/5hk3g1229608274.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/6767m1229608274.tab") > > system("convert tmp/19je61229608274.ps tmp/19je61229608274.png") > system("convert tmp/2gwya1229608274.ps tmp/2gwya1229608274.png") > system("convert tmp/3ki9q1229608274.ps tmp/3ki9q1229608274.png") > system("convert tmp/4394e1229608274.ps tmp/4394e1229608274.png") > system("convert tmp/5hk3g1229608274.ps tmp/5hk3g1229608274.png") > > > proc.time() user system elapsed 1.276 0.912 1.792