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(103.34,103.38,103.64,104.04,104.11,104.11,104.11,104.17,105.16,105.86,106.11,106.11,106.11,106.13,106.67,106.85,106.97,107.02,107.02,107.07,107.76,108.10,108.18,108.22,108.22,108.17,108.31,108.31,108.36,108.46,108.46,108.46,109.43,109.55,109.62,109.70,109.70,109.56,109.92,109.81,109.78,109.80,109.80,109.79,110.40,110.95,111.07,111.09,111.10,111.01,111.01,111.35,111.42,111.24,111.24,111.47,111.57,111.96,112.02,112.02) > #'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.9650684 0.9650851 0.9651017 0.9651183 0.9651349 0.9651515 0.9651681 [8] 0.9651847 0.9652012 0.9652178 0.9652343 0.9652509 0.9652674 0.9652839 [15] 0.9653004 0.9653169 0.9653334 0.9653499 0.9653663 0.9653828 0.9653992 [22] 0.9654156 0.9654321 0.9654485 0.9654649 0.9654813 0.9654976 0.9655140 [29] 0.9655304 0.9655467 0.9655630 0.9655794 0.9655957 0.9656120 0.9656283 [36] 0.9656445 0.9656608 0.9656771 0.9656933 0.9657096 0.9657258 0.9657420 [43] 0.9657582 0.9657744 0.9657906 0.9658068 0.9658230 0.9658391 0.9658553 [50] 0.9658714 0.9658875 0.9659036 0.9659197 0.9659358 0.9659519 0.9659680 [57] 0.9659840 0.9660001 0.9660161 0.9660322 0.9660482 0.9660642 0.9660802 [64] 0.9660962 0.9661121 0.9661281 0.9661441 0.9661600 0.9661759 0.9661919 [71] 0.9662078 0.9662237 0.9662396 0.9662555 0.9662713 0.9662872 0.9663030 [78] 0.9663189 0.9663347 0.9663505 0.9663663 0.9663821 0.9663979 0.9664137 [85] 0.9664294 0.9664452 0.9664609 0.9664767 0.9664924 0.9665081 0.9665238 [92] 0.9665395 0.9665552 0.9665709 0.9665865 0.9666022 0.9666178 0.9666334 [99] 0.9666491 0.9666647 0.9666803 0.9666958 0.9667114 0.9667270 0.9667425 [106] 0.9667581 0.9667736 0.9667891 0.9668046 0.9668201 0.9668356 0.9668511 [113] 0.9668666 0.9668820 0.9668975 0.9669129 0.9669283 0.9669438 0.9669592 [120] 0.9669746 0.9669899 0.9670053 0.9670207 0.9670360 0.9670514 0.9670667 [127] 0.9670820 0.9670973 0.9671126 0.9671279 0.9671432 0.9671585 0.9671737 [134] 0.9671890 0.9672042 0.9672194 0.9672346 0.9672498 0.9672650 0.9672802 [141] 0.9672954 0.9673106 0.9673257 0.9673408 0.9673560 0.9673711 0.9673862 [148] 0.9674013 0.9674164 0.9674315 0.9674465 0.9674616 0.9674766 0.9674917 [155] 0.9675067 0.9675217 0.9675367 0.9675517 0.9675667 0.9675816 0.9675966 [162] 0.9676115 0.9676265 0.9676414 0.9676563 0.9676712 0.9676861 0.9677010 [169] 0.9677159 0.9677307 0.9677456 0.9677604 0.9677753 0.9677901 0.9678049 [176] 0.9678197 0.9678345 0.9678493 0.9678640 0.9678788 0.9678935 0.9679083 [183] 0.9679230 0.9679377 0.9679524 0.9679671 0.9679818 0.9679965 0.9680111 [190] 0.9680258 0.9680404 0.9680550 0.9680697 0.9680843 0.9680989 0.9681134 [197] 0.9681280 0.9681426 0.9681571 0.9681717 0.9681862 0.9682007 0.9682152 [204] 0.9682297 0.9682442 0.9682587 0.9682732 0.9682876 0.9683021 0.9683165 [211] 0.9683310 0.9683454 0.9683598 0.9683742 0.9683886 0.9684029 0.9684173 [218] 0.9684316 0.9684460 0.9684603 0.9684746 0.9684889 0.9685032 0.9685175 [225] 0.9685318 0.9685461 0.9685603 0.9685746 0.9685888 0.9686030 0.9686172 [232] 0.9686314 0.9686456 0.9686598 0.9686740 0.9686881 0.9687023 0.9687164 [239] 0.9687305 0.9687447 0.9687588 0.9687729 0.9687869 0.9688010 0.9688151 [246] 0.9688291 0.9688432 0.9688572 0.9688712 0.9688852 0.9688992 0.9689132 [253] 0.9689272 0.9689412 0.9689551 0.9689691 0.9689830 0.9689969 0.9690108 [260] 0.9690247 0.9690386 0.9690525 0.9690664 0.9690802 0.9690941 0.9691079 [267] 0.9691217 0.9691356 0.9691494 0.9691632 0.9691769 0.9691907 0.9692045 [274] 0.9692182 0.9692320 0.9692457 0.9692594 0.9692731 0.9692868 0.9693005 [281] 0.9693142 0.9693279 0.9693415 0.9693552 0.9693688 0.9693824 0.9693960 [288] 0.9694096 0.9694232 0.9694368 0.9694504 0.9694639 0.9694775 0.9694910 [295] 0.9695046 0.9695181 0.9695316 0.9695451 0.9695586 0.9695720 0.9695855 [302] 0.9695989 0.9696124 0.9696258 0.9696392 0.9696526 0.9696660 0.9696794 [309] 0.9696928 0.9697062 0.9697195 0.9697329 0.9697462 0.9697595 0.9697728 [316] 0.9697861 0.9697994 0.9698127 0.9698260 0.9698392 0.9698525 0.9698657 [323] 0.9698790 0.9698922 0.9699054 0.9699186 0.9699317 0.9699449 0.9699581 [330] 0.9699712 0.9699844 0.9699975 0.9700106 0.9700237 0.9700368 0.9700499 [337] 0.9700630 0.9700761 0.9700891 0.9701022 0.9701152 0.9701282 0.9701412 [344] 0.9701542 0.9701672 0.9701802 0.9701932 0.9702061 0.9702191 0.9702320 [351] 0.9702449 0.9702578 0.9702707 0.9702836 0.9702965 0.9703094 0.9703223 [358] 0.9703351 0.9703479 0.9703608 0.9703736 0.9703864 0.9703992 0.9704120 [365] 0.9704248 0.9704375 0.9704503 0.9704630 0.9704758 0.9704885 0.9705012 [372] 0.9705139 0.9705266 0.9705392 0.9705519 0.9705646 0.9705772 0.9705899 [379] 0.9706025 0.9706151 0.9706277 0.9706403 0.9706529 0.9706654 0.9706780 [386] 0.9706905 0.9707031 0.9707156 0.9707281 0.9707406 0.9707531 0.9707656 [393] 0.9707781 0.9707906 0.9708030 0.9708154 0.9708279 0.9708403 0.9708527 [400] 0.9708651 0.9708775 > mx [1] 0.9708775 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1eq861257376666.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/2ixc51257376666.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/3ciwi1257376666.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/4ul3l1257376666.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/5j3sh1257376666.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/6v62p1257376666.tab") > > system("convert tmp/1eq861257376666.ps tmp/1eq861257376666.png") > system("convert tmp/2ixc51257376666.ps tmp/2ixc51257376666.png") > system("convert tmp/3ciwi1257376666.ps tmp/3ciwi1257376666.png") > system("convert tmp/4ul3l1257376666.ps tmp/4ul3l1257376666.png") > system("convert tmp/5j3sh1257376666.ps tmp/5j3sh1257376666.png") > > > proc.time() user system elapsed 1.065 0.760 1.445