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(7.5,6.8,6.5,6.6,7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.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.4469537 -0.4469176 -0.4468815 -0.4468452 -0.4468088 -0.4467723 [7] -0.4467358 -0.4466991 -0.4466623 -0.4466254 -0.4465884 -0.4465513 [13] -0.4465140 -0.4464767 -0.4464393 -0.4464018 -0.4463641 -0.4463264 [19] -0.4462885 -0.4462506 -0.4462125 -0.4461744 -0.4461361 -0.4460977 [25] -0.4460592 -0.4460207 -0.4459820 -0.4459432 -0.4459043 -0.4458653 [31] -0.4458262 -0.4457870 -0.4457477 -0.4457083 -0.4456687 -0.4456291 [37] -0.4455894 -0.4455496 -0.4455096 -0.4454696 -0.4454295 -0.4453892 [43] -0.4453489 -0.4453084 -0.4452679 -0.4452272 -0.4451864 -0.4451456 [49] -0.4451046 -0.4450635 -0.4450224 -0.4449811 -0.4449397 -0.4448982 [55] -0.4448567 -0.4448150 -0.4447732 -0.4447313 -0.4446893 -0.4446472 [61] -0.4446050 -0.4445627 -0.4445203 -0.4444778 -0.4444352 -0.4443925 [67] -0.4443497 -0.4443068 -0.4442637 -0.4442206 -0.4441774 -0.4441341 [73] -0.4440907 -0.4440472 -0.4440035 -0.4439598 -0.4439160 -0.4438721 [79] -0.4438281 -0.4437839 -0.4437397 -0.4436954 -0.4436509 -0.4436064 [85] -0.4435618 -0.4435171 -0.4434722 -0.4434273 -0.4433823 -0.4433372 [91] -0.4432919 -0.4432466 -0.4432012 -0.4431556 -0.4431100 -0.4430643 [97] -0.4430185 -0.4429725 -0.4429265 -0.4428804 -0.4428342 -0.4427878 [103] -0.4427414 -0.4426949 -0.4426483 -0.4426016 -0.4425547 -0.4425078 [109] -0.4424608 -0.4424137 -0.4423665 -0.4423192 -0.4422718 -0.4422243 [115] -0.4421767 -0.4421290 -0.4420812 -0.4420333 -0.4419853 -0.4419372 [121] -0.4418890 -0.4418407 -0.4417923 -0.4417438 -0.4416952 -0.4416466 [127] -0.4415978 -0.4415489 -0.4415000 -0.4414509 -0.4414017 -0.4413525 [133] -0.4413031 -0.4412537 -0.4412041 -0.4411545 -0.4411047 -0.4410549 [139] -0.4410050 -0.4409550 -0.4409048 -0.4408546 -0.4408043 -0.4407539 [145] -0.4407034 -0.4406528 -0.4406021 -0.4405513 -0.4405004 -0.4404494 [151] -0.4403984 -0.4403472 -0.4402959 -0.4402446 -0.4401931 -0.4401415 [157] -0.4400899 -0.4400382 -0.4399863 -0.4399344 -0.4398824 -0.4398303 [163] -0.4397781 -0.4397258 -0.4396734 -0.4396209 -0.4395683 -0.4395156 [169] -0.4394628 -0.4394100 -0.4393570 -0.4393040 -0.4392508 -0.4391976 [175] -0.4391443 -0.4390909 -0.4390373 -0.4389837 -0.4389300 -0.4388762 [181] -0.4388224 -0.4387684 -0.4387143 -0.4386602 -0.4386059 -0.4385516 [187] -0.4384971 -0.4384426 -0.4383880 -0.4383333 -0.4382785 -0.4382236 [193] -0.4381686 -0.4381135 -0.4380584 -0.4380031 -0.4379478 -0.4378923 [199] -0.4378368 -0.4377812 -0.4377255 -0.4376697 -0.4376138 -0.4375578 [205] -0.4375018 -0.4374456 -0.4373894 -0.4373330 -0.4372766 -0.4372201 [211] -0.4371635 -0.4371068 -0.4370500 -0.4369931 -0.4369362 -0.4368791 [217] -0.4368220 -0.4367648 -0.4367074 -0.4366500 -0.4365925 -0.4365350 [223] -0.4364773 -0.4364195 -0.4363617 -0.4363038 -0.4362457 -0.4361876 [229] -0.4361294 -0.4360711 -0.4360128 -0.4359543 -0.4358958 -0.4358371 [235] -0.4357784 -0.4357196 -0.4356607 -0.4356017 -0.4355427 -0.4354835 [241] -0.4354243 -0.4353650 -0.4353056 -0.4352461 -0.4351865 -0.4351268 [247] -0.4350670 -0.4350072 -0.4349473 -0.4348873 -0.4348272 -0.4347670 [253] -0.4347067 -0.4346464 -0.4345859 -0.4345254 -0.4344648 -0.4344041 [259] -0.4343433 -0.4342825 -0.4342215 -0.4341605 -0.4340994 -0.4340382 [265] -0.4339769 -0.4339156 -0.4338541 -0.4337926 -0.4337310 -0.4336693 [271] -0.4336075 -0.4335456 -0.4334837 -0.4334217 -0.4333595 -0.4332973 [277] -0.4332351 -0.4331727 -0.4331103 -0.4330477 -0.4329851 -0.4329224 [283] -0.4328597 -0.4327968 -0.4327339 -0.4326709 -0.4326078 -0.4325446 [289] -0.4324813 -0.4324180 -0.4323546 -0.4322911 -0.4322275 -0.4321638 [295] -0.4321001 -0.4320362 -0.4319723 -0.4319083 -0.4318443 -0.4317801 [301] -0.4317159 -0.4316516 -0.4315872 -0.4315227 -0.4314582 -0.4313935 [307] -0.4313288 -0.4312641 -0.4311992 -0.4311342 -0.4310692 -0.4310041 [313] -0.4309389 -0.4308737 -0.4308083 -0.4307429 -0.4306774 -0.4306119 [319] -0.4305462 -0.4304805 -0.4304147 -0.4303488 -0.4302828 -0.4302168 [325] -0.4301507 -0.4300845 -0.4300182 -0.4299518 -0.4298854 -0.4298189 [331] -0.4297523 -0.4296857 -0.4296190 -0.4295521 -0.4294853 -0.4294183 [337] -0.4293513 -0.4292841 -0.4292170 -0.4291497 -0.4290823 -0.4290149 [343] -0.4289474 -0.4288799 -0.4288122 -0.4287445 -0.4286767 -0.4286088 [349] -0.4285409 -0.4284729 -0.4284048 -0.4283366 -0.4282684 -0.4282001 [355] -0.4281317 -0.4280632 -0.4279947 -0.4279261 -0.4278574 -0.4277886 [361] -0.4277198 -0.4276509 -0.4275819 -0.4275129 -0.4274437 -0.4273745 [367] -0.4273053 -0.4272359 -0.4271665 -0.4270970 -0.4270275 -0.4269578 [373] -0.4268881 -0.4268184 -0.4267485 -0.4266786 -0.4266086 -0.4265385 [379] -0.4264684 -0.4263982 -0.4263279 -0.4262576 -0.4261871 -0.4261167 [385] -0.4260461 -0.4259755 -0.4259048 -0.4258340 -0.4257631 -0.4256922 [391] -0.4256212 -0.4255502 -0.4254791 -0.4254079 -0.4253366 -0.4252653 [397] -0.4251939 -0.4251224 -0.4250509 -0.4249793 -0.4249076 > 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/174bd1257756941.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/25bu91257756941.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/39lg91257756941.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/4c0fk1257756941.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/5t1p71257756941.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/6glpj1257756941.tab") > > system("convert tmp/174bd1257756941.ps tmp/174bd1257756941.png") > system("convert tmp/25bu91257756941.ps tmp/25bu91257756941.png") > system("convert tmp/39lg91257756941.ps tmp/39lg91257756941.png") > system("convert tmp/4c0fk1257756941.ps tmp/4c0fk1257756941.png") > system("convert tmp/5t1p71257756941.ps tmp/5t1p71257756941.png") > > > proc.time() user system elapsed 1.063 0.775 1.639