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(85.9,76.8,96.2,83.9,88.7,105.4,86.7,76.3,93.2,105.1,121,163,94.7,78.4,101.4,91.2,89.9,112.2,81.5,78.8,99.1,101.3,91.5,152.6,86.6,86.6,98.5,86.7,89.1,111,92.6,85.1,116.1,98.3,97.7,177.9,94.2,83.8,109.5,102.3,102.5,162.7,85.3,88.2,104.7,99.4,113.8,166.6,89.2,93.2,115,97.2,112.5,121.8,100.2,93.8,113.6,110.7,127.6,185.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.4542825 0.4541418 0.4540005 0.4538584 0.4537156 0.4535722 0.4534280 [8] 0.4532831 0.4531375 0.4529912 0.4528442 0.4526965 0.4525481 0.4523990 [15] 0.4522492 0.4520987 0.4519474 0.4517955 0.4516428 0.4514895 0.4513354 [22] 0.4511807 0.4510252 0.4508690 0.4507121 0.4505545 0.4503962 0.4502372 [29] 0.4500775 0.4499170 0.4497559 0.4495941 0.4494315 0.4492683 0.4491043 [36] 0.4489396 0.4487742 0.4486081 0.4484414 0.4482739 0.4481056 0.4479367 [43] 0.4477671 0.4475968 0.4474257 0.4472540 0.4470816 0.4469084 0.4467346 [50] 0.4465600 0.4463848 0.4462088 0.4460321 0.4458548 0.4456767 0.4454979 [57] 0.4453184 0.4451383 0.4449574 0.4447758 0.4445935 0.4444106 0.4442269 [64] 0.4440425 0.4438575 0.4436717 0.4434853 0.4432981 0.4431103 0.4429217 [71] 0.4427325 0.4425426 0.4423520 0.4421607 0.4419687 0.4417760 0.4415827 [78] 0.4413886 0.4411939 0.4409985 0.4408024 0.4406056 0.4404081 0.4402100 [85] 0.4400111 0.4398116 0.4396114 0.4394106 0.4392090 0.4390068 0.4388040 [92] 0.4386004 0.4383962 0.4381913 0.4379857 0.4377795 0.4375726 0.4373651 [99] 0.4371568 0.4369480 0.4367384 0.4365282 0.4363174 0.4361059 0.4358937 [106] 0.4356809 0.4354674 0.4352533 0.4350385 0.4348231 0.4346071 0.4343903 [113] 0.4341730 0.4339550 0.4337364 0.4335171 0.4332973 0.4330767 0.4328556 [120] 0.4326338 0.4324114 0.4321883 0.4319647 0.4317404 0.4315155 0.4312900 [127] 0.4310638 0.4308371 0.4306097 0.4303817 0.4301531 0.4299239 0.4296941 [134] 0.4294637 0.4292327 0.4290011 0.4287689 0.4285362 0.4283028 0.4280688 [141] 0.4278343 0.4275991 0.4273634 0.4271271 0.4268902 0.4266528 0.4264147 [148] 0.4261761 0.4259370 0.4256972 0.4254569 0.4252161 0.4249746 0.4247327 [155] 0.4244901 0.4242471 0.4240034 0.4237593 0.4235145 0.4232693 0.4230235 [162] 0.4227772 0.4225303 0.4222829 0.4220350 0.4217865 0.4215376 0.4212881 [169] 0.4210381 0.4207876 0.4205365 0.4202850 0.4200330 0.4197804 0.4195274 [176] 0.4192739 0.4190198 0.4187653 0.4185103 0.4182548 0.4179988 0.4177424 [183] 0.4174855 0.4172281 0.4169702 0.4167119 0.4164531 0.4161938 0.4159341 [190] 0.4156740 0.4154134 0.4151523 0.4148908 0.4146289 0.4143665 0.4141037 [197] 0.4138404 0.4135767 0.4133127 0.4130481 0.4127832 0.4125179 0.4122521 [204] 0.4119859 0.4117194 0.4114524 0.4111850 0.4109173 0.4106491 0.4103806 [211] 0.4101117 0.4098424 0.4095727 0.4093027 0.4090323 0.4087615 0.4084904 [218] 0.4082189 0.4079470 0.4076748 0.4074023 0.4071294 0.4068562 0.4065826 [225] 0.4063087 0.4060345 0.4057599 0.4054851 0.4052099 0.4049344 0.4046586 [232] 0.4043824 0.4041060 0.4038293 0.4035523 0.4032750 0.4029974 0.4027195 [239] 0.4024414 0.4021629 0.4018842 0.4016053 0.4013260 0.4010465 0.4007668 [246] 0.4004868 0.4002066 0.3999261 0.3996453 0.3993644 0.3990832 0.3988017 [253] 0.3985201 0.3982382 0.3979561 0.3976738 0.3973913 0.3971086 0.3968256 [260] 0.3965425 0.3962592 0.3959757 0.3956920 0.3954082 0.3951241 0.3948399 [267] 0.3945555 0.3942710 0.3939863 0.3937014 0.3934164 0.3931312 0.3928459 [274] 0.3925605 0.3922749 0.3919892 0.3917033 0.3914173 0.3911313 0.3908451 [281] 0.3905587 0.3902723 0.3899858 0.3896992 0.3894124 0.3891256 0.3888387 [288] 0.3885517 0.3882647 0.3879775 0.3876903 0.3874030 0.3871157 0.3868283 [295] 0.3865409 0.3862534 0.3859658 0.3856782 0.3853906 0.3851029 0.3848152 [302] 0.3845275 0.3842398 0.3839520 0.3836642 0.3833765 0.3830887 0.3828009 [309] 0.3825131 0.3822253 0.3819376 0.3816498 0.3813621 0.3810744 0.3807867 [316] 0.3804990 0.3802114 0.3799238 0.3796363 0.3793488 0.3790613 0.3787740 [323] 0.3784866 0.3781994 0.3779122 0.3776250 0.3773380 0.3770510 0.3767641 [330] 0.3764773 0.3761906 0.3759040 0.3756175 0.3753311 0.3750448 0.3747586 [337] 0.3744725 0.3741865 0.3739007 0.3736149 0.3733293 0.3730439 0.3727586 [344] 0.3724734 0.3721884 0.3719035 0.3716187 0.3713342 0.3710497 0.3707655 [351] 0.3704814 0.3701975 0.3699138 0.3696302 0.3693468 0.3690636 0.3687806 [358] 0.3684978 0.3682152 0.3679328 0.3676506 0.3673686 0.3670868 0.3668052 [365] 0.3665239 0.3662428 0.3659619 0.3656812 0.3654008 0.3651206 0.3648406 [372] 0.3645609 0.3642814 0.3640022 0.3637233 0.3634445 0.3631661 0.3628879 [379] 0.3626100 0.3623324 0.3620550 0.3617779 0.3615011 0.3612246 0.3609484 [386] 0.3606725 0.3603968 0.3601215 0.3598464 0.3595717 0.3592973 0.3590231 [393] 0.3587493 0.3584759 0.3582027 0.3579299 0.3576573 0.3573852 0.3571133 [400] 0.3568418 0.3565706 > mx [1] 0.4542825 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/15psk1258125915.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/20iqb1258125915.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/3v05h1258125915.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/4hh7i1258125915.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/5c0yw1258125915.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/6cldx1258125915.tab") > > system("convert tmp/15psk1258125915.ps tmp/15psk1258125915.png") > system("convert tmp/20iqb1258125915.ps tmp/20iqb1258125915.png") > system("convert tmp/3v05h1258125915.ps tmp/3v05h1258125915.png") > system("convert tmp/4hh7i1258125915.ps tmp/4hh7i1258125915.png") > system("convert tmp/5c0yw1258125915.ps tmp/5c0yw1258125915.png") > > > proc.time() user system elapsed 1.129 0.807 1.443