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(6539,6699,6962,6981,7024,6940,6774,6671,6965,6969,6822,6878,6691,6837,7018,7167,7076,7171,7093,6971,7142,7047,6999,6650,6475,6437,6639,6422,6272,6232,6003,5673,6050,5977,5796,5752,5609,5839,6069,6006,5809,5797,5502,5568,5864,5764,5615,5615,5681,5915,6334,6494,6620,6578,6495,6538,6737,6651,6530,6563) > #'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.4504774 -0.4505600 -0.4506426 -0.4507251 -0.4508076 -0.4508902 [7] -0.4509726 -0.4510551 -0.4511375 -0.4512199 -0.4513023 -0.4513847 [13] -0.4514670 -0.4515493 -0.4516316 -0.4517139 -0.4517961 -0.4518783 [19] -0.4519605 -0.4520427 -0.4521248 -0.4522070 -0.4522890 -0.4523711 [25] -0.4524532 -0.4525352 -0.4526172 -0.4526991 -0.4527811 -0.4528630 [31] -0.4529449 -0.4530267 -0.4531086 -0.4531904 -0.4532722 -0.4533539 [37] -0.4534357 -0.4535174 -0.4535990 -0.4536807 -0.4537623 -0.4538439 [43] -0.4539255 -0.4540071 -0.4540886 -0.4541701 -0.4542515 -0.4543330 [49] -0.4544144 -0.4544958 -0.4545771 -0.4546585 -0.4547398 -0.4548211 [55] -0.4549023 -0.4549835 -0.4550647 -0.4551459 -0.4552271 -0.4553082 [61] -0.4553893 -0.4554703 -0.4555513 -0.4556324 -0.4557133 -0.4557943 [67] -0.4558752 -0.4559561 -0.4560369 -0.4561178 -0.4561986 -0.4562794 [73] -0.4563601 -0.4564408 -0.4565215 -0.4566022 -0.4566828 -0.4567634 [79] -0.4568440 -0.4569245 -0.4570051 -0.4570855 -0.4571660 -0.4572464 [85] -0.4573268 -0.4574072 -0.4574875 -0.4575679 -0.4576481 -0.4577284 [91] -0.4578086 -0.4578888 -0.4579690 -0.4580491 -0.4581292 -0.4582093 [97] -0.4582893 -0.4583693 -0.4584493 -0.4585292 -0.4586091 -0.4586890 [103] -0.4587689 -0.4588487 -0.4589285 -0.4590083 -0.4590880 -0.4591677 [109] -0.4592474 -0.4593270 -0.4594066 -0.4594862 -0.4595657 -0.4596453 [115] -0.4597247 -0.4598042 -0.4598836 -0.4599630 -0.4600423 -0.4601217 [121] -0.4602009 -0.4602802 -0.4603594 -0.4604386 -0.4605178 -0.4605969 [127] -0.4606760 -0.4607551 -0.4608341 -0.4609131 -0.4609921 -0.4610710 [133] -0.4611499 -0.4612288 -0.4613076 -0.4613864 -0.4614651 -0.4615439 [139] -0.4616226 -0.4617012 -0.4617799 -0.4618585 -0.4619370 -0.4620156 [145] -0.4620941 -0.4621725 -0.4622510 -0.4623294 -0.4624077 -0.4624860 [151] -0.4625643 -0.4626426 -0.4627208 -0.4627990 -0.4628772 -0.4629553 [157] -0.4630334 -0.4631114 -0.4631894 -0.4632674 -0.4633454 -0.4634233 [163] -0.4635012 -0.4635790 -0.4636568 -0.4637346 -0.4638123 -0.4638900 [169] -0.4639677 -0.4640453 -0.4641229 -0.4642004 -0.4642780 -0.4643555 [175] -0.4644329 -0.4645103 -0.4645877 -0.4646650 -0.4647423 -0.4648196 [181] -0.4648968 -0.4649740 -0.4650512 -0.4651283 -0.4652054 -0.4652825 [187] -0.4653595 -0.4654364 -0.4655134 -0.4655903 -0.4656672 -0.4657440 [193] -0.4658208 -0.4658975 -0.4659742 -0.4660509 -0.4661276 -0.4662042 [199] -0.4662807 -0.4663573 -0.4664338 -0.4665102 -0.4665866 -0.4666630 [205] -0.4667393 -0.4668156 -0.4668919 -0.4669681 -0.4670443 -0.4671205 [211] -0.4671966 -0.4672726 -0.4673487 -0.4674247 -0.4675006 -0.4675765 [217] -0.4676524 -0.4677282 -0.4678040 -0.4678798 -0.4679555 -0.4680312 [223] -0.4681068 -0.4681825 -0.4682580 -0.4683335 -0.4684090 -0.4684845 [229] -0.4685599 -0.4686352 -0.4687106 -0.4687859 -0.4688611 -0.4689363 [235] -0.4690115 -0.4690866 -0.4691617 -0.4692367 -0.4693117 -0.4693867 [241] -0.4694616 -0.4695365 -0.4696113 -0.4696861 -0.4697609 -0.4698356 [247] -0.4699103 -0.4699849 -0.4700595 -0.4701341 -0.4702086 -0.4702831 [253] -0.4703575 -0.4704319 -0.4705063 -0.4705806 -0.4706548 -0.4707291 [259] -0.4708032 -0.4708774 -0.4709515 -0.4710255 -0.4710995 -0.4711735 [265] -0.4712475 -0.4713213 -0.4713952 -0.4714690 -0.4715428 -0.4716165 [271] -0.4716902 -0.4717638 -0.4718374 -0.4719109 -0.4719844 -0.4720579 [277] -0.4721313 -0.4722047 -0.4722780 -0.4723513 -0.4724246 -0.4724978 [283] -0.4725709 -0.4726441 -0.4727171 -0.4727902 -0.4728631 -0.4729361 [289] -0.4730090 -0.4730818 -0.4731547 -0.4732274 -0.4733002 -0.4733728 [295] -0.4734455 -0.4735181 -0.4735906 -0.4736631 -0.4737356 -0.4738080 [301] -0.4738804 -0.4739527 -0.4740250 -0.4740972 -0.4741694 -0.4742415 [307] -0.4743136 -0.4743857 -0.4744577 -0.4745297 -0.4746016 -0.4746735 [313] -0.4747453 -0.4748171 -0.4748888 -0.4749605 -0.4750322 -0.4751038 [319] -0.4751754 -0.4752469 -0.4753183 -0.4753898 -0.4754611 -0.4755325 [325] -0.4756037 -0.4756750 -0.4757462 -0.4758173 -0.4758884 -0.4759595 [331] -0.4760305 -0.4761014 -0.4761724 -0.4762432 -0.4763140 -0.4763848 [337] -0.4764555 -0.4765262 -0.4765969 -0.4766674 -0.4767380 -0.4768085 [343] -0.4768789 -0.4769493 -0.4770197 -0.4770900 -0.4771602 -0.4772304 [349] -0.4773006 -0.4773707 -0.4774408 -0.4775108 -0.4775808 -0.4776507 [355] -0.4777206 -0.4777904 -0.4778602 -0.4779299 -0.4779996 -0.4780692 [361] -0.4781388 -0.4782083 -0.4782778 -0.4783473 -0.4784167 -0.4784860 [367] -0.4785553 -0.4786245 -0.4786937 -0.4787629 -0.4788320 -0.4789010 [373] -0.4789700 -0.4790390 -0.4791079 -0.4791768 -0.4792456 -0.4793143 [379] -0.4793830 -0.4794517 -0.4795203 -0.4795889 -0.4796574 -0.4797258 [385] -0.4797942 -0.4798626 -0.4799309 -0.4799992 -0.4800674 -0.4801355 [391] -0.4802036 -0.4802717 -0.4803397 -0.4804077 -0.4804756 -0.4805434 [397] -0.4806113 -0.4806790 -0.4807467 -0.4808144 -0.4808820 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1c80w1257952926.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/2m0t21257952926.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/3fw1u1257952926.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/4davv1257952927.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/5n37r1257952927.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/6stra1257952927.tab") > > system("convert tmp/1c80w1257952926.ps tmp/1c80w1257952926.png") > system("convert tmp/2m0t21257952926.ps tmp/2m0t21257952926.png") > system("convert tmp/3fw1u1257952926.ps tmp/3fw1u1257952926.png") > system("convert tmp/4davv1257952927.ps tmp/4davv1257952927.png") > system("convert tmp/5n37r1257952927.ps tmp/5n37r1257952927.png") > > > proc.time() user system elapsed 1.084 0.785 1.411