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(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.4571490 0.4570261 0.4569031 0.4567801 0.4566569 0.4565337 0.4564103 [8] 0.4562869 0.4561634 0.4560398 0.4559161 0.4557923 0.4556684 0.4555444 [15] 0.4554204 0.4552962 0.4551720 0.4550476 0.4549232 0.4547987 0.4546741 [22] 0.4545495 0.4544247 0.4542998 0.4541749 0.4540499 0.4539248 0.4537996 [29] 0.4536743 0.4535489 0.4534234 0.4532979 0.4531723 0.4530465 0.4529207 [36] 0.4527948 0.4526689 0.4525428 0.4524167 0.4522904 0.4521641 0.4520377 [43] 0.4519113 0.4517847 0.4516580 0.4515313 0.4514045 0.4512776 0.4511506 [50] 0.4510236 0.4508964 0.4507692 0.4506419 0.4505145 0.4503870 0.4502595 [57] 0.4501318 0.4500041 0.4498763 0.4497484 0.4496205 0.4494924 0.4493643 [64] 0.4492361 0.4491079 0.4489795 0.4488511 0.4487225 0.4485940 0.4484653 [71] 0.4483365 0.4482077 0.4480788 0.4479498 0.4478207 0.4476916 0.4475624 [78] 0.4474331 0.4473037 0.4471743 0.4470447 0.4469151 0.4467855 0.4466557 [85] 0.4465259 0.4463960 0.4462660 0.4461360 0.4460058 0.4458756 0.4457453 [92] 0.4456150 0.4454846 0.4453541 0.4452235 0.4450928 0.4449621 0.4448313 [99] 0.4447005 0.4445695 0.4444385 0.4443074 0.4441763 0.4440450 0.4439137 [106] 0.4437824 0.4436509 0.4435194 0.4433878 0.4432562 0.4431244 0.4429926 [113] 0.4428608 0.4427288 0.4425968 0.4424648 0.4423326 0.4422004 0.4420681 [120] 0.4419358 0.4418034 0.4416709 0.4415383 0.4414057 0.4412730 0.4411402 [127] 0.4410074 0.4408745 0.4407416 0.4406085 0.4404754 0.4403423 0.4402091 [134] 0.4400758 0.4399424 0.4398090 0.4396755 0.4395420 0.4394083 0.4392747 [141] 0.4391409 0.4390071 0.4388732 0.4387393 0.4386053 0.4384712 0.4383371 [148] 0.4382029 0.4380687 0.4379343 0.4378000 0.4376655 0.4375310 0.4373965 [155] 0.4372618 0.4371271 0.4369924 0.4368576 0.4367227 0.4365878 0.4364528 [162] 0.4363178 0.4361826 0.4360475 0.4359122 0.4357770 0.4356416 0.4355062 [169] 0.4353707 0.4352352 0.4350996 0.4349640 0.4348283 0.4346926 0.4345567 [176] 0.4344209 0.4342849 0.4341490 0.4340129 0.4338768 0.4337407 0.4336045 [183] 0.4334682 0.4333319 0.4331955 0.4330591 0.4329226 0.4327861 0.4326495 [190] 0.4325128 0.4323761 0.4322394 0.4321026 0.4319657 0.4318288 0.4316918 [197] 0.4315548 0.4314177 0.4312806 0.4311434 0.4310062 0.4308689 0.4307316 [204] 0.4305942 0.4304567 0.4303193 0.4301817 0.4300441 0.4299065 0.4297688 [211] 0.4296311 0.4294933 0.4293554 0.4292175 0.4290796 0.4289416 0.4288036 [218] 0.4286655 0.4285274 0.4283892 0.4282510 0.4281127 0.4279744 0.4278360 [225] 0.4276976 0.4275591 0.4274206 0.4272821 0.4271435 0.4270048 0.4268661 [232] 0.4267274 0.4265886 0.4264497 0.4263109 0.4261720 0.4260330 0.4258940 [239] 0.4257549 0.4256158 0.4254767 0.4253375 0.4251983 0.4250590 0.4249197 [246] 0.4247803 0.4246409 0.4245015 0.4243620 0.4242225 0.4240829 0.4239433 [253] 0.4238036 0.4236640 0.4235242 0.4233844 0.4232446 0.4231048 0.4229649 [260] 0.4228250 0.4226850 0.4225450 0.4224049 0.4222648 0.4221247 0.4219845 [267] 0.4218443 0.4217041 0.4215638 0.4214235 0.4212831 0.4211427 0.4210023 [274] 0.4208618 0.4207213 0.4205808 0.4204402 0.4202996 0.4201589 0.4200182 [281] 0.4198775 0.4197367 0.4195959 0.4194551 0.4193143 0.4191734 0.4190324 [288] 0.4188915 0.4187505 0.4186094 0.4184684 0.4183272 0.4181861 0.4180449 [295] 0.4179037 0.4177625 0.4176212 0.4174800 0.4173386 0.4171973 0.4170559 [302] 0.4169144 0.4167730 0.4166315 0.4164900 0.4163484 0.4162069 0.4160653 [309] 0.4159236 0.4157820 0.4156403 0.4154985 0.4153568 0.4152150 0.4150732 [316] 0.4149313 0.4147895 0.4146476 0.4145057 0.4143637 0.4142217 0.4140797 [323] 0.4139377 0.4137956 0.4136535 0.4135114 0.4133693 0.4132271 0.4130849 [330] 0.4129427 0.4128004 0.4126582 0.4125159 0.4123736 0.4122312 0.4120888 [337] 0.4119465 0.4118040 0.4116616 0.4115191 0.4113766 0.4112341 0.4110916 [344] 0.4109490 0.4108065 0.4106639 0.4105212 0.4103786 0.4102359 0.4100932 [351] 0.4099505 0.4098078 0.4096650 0.4095222 0.4093794 0.4092366 0.4090938 [358] 0.4089509 0.4088081 0.4086652 0.4085222 0.4083793 0.4082363 0.4080934 [365] 0.4079504 0.4078074 0.4076643 0.4075213 0.4073782 0.4072351 0.4070920 [372] 0.4069489 0.4068058 0.4066626 0.4065194 0.4063762 0.4062330 0.4060898 [379] 0.4059466 0.4058033 0.4056601 0.4055168 0.4053735 0.4052302 0.4050868 [386] 0.4049435 0.4048001 0.4046567 0.4045134 0.4043700 0.4042265 0.4040831 [393] 0.4039397 0.4037962 0.4036527 0.4035093 0.4033658 0.4032223 0.4030787 [400] 0.4029352 0.4027917 > mx [1] 0.457149 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1q9ek1229449682.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/2t6ez1229449682.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/3z0631229449682.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/4h50g1229449682.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/5ji831229449682.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/6156z1229449683.tab") > > system("convert tmp/1q9ek1229449682.ps tmp/1q9ek1229449682.png") > system("convert tmp/2t6ez1229449682.ps tmp/2t6ez1229449682.png") > system("convert tmp/3z0631229449682.ps tmp/3z0631229449682.png") > system("convert tmp/4h50g1229449682.ps tmp/4h50g1229449682.png") > system("convert tmp/5ji831229449682.ps tmp/5ji831229449682.png") > > > proc.time() user system elapsed 1.730 1.284 1.962