R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(36409,33163,34122,35225,28249,30374,26311,22069,23651,28628,23187,14727,43080,32519,39657,33614,28671,34243,27336,22916,24537,26128,22602,15744,41086,39690,43129,37863,35953,29133,24693,22205,21725,27192,21790,13253,37702,30364,32609,30212,29965,28352,25814,22414,20506,28806,22228,13971,36845,35338,35022,34777,26887,23970,22780,17351,21382,24561,17409,11514,31514,27071,29462,26105,22397,23843,21705,18089,20764,25316,17704,15548,28029,29383,36438,32034,22679,24319,18004,17537,20366,22782,19169,13807,29743,25591,29096,26482,22405,27044,17970,18730,19684,19785,18479,10698) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.3827870 -0.3831832 -0.3835791 -0.3839746 -0.3843697 -0.3847645 [7] -0.3851590 -0.3855530 -0.3859467 -0.3863399 -0.3867327 -0.3871251 [13] -0.3875171 -0.3879086 -0.3882996 -0.3886902 -0.3890802 -0.3894698 [19] -0.3898589 -0.3902474 -0.3906354 -0.3910229 -0.3914098 -0.3917961 [25] -0.3921818 -0.3925670 -0.3929516 -0.3933355 -0.3937188 -0.3941015 [31] -0.3944835 -0.3948649 -0.3952456 -0.3956256 -0.3960049 -0.3963835 [37] -0.3967614 -0.3971386 -0.3975150 -0.3978907 -0.3982656 -0.3986397 [43] -0.3990130 -0.3993856 -0.3997573 -0.4001283 -0.4004984 -0.4008676 [49] -0.4012360 -0.4016035 -0.4019702 -0.4023360 -0.4027009 -0.4030648 [55] -0.4034279 -0.4037900 -0.4041512 -0.4045114 -0.4048707 -0.4052290 [61] -0.4055863 -0.4059427 -0.4062980 -0.4066523 -0.4070056 -0.4073578 [67] -0.4077090 -0.4080592 -0.4084083 -0.4087563 -0.4091032 -0.4094490 [73] -0.4097937 -0.4101373 -0.4104798 -0.4108212 -0.4111614 -0.4115004 [79] -0.4118383 -0.4121750 -0.4125105 -0.4128448 -0.4131779 -0.4135098 [85] -0.4138405 -0.4141699 -0.4144982 -0.4148251 -0.4151508 -0.4154752 [91] -0.4157984 -0.4161203 -0.4164408 -0.4167601 -0.4170780 -0.4173947 [97] -0.4177100 -0.4180239 -0.4183366 -0.4186478 -0.4189577 -0.4192663 [103] -0.4195734 -0.4198792 -0.4201835 -0.4204865 -0.4207880 -0.4210882 [109] -0.4213869 -0.4216841 -0.4219800 -0.4222743 -0.4225673 -0.4228587 [115] -0.4231487 -0.4234372 -0.4237242 -0.4240098 -0.4242938 -0.4245763 [121] -0.4248573 -0.4251368 -0.4254148 -0.4256912 -0.4259661 -0.4262394 [127] -0.4265112 -0.4267815 -0.4270501 -0.4273172 -0.4275827 -0.4278467 [133] -0.4281090 -0.4283698 -0.4286290 -0.4288865 -0.4291425 -0.4293968 [139] -0.4296495 -0.4299006 -0.4301500 -0.4303979 -0.4306440 -0.4308886 [145] -0.4311315 -0.4313727 -0.4316123 -0.4318502 -0.4320864 -0.4323210 [151] -0.4325539 -0.4327851 -0.4330146 -0.4332424 -0.4334686 -0.4336930 [157] -0.4339158 -0.4341368 -0.4343561 -0.4345738 -0.4347897 -0.4350039 [163] -0.4352164 -0.4354271 -0.4356361 -0.4358434 -0.4360490 -0.4362528 [169] -0.4364549 -0.4366553 -0.4368539 -0.4370507 -0.4372459 -0.4374392 [175] -0.4376309 -0.4378207 -0.4380088 -0.4381952 -0.4383798 -0.4385626 [181] -0.4387437 -0.4389230 -0.4391005 -0.4392763 -0.4394503 -0.4396225 [187] -0.4397930 -0.4399617 -0.4401286 -0.4402937 -0.4404571 -0.4406187 [193] -0.4407785 -0.4409365 -0.4410928 -0.4412473 -0.4414000 -0.4415509 [199] -0.4417000 -0.4418474 -0.4419930 -0.4421368 -0.4422788 -0.4424191 [205] -0.4425576 -0.4426943 -0.4428292 -0.4429623 -0.4430937 -0.4432233 [211] -0.4433511 -0.4434771 -0.4436014 -0.4437239 -0.4438446 -0.4439635 [217] -0.4440807 -0.4441961 -0.4443098 -0.4444216 -0.4445317 -0.4446401 [223] -0.4447467 -0.4448515 -0.4449545 -0.4450558 -0.4451554 -0.4452532 [229] -0.4453492 -0.4454435 -0.4455360 -0.4456268 -0.4457159 -0.4458032 [235] -0.4458888 -0.4459726 -0.4460547 -0.4461350 -0.4462137 -0.4462906 [241] -0.4463657 -0.4464392 -0.4465109 -0.4465809 -0.4466492 -0.4467158 [247] -0.4467807 -0.4468439 -0.4469054 -0.4469651 -0.4470232 -0.4470796 [253] -0.4471343 -0.4471873 -0.4472386 -0.4472882 -0.4473362 -0.4473825 [259] -0.4474271 -0.4474700 -0.4475113 -0.4475509 -0.4475889 -0.4476252 [265] -0.4476599 -0.4476929 -0.4477243 -0.4477540 -0.4477821 -0.4478086 [271] -0.4478334 -0.4478566 -0.4478783 -0.4478982 -0.4479166 -0.4479334 [277] -0.4479486 -0.4479622 -0.4479741 -0.4479845 -0.4479934 -0.4480006 [283] -0.4480062 -0.4480103 -0.4480129 -0.4480138 -0.4480132 -0.4480111 [289] -0.4480073 -0.4480021 -0.4479953 -0.4479870 -0.4479771 -0.4479658 [295] -0.4479529 -0.4479384 -0.4479225 -0.4479051 -0.4478861 -0.4478657 [301] -0.4478438 -0.4478204 -0.4477955 -0.4477691 -0.4477413 -0.4477120 [307] -0.4476812 -0.4476490 -0.4476153 -0.4475802 -0.4475436 -0.4475056 [313] -0.4474661 -0.4474253 -0.4473830 -0.4473393 -0.4472942 -0.4472476 [319] -0.4471997 -0.4471504 -0.4470997 -0.4470476 -0.4469941 -0.4469393 [325] -0.4468831 -0.4468255 -0.4467666 -0.4467063 -0.4466446 -0.4465816 [331] -0.4465173 -0.4464517 -0.4463847 -0.4463164 -0.4462468 -0.4461759 [337] -0.4461036 -0.4460301 -0.4459553 -0.4458792 -0.4458018 -0.4457231 [343] -0.4456432 -0.4455620 -0.4454795 -0.4453958 -0.4453108 -0.4452246 [349] -0.4451372 -0.4450485 -0.4449585 -0.4448674 -0.4447750 -0.4446815 [355] -0.4445867 -0.4444907 -0.4443936 -0.4442952 -0.4441957 -0.4440949 [361] -0.4439930 -0.4438900 -0.4437858 -0.4436804 -0.4435738 -0.4434662 [367] -0.4433573 -0.4432474 -0.4431363 -0.4430241 -0.4429108 -0.4427964 [373] -0.4426808 -0.4425642 -0.4424464 -0.4423276 -0.4422077 -0.4420867 [379] -0.4419647 -0.4418415 -0.4417173 -0.4415921 -0.4414658 -0.4413384 [385] -0.4412100 -0.4410806 -0.4409501 -0.4408187 -0.4406862 -0.4405526 [391] -0.4404181 -0.4402826 -0.4401461 -0.4400086 -0.4398701 -0.4397306 [397] -0.4395901 -0.4394487 -0.4393063 -0.4391629 -0.4390186 > 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/182gr1197548728.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/2huq91197548728.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/3zqhf1197548728.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/443qq1197548728.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5kj5e1197548728.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > 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/6a81p1197548728.tab") > > system("convert tmp/182gr1197548728.ps tmp/182gr1197548728.png") > system("convert tmp/2huq91197548728.ps tmp/2huq91197548728.png") > system("convert tmp/3zqhf1197548728.ps tmp/3zqhf1197548728.png") > system("convert tmp/443qq1197548728.ps tmp/443qq1197548728.png") > system("convert tmp/5kj5e1197548728.ps tmp/5kj5e1197548728.png") > > > proc.time() user system elapsed 1.318 0.804 1.513