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(109.6,103,111.6,106.3,97.9,108.8,103.9,101.2,122.9,123.9,111.7,120.9,99.6,103.3,119.4,106.5,101.9,124.6,106.5,107.8,127.4,120.1,118.5,127.7,107.7,104.5,118.8,110.3,109.6,119.1,96.5,106.7,126.3,116.2,118.8,115.2,110,111.4,129.6,108.1,117.8,122.9,100.6,111.8,127,128.6,124.8,118.5,114.7,112.6,128.7,111,115.8,126,111.1,113.2,120.1,130.6,124,119.4,116.7) > #'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.4222198 0.4222062 0.4221925 0.4221787 0.4221648 0.4221507 0.4221366 [8] 0.4221224 0.4221081 0.4220936 0.4220791 0.4220645 0.4220498 0.4220350 [15] 0.4220201 0.4220050 0.4219899 0.4219747 0.4219594 0.4219440 0.4219285 [22] 0.4219128 0.4218971 0.4218813 0.4218654 0.4218494 0.4218333 0.4218171 [29] 0.4218008 0.4217844 0.4217679 0.4217513 0.4217346 0.4217178 0.4217009 [36] 0.4216839 0.4216668 0.4216496 0.4216324 0.4216150 0.4215975 0.4215799 [43] 0.4215622 0.4215445 0.4215266 0.4215086 0.4214906 0.4214724 0.4214541 [50] 0.4214358 0.4214173 0.4213988 0.4213801 0.4213614 0.4213425 0.4213236 [57] 0.4213045 0.4212854 0.4212662 0.4212469 0.4212274 0.4212079 0.4211883 [64] 0.4211686 0.4211488 0.4211289 0.4211089 0.4210888 0.4210686 0.4210483 [71] 0.4210279 0.4210074 0.4209869 0.4209662 0.4209454 0.4209245 0.4209036 [78] 0.4208825 0.4208614 0.4208401 0.4208188 0.4207974 0.4207758 0.4207542 [85] 0.4207325 0.4207107 0.4206888 0.4206668 0.4206447 0.4206225 0.4206002 [92] 0.4205778 0.4205553 0.4205328 0.4205101 0.4204874 0.4204645 0.4204416 [99] 0.4204185 0.4203954 0.4203722 0.4203488 0.4203254 0.4203019 0.4202783 [106] 0.4202546 0.4202308 0.4202070 0.4201830 0.4201589 0.4201348 0.4201105 [113] 0.4200862 0.4200617 0.4200372 0.4200126 0.4199879 0.4199631 0.4199382 [120] 0.4199132 0.4198881 0.4198629 0.4198376 0.4198123 0.4197868 0.4197613 [127] 0.4197357 0.4197099 0.4196841 0.4196582 0.4196322 0.4196061 0.4195799 [134] 0.4195537 0.4195273 0.4195008 0.4194743 0.4194476 0.4194209 0.4193941 [141] 0.4193672 0.4193402 0.4193131 0.4192859 0.4192586 0.4192313 0.4192038 [148] 0.4191763 0.4191487 0.4191209 0.4190931 0.4190652 0.4190372 0.4190092 [155] 0.4189810 0.4189527 0.4189244 0.4188959 0.4188674 0.4188388 0.4188101 [162] 0.4187813 0.4187524 0.4187235 0.4186944 0.4186653 0.4186360 0.4186067 [169] 0.4185773 0.4185478 0.4185182 0.4184885 0.4184588 0.4184289 0.4183990 [176] 0.4183689 0.4183388 0.4183086 0.4182783 0.4182480 0.4182175 0.4181869 [183] 0.4181563 0.4181256 0.4180948 0.4180639 0.4180329 0.4180018 0.4179707 [190] 0.4179394 0.4179081 0.4178767 0.4178452 0.4178136 0.4177819 0.4177501 [197] 0.4177183 0.4176864 0.4176543 0.4176222 0.4175901 0.4175578 0.4175254 [204] 0.4174930 0.4174604 0.4174278 0.4173951 0.4173623 0.4173295 0.4172965 [211] 0.4172635 0.4172304 0.4171972 0.4171639 0.4171305 0.4170970 0.4170635 [218] 0.4170299 0.4169962 0.4169624 0.4169285 0.4168945 0.4168605 0.4168264 [225] 0.4167921 0.4167579 0.4167235 0.4166890 0.4166545 0.4166198 0.4165851 [232] 0.4165503 0.4165155 0.4164805 0.4164455 0.4164104 0.4163752 0.4163399 [239] 0.4163045 0.4162691 0.4162335 0.4161979 0.4161622 0.4161265 0.4160906 [246] 0.4160547 0.4160187 0.4159826 0.4159464 0.4159101 0.4158738 0.4158374 [253] 0.4158009 0.4157643 0.4157276 0.4156909 0.4156540 0.4156171 0.4155802 [260] 0.4155431 0.4155060 0.4154687 0.4154314 0.4153941 0.4153566 0.4153191 [267] 0.4152814 0.4152437 0.4152060 0.4151681 0.4151302 0.4150922 0.4150541 [274] 0.4150159 0.4149776 0.4149393 0.4149009 0.4148624 0.4148239 0.4147852 [281] 0.4147465 0.4147077 0.4146688 0.4146299 0.4145909 0.4145518 0.4145126 [288] 0.4144733 0.4144340 0.4143946 0.4143551 0.4143155 0.4142759 0.4142362 [295] 0.4141964 0.4141565 0.4141166 0.4140765 0.4140364 0.4139963 0.4139560 [302] 0.4139157 0.4138753 0.4138348 0.4137943 0.4137536 0.4137129 0.4136721 [309] 0.4136313 0.4135904 0.4135494 0.4135083 0.4134671 0.4134259 0.4133846 [316] 0.4133432 0.4133018 0.4132603 0.4132187 0.4131770 0.4131353 0.4130934 [323] 0.4130515 0.4130096 0.4129675 0.4129254 0.4128833 0.4128410 0.4127987 [330] 0.4127563 0.4127138 0.4126712 0.4126286 0.4125859 0.4125432 0.4125003 [337] 0.4124574 0.4124144 0.4123714 0.4123283 0.4122851 0.4122418 0.4121985 [344] 0.4121551 0.4121116 0.4120680 0.4120244 0.4119807 0.4119369 0.4118931 [351] 0.4118492 0.4118052 0.4117612 0.4117171 0.4116729 0.4116286 0.4115843 [358] 0.4115399 0.4114954 0.4114509 0.4114063 0.4113616 0.4113169 0.4112721 [365] 0.4112272 0.4111822 0.4111372 0.4110921 0.4110470 0.4110017 0.4109565 [372] 0.4109111 0.4108657 0.4108202 0.4107746 0.4107290 0.4106833 0.4106375 [379] 0.4105917 0.4105458 0.4104998 0.4104537 0.4104076 0.4103615 0.4103152 [386] 0.4102689 0.4102226 0.4101761 0.4101296 0.4100830 0.4100364 0.4099897 [393] 0.4099429 0.4098961 0.4098492 0.4098022 0.4097552 0.4097081 0.4096609 [400] 0.4096137 0.4095664 > mx [1] 0.4222198 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1atb61227561016.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/2ag7q1227561016.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/33zv91227561016.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/4596s1227561016.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/506l61227561016.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/60arw1227561017.tab") > > system("convert tmp/1atb61227561016.ps tmp/1atb61227561016.png") > system("convert tmp/2ag7q1227561016.ps tmp/2ag7q1227561016.png") > system("convert tmp/33zv91227561016.ps tmp/33zv91227561016.png") > system("convert tmp/4596s1227561016.ps tmp/4596s1227561016.png") > system("convert tmp/506l61227561016.ps tmp/506l61227561016.png") > > > proc.time() user system elapsed 1.064 0.780 1.290