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(107.06,109.98,112.64,112.89,112.9,112.9,112.9,112.99,113.01,113,113.07,113.07,113.21,114.13,114.59,114.88,115.3,115.33,115.36,115.41,115.43,115.43,115.43,115.43,115.56,115.88,116.02,116.09,116.28,116.28,116.28,116.25,116.07,116.08,116.07,115.92,116.07,117.22,117.75,117.78,117.78,117.81,117.81,117.74,117.75,117.76,117.76,117.75,117.8,118.09,118.95,119.03,118.9,118.9,118.9,118.87,118.88,119.36,119.39,119.47) > #'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.9438654 0.9439097 0.9439540 0.9439983 0.9440425 0.9440867 0.9441308 [8] 0.9441749 0.9442190 0.9442630 0.9443070 0.9443510 0.9443949 0.9444388 [15] 0.9444826 0.9445264 0.9445702 0.9446140 0.9446577 0.9447013 0.9447450 [22] 0.9447886 0.9448321 0.9448756 0.9449191 0.9449626 0.9450060 0.9450494 [29] 0.9450927 0.9451360 0.9451793 0.9452226 0.9452658 0.9453089 0.9453521 [36] 0.9453951 0.9454382 0.9454812 0.9455242 0.9455672 0.9456101 0.9456530 [43] 0.9456958 0.9457386 0.9457814 0.9458241 0.9458668 0.9459095 0.9459521 [50] 0.9459947 0.9460372 0.9460798 0.9461223 0.9461647 0.9462071 0.9462495 [57] 0.9462918 0.9463341 0.9463764 0.9464186 0.9464608 0.9465030 0.9465451 [64] 0.9465872 0.9466293 0.9466713 0.9467133 0.9467552 0.9467972 0.9468390 [71] 0.9468809 0.9469227 0.9469645 0.9470062 0.9470479 0.9470896 0.9471312 [78] 0.9471728 0.9472143 0.9472559 0.9472974 0.9473388 0.9473802 0.9474216 [85] 0.9474629 0.9475043 0.9475455 0.9475868 0.9476280 0.9476692 0.9477103 [92] 0.9477514 0.9477924 0.9478335 0.9478745 0.9479154 0.9479564 0.9479972 [99] 0.9480381 0.9480789 0.9481197 0.9481604 0.9482011 0.9482418 0.9482825 [106] 0.9483231 0.9483636 0.9484042 0.9484447 0.9484851 0.9485256 0.9485660 [113] 0.9486063 0.9486467 0.9486869 0.9487272 0.9487674 0.9488076 0.9488478 [120] 0.9488879 0.9489279 0.9489680 0.9490080 0.9490480 0.9490879 0.9491278 [127] 0.9491677 0.9492075 0.9492473 0.9492871 0.9493268 0.9493665 0.9494062 [134] 0.9494458 0.9494854 0.9495250 0.9495645 0.9496040 0.9496434 0.9496828 [141] 0.9497222 0.9497616 0.9498009 0.9498402 0.9498794 0.9499186 0.9499578 [148] 0.9499969 0.9500360 0.9500751 0.9501141 0.9501531 0.9501921 0.9502310 [155] 0.9502699 0.9503088 0.9503476 0.9503864 0.9504252 0.9504639 0.9505026 [162] 0.9505413 0.9505799 0.9506185 0.9506570 0.9506955 0.9507340 0.9507725 [169] 0.9508109 0.9508493 0.9508876 0.9509259 0.9509642 0.9510024 0.9510406 [176] 0.9510788 0.9511170 0.9511551 0.9511931 0.9512312 0.9512692 0.9513071 [183] 0.9513451 0.9513830 0.9514208 0.9514587 0.9514965 0.9515342 0.9515720 [190] 0.9516097 0.9516473 0.9516849 0.9517225 0.9517601 0.9517976 0.9518351 [197] 0.9518726 0.9519100 0.9519474 0.9519847 0.9520221 0.9520593 0.9520966 [204] 0.9521338 0.9521710 0.9522081 0.9522453 0.9522823 0.9523194 0.9523564 [211] 0.9523934 0.9524303 0.9524672 0.9525041 0.9525410 0.9525778 0.9526146 [218] 0.9526513 0.9526880 0.9527247 0.9527613 0.9527979 0.9528345 0.9528710 [225] 0.9529076 0.9529440 0.9529805 0.9530169 0.9530532 0.9530896 0.9531259 [232] 0.9531622 0.9531984 0.9532346 0.9532708 0.9533069 0.9533430 0.9533791 [239] 0.9534151 0.9534511 0.9534871 0.9535230 0.9535589 0.9535948 0.9536306 [246] 0.9536664 0.9537022 0.9537379 0.9537736 0.9538093 0.9538449 0.9538805 [253] 0.9539161 0.9539516 0.9539871 0.9540226 0.9540580 0.9540934 0.9541288 [260] 0.9541641 0.9541995 0.9542347 0.9542700 0.9543052 0.9543403 0.9543755 [267] 0.9544106 0.9544456 0.9544807 0.9545157 0.9545506 0.9545856 0.9546205 [274] 0.9546553 0.9546902 0.9547250 0.9547598 0.9547945 0.9548292 0.9548639 [281] 0.9548985 0.9549331 0.9549677 0.9550022 0.9550367 0.9550712 0.9551056 [288] 0.9551400 0.9551744 0.9552088 0.9552431 0.9552774 0.9553116 0.9553458 [295] 0.9553800 0.9554141 0.9554482 0.9554823 0.9555164 0.9555504 0.9555844 [302] 0.9556183 0.9556522 0.9556861 0.9557199 0.9557538 0.9557876 0.9558213 [309] 0.9558550 0.9558887 0.9559224 0.9559560 0.9559896 0.9560231 0.9560566 [316] 0.9560901 0.9561236 0.9561570 0.9561904 0.9562238 0.9562571 0.9562904 [323] 0.9563237 0.9563569 0.9563901 0.9564233 0.9564564 0.9564895 0.9565226 [330] 0.9565556 0.9565886 0.9566216 0.9566545 0.9566874 0.9567203 0.9567531 [337] 0.9567859 0.9568187 0.9568515 0.9568842 0.9569169 0.9569495 0.9569821 [344] 0.9570147 0.9570473 0.9570798 0.9571123 0.9571447 0.9571771 0.9572095 [351] 0.9572419 0.9572742 0.9573065 0.9573388 0.9573710 0.9574032 0.9574354 [358] 0.9574675 0.9574996 0.9575317 0.9575637 0.9575957 0.9576277 0.9576596 [365] 0.9576915 0.9577234 0.9577553 0.9577871 0.9578189 0.9578506 0.9578823 [372] 0.9579140 0.9579457 0.9579773 0.9580089 0.9580404 0.9580720 0.9581035 [379] 0.9581349 0.9581664 0.9581978 0.9582291 0.9582605 0.9582918 0.9583231 [386] 0.9583543 0.9583855 0.9584167 0.9584478 0.9584790 0.9585100 0.9585411 [393] 0.9585721 0.9586031 0.9586341 0.9586650 0.9586959 0.9587267 0.9587576 [400] 0.9587884 0.9588191 > mx [1] 0.9588191 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ci1h1227106437.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/2ozuu1227106437.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/3tjz11227106437.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/4z9aq1227106437.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/5vpum1227106437.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/63hpg1227106437.tab") > > system("convert tmp/1ci1h1227106437.ps tmp/1ci1h1227106437.png") > system("convert tmp/2ozuu1227106437.ps tmp/2ozuu1227106437.png") > system("convert tmp/3tjz11227106437.ps tmp/3tjz11227106437.png") > system("convert tmp/4z9aq1227106437.ps tmp/4z9aq1227106437.png") > system("convert tmp/5vpum1227106437.ps tmp/5vpum1227106437.png") > > > proc.time() user system elapsed 1.086 0.780 1.333