R version 2.7.0 (2008-04-22) 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(106.7,110.2,125.9,100.1,106.4,114.8,81.3,87,104.2,108,105,94.5,92,95.9,108.8,103.4,102.1,110.1,83.2,82.7,106.8,113.7,102.5,96.6,92.1,95.6,102.3,98.6,98.2,104.5,84,73.8,103.9,106,97.2,102.6,89,93.8,116.7,106.8,98.5,118.7,90,91.9,113.3,113.1,104.1,108.7,96.7,101,116.9,105.8,99,129.4,83,88.9,115.9,104.2,113.4,112.2,100.8,107.3,126.6,102.9,117.9,128.8,87.5,93.8,122.7,126.2,124.6,116.7,115.2,111.1,129.9,113.3,118.5,137.9,103.6,101.7,127.4,137.5,128.3,118.2) > #'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.3672485 0.3674957 0.3677427 0.3679896 0.3682364 0.3684830 0.3687294 [8] 0.3689757 0.3692218 0.3694678 0.3697136 0.3699593 0.3702048 0.3704502 [15] 0.3706954 0.3709404 0.3711853 0.3714301 0.3716746 0.3719190 0.3721633 [22] 0.3724074 0.3726513 0.3728951 0.3731387 0.3733821 0.3736254 0.3738685 [29] 0.3741114 0.3743542 0.3745968 0.3748392 0.3750815 0.3753236 0.3755655 [36] 0.3758072 0.3760488 0.3762902 0.3765315 0.3767725 0.3770134 0.3772541 [43] 0.3774946 0.3777349 0.3779751 0.3782151 0.3784549 0.3786945 0.3789340 [50] 0.3791732 0.3794123 0.3796512 0.3798899 0.3801285 0.3803668 0.3806049 [57] 0.3808429 0.3810807 0.3813183 0.3815557 0.3817929 0.3820299 0.3822667 [64] 0.3825034 0.3827398 0.3829761 0.3832121 0.3834480 0.3836836 0.3839191 [71] 0.3841544 0.3843894 0.3846243 0.3848590 0.3850935 0.3853277 0.3855618 [78] 0.3857957 0.3860293 0.3862628 0.3864961 0.3867291 0.3869620 0.3871946 [85] 0.3874270 0.3876593 0.3878913 0.3881231 0.3883547 0.3885861 0.3888173 [92] 0.3890482 0.3892790 0.3895095 0.3897399 0.3899700 0.3901999 0.3904296 [99] 0.3906590 0.3908883 0.3911173 0.3913461 0.3915747 0.3918031 0.3920313 [106] 0.3922592 0.3924869 0.3927144 0.3929417 0.3931687 0.3933956 0.3936222 [113] 0.3938485 0.3940747 0.3943006 0.3945263 0.3947518 0.3949770 0.3952020 [120] 0.3954268 0.3956513 0.3958756 0.3960997 0.3963236 0.3965472 0.3967706 [127] 0.3969937 0.3972166 0.3974393 0.3976617 0.3978840 0.3981059 0.3983277 [134] 0.3985491 0.3987704 0.3989914 0.3992122 0.3994327 0.3996530 0.3998730 [141] 0.4000929 0.4003124 0.4005317 0.4007508 0.4009696 0.4011882 0.4014065 [148] 0.4016246 0.4018425 0.4020601 0.4022774 0.4024945 0.4027113 0.4029279 [155] 0.4031443 0.4033604 0.4035762 0.4037918 0.4040071 0.4042222 0.4044370 [162] 0.4046516 0.4048659 0.4050800 0.4052938 0.4055073 0.4057206 0.4059336 [169] 0.4061464 0.4063589 0.4065711 0.4067831 0.4069948 0.4072063 0.4074175 [176] 0.4076284 0.4078391 0.4080495 0.4082597 0.4084695 0.4086791 0.4088885 [183] 0.4090976 0.4093064 0.4095149 0.4097232 0.4099312 0.4101390 0.4103464 [190] 0.4105536 0.4107606 0.4109672 0.4111736 0.4113797 0.4115856 0.4117911 [197] 0.4119964 0.4122015 0.4124062 0.4126107 0.4128149 0.4130188 0.4132224 [204] 0.4134258 0.4136289 0.4138317 0.4140342 0.4142364 0.4144384 0.4146401 [211] 0.4148415 0.4150426 0.4152435 0.4154440 0.4156443 0.4158443 0.4160440 [218] 0.4162435 0.4164426 0.4166415 0.4168401 0.4170383 0.4172363 0.4174341 [225] 0.4176315 0.4178286 0.4180255 0.4182220 0.4184183 0.4186143 0.4188100 [232] 0.4190054 0.4192005 0.4193953 0.4195899 0.4197841 0.4199781 0.4201717 [239] 0.4203651 0.4205582 0.4207509 0.4209434 0.4211356 0.4213275 0.4215191 [246] 0.4217104 0.4219014 0.4220921 0.4222825 0.4224726 0.4226624 0.4228519 [253] 0.4230411 0.4232300 0.4234187 0.4236070 0.4237950 0.4239827 0.4241701 [260] 0.4243572 0.4245440 0.4247305 0.4249167 0.4251026 0.4252882 0.4254735 [267] 0.4256585 0.4258432 0.4260275 0.4262116 0.4263954 0.4265788 0.4267620 [274] 0.4269448 0.4271274 0.4273096 0.4274915 0.4276732 0.4278545 0.4280355 [281] 0.4282161 0.4283965 0.4285766 0.4287564 0.4289358 0.4291149 0.4292938 [288] 0.4294723 0.4296505 0.4298284 0.4300060 0.4301832 0.4303602 0.4305368 [295] 0.4307132 0.4308892 0.4310649 0.4312402 0.4314153 0.4315901 0.4317645 [302] 0.4319386 0.4321124 0.4322859 0.4324591 0.4326320 0.4328045 0.4329767 [309] 0.4331486 0.4333202 0.4334915 0.4336624 0.4338331 0.4340034 0.4341734 [316] 0.4343430 0.4345124 0.4346814 0.4348501 0.4350185 0.4351866 0.4353543 [323] 0.4355218 0.4356889 0.4358557 0.4360221 0.4361883 0.4363541 0.4365196 [330] 0.4366847 0.4368496 0.4370141 0.4371783 0.4373422 0.4375057 0.4376690 [337] 0.4378319 0.4379945 0.4381567 0.4383186 0.4384802 0.4386415 0.4388025 [344] 0.4389631 0.4391234 0.4392834 0.4394430 0.4396023 0.4397613 0.4399200 [351] 0.4400783 0.4402363 0.4403940 0.4405514 0.4407084 0.4408651 0.4410214 [358] 0.4411775 0.4413332 0.4414886 0.4416436 0.4417983 0.4419527 0.4421068 [365] 0.4422605 0.4424139 0.4425670 0.4427197 0.4428722 0.4430242 0.4431760 [372] 0.4433274 0.4434785 0.4436292 0.4437797 0.4439298 0.4440795 0.4442290 [379] 0.4443780 0.4445268 0.4446752 0.4448233 0.4449711 0.4451186 0.4452657 [386] 0.4454124 0.4455589 0.4457050 0.4458507 0.4459962 0.4461413 0.4462860 [393] 0.4464305 0.4465746 0.4467183 0.4468618 0.4470049 0.4471476 0.4472901 [400] 0.4474322 0.4475739 > mx [1] 0.4475739 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/18zsn1226518269.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/2t65h1226518269.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/3eo7s1226518269.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/4q20f1226518269.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/5pt1p1226518269.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/62esm1226518269.tab") > > system("convert tmp/18zsn1226518269.ps tmp/18zsn1226518269.png") > system("convert tmp/2t65h1226518269.ps tmp/2t65h1226518269.png") > system("convert tmp/3eo7s1226518269.ps tmp/3eo7s1226518269.png") > system("convert tmp/4q20f1226518269.ps tmp/4q20f1226518269.png") > system("convert tmp/5pt1p1226518269.ps tmp/5pt1p1226518269.png") > > > proc.time() user system elapsed 2.428 1.326 2.625