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(115.47,103.34,102.6,100.69,105.67,123.61,113.08,106.46,123.38,109.87,95.74,123.06,123.39,120.28,115.33,110.4,114.49,132.03,123.16,118.82,128.32,112.24,104.53,132.57,122.52,131.8,124.55,120.96,122.6,145.52,118.57,134.25,136.7,121.37,111.63,134.42,137.65,137.86,119.77,130.69,128.28,147.45,128.42,136.9,143.95,135.64,122.48,136.83,153.04,142.71,123.46,144.37,146.15,147.61,158.51,147.4,165.05,154.64,126.2,157.36,154.15,123.21,113.07,110.45,113.57,122.44,114.93,111.85,126.04,121.34) > #'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.4601127 0.4600721 0.4600314 0.4599904 0.4599493 0.4599080 0.4598666 [8] 0.4598250 0.4597832 0.4597412 0.4596991 0.4596568 0.4596143 0.4595717 [15] 0.4595289 0.4594859 0.4594427 0.4593994 0.4593559 0.4593123 0.4592684 [22] 0.4592244 0.4591803 0.4591359 0.4590914 0.4590468 0.4590019 0.4589569 [29] 0.4589117 0.4588664 0.4588209 0.4587752 0.4587294 0.4586834 0.4586372 [36] 0.4585909 0.4585443 0.4584977 0.4584508 0.4584038 0.4583567 0.4583093 [43] 0.4582618 0.4582142 0.4581663 0.4581183 0.4580702 0.4580219 0.4579734 [50] 0.4579247 0.4578759 0.4578270 0.4577778 0.4577285 0.4576791 0.4576294 [57] 0.4575796 0.4575297 0.4574796 0.4574293 0.4573789 0.4573283 0.4572775 [64] 0.4572266 0.4571755 0.4571243 0.4570729 0.4570214 0.4569696 0.4569178 [71] 0.4568657 0.4568135 0.4567612 0.4567087 0.4566560 0.4566032 0.4565502 [78] 0.4564970 0.4564437 0.4563903 0.4563366 0.4562829 0.4562289 0.4561749 [85] 0.4561206 0.4560662 0.4560116 0.4559569 0.4559021 0.4558470 0.4557919 [92] 0.4557365 0.4556810 0.4556254 0.4555696 0.4555137 0.4554575 0.4554013 [99] 0.4553449 0.4552883 0.4552316 0.4551747 0.4551177 0.4550605 0.4550032 [106] 0.4549457 0.4548881 0.4548303 0.4547724 0.4547143 0.4546561 0.4545977 [113] 0.4545391 0.4544804 0.4544216 0.4543626 0.4543035 0.4542442 0.4541848 [120] 0.4541252 0.4540655 0.4540056 0.4539456 0.4538854 0.4538251 0.4537646 [127] 0.4537040 0.4536432 0.4535823 0.4535213 0.4534601 0.4533987 0.4533372 [134] 0.4532756 0.4532138 0.4531519 0.4530898 0.4530276 0.4529652 0.4529027 [141] 0.4528401 0.4527773 0.4527143 0.4526513 0.4525880 0.4525247 0.4524612 [148] 0.4523975 0.4523337 0.4522698 0.4522057 0.4521415 0.4520772 0.4520127 [155] 0.4519481 0.4518833 0.4518184 0.4517533 0.4516881 0.4516228 0.4515573 [162] 0.4514917 0.4514260 0.4513601 0.4512941 0.4512279 0.4511616 0.4510952 [169] 0.4510286 0.4509619 0.4508950 0.4508281 0.4507609 0.4506937 0.4506263 [176] 0.4505588 0.4504911 0.4504233 0.4503554 0.4502873 0.4502191 0.4501508 [183] 0.4500824 0.4500138 0.4499450 0.4498762 0.4498072 0.4497381 0.4496688 [190] 0.4495994 0.4495299 0.4494603 0.4493905 0.4493206 0.4492505 0.4491804 [197] 0.4491101 0.4490396 0.4489691 0.4488984 0.4488276 0.4487566 0.4486856 [204] 0.4486144 0.4485430 0.4484716 0.4484000 0.4483283 0.4482565 0.4481845 [211] 0.4481124 0.4480402 0.4479679 0.4478954 0.4478228 0.4477501 0.4476773 [218] 0.4476043 0.4475312 0.4474580 0.4473847 0.4473112 0.4472376 0.4471639 [225] 0.4470901 0.4470162 0.4469421 0.4468679 0.4467936 0.4467192 0.4466446 [232] 0.4465700 0.4464952 0.4464203 0.4463452 0.4462701 0.4461948 0.4461194 [239] 0.4460439 0.4459683 0.4458925 0.4458167 0.4457407 0.4456646 0.4455884 [246] 0.4455121 0.4454356 0.4453591 0.4452824 0.4452056 0.4451287 0.4450517 [253] 0.4449745 0.4448973 0.4448199 0.4447424 0.4446648 0.4445871 0.4445093 [260] 0.4444314 0.4443533 0.4442752 0.4441969 0.4441185 0.4440400 0.4439614 [267] 0.4438827 0.4438039 0.4437249 0.4436459 0.4435667 0.4434874 0.4434081 [274] 0.4433286 0.4432490 0.4431693 0.4430895 0.4430095 0.4429295 0.4428494 [281] 0.4427691 0.4426888 0.4426083 0.4425278 0.4424471 0.4423663 0.4422854 [288] 0.4422045 0.4421234 0.4420422 0.4419609 0.4418795 0.4417980 0.4417163 [295] 0.4416346 0.4415528 0.4414709 0.4413889 0.4413067 0.4412245 0.4411422 [302] 0.4410598 0.4409772 0.4408946 0.4408118 0.4407290 0.4406461 0.4405630 [309] 0.4404799 0.4403967 0.4403133 0.4402299 0.4401464 0.4400628 0.4399790 [316] 0.4398952 0.4398113 0.4397273 0.4396431 0.4395589 0.4394746 0.4393902 [323] 0.4393057 0.4392211 0.4391364 0.4390516 0.4389668 0.4388818 0.4387967 [330] 0.4387116 0.4386263 0.4385410 0.4384555 0.4383700 0.4382843 0.4381986 [337] 0.4381128 0.4380269 0.4379409 0.4378548 0.4377686 0.4376824 0.4375960 [344] 0.4375096 0.4374230 0.4373364 0.4372497 0.4371629 0.4370760 0.4369890 [351] 0.4369019 0.4368147 0.4367275 0.4366402 0.4365527 0.4364652 0.4363776 [358] 0.4362899 0.4362022 0.4361143 0.4360264 0.4359384 0.4358502 0.4357620 [365] 0.4356738 0.4355854 0.4354970 0.4354084 0.4353198 0.4352311 0.4351423 [372] 0.4350535 0.4349645 0.4348755 0.4347864 0.4346972 0.4346079 0.4345185 [379] 0.4344291 0.4343396 0.4342500 0.4341603 0.4340706 0.4339807 0.4338908 [386] 0.4338008 0.4337107 0.4336206 0.4335304 0.4334401 0.4333497 0.4332592 [393] 0.4331687 0.4330780 0.4329874 0.4328966 0.4328057 0.4327148 0.4326238 [400] 0.4325327 0.4324416 > mx [1] 0.4601127 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1fbqj1258037128.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/2khph1258037128.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/3b6i91258037128.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/4lwsj1258037128.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/5iw5j1258037128.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/6h59x1258037128.tab") > > system("convert tmp/1fbqj1258037128.ps tmp/1fbqj1258037128.png") > system("convert tmp/2khph1258037128.ps tmp/2khph1258037128.png") > system("convert tmp/3b6i91258037128.ps tmp/3b6i91258037128.png") > system("convert tmp/4lwsj1258037128.ps tmp/4lwsj1258037128.png") > system("convert tmp/5iw5j1258037128.ps tmp/5iw5j1258037128.png") > > > proc.time() user system elapsed 1.709 1.261 2.037