R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(1.9,3,6,6.2,6.7,7,7.1,7.9,8,8,8.2,8.4,8.5,8.5,8.6,8.8,8.8,8.9,9,9,9,9.2,9.3,9.3,9.4,9.4,9.5,9.6,9.8,9.8,9.9,10,10,10.1,10.1,10.1,10.2,10.2,10.3,10.3,10.4,10.5,10.5,10.5,10.5,10.6,10.6,10.6,10.7,10.8,10.8,10.8,10.9,11,11.1,11.1,11.1,11.1,11.3,11.3,11.3,11.4,11.4,11.5,11.7,11.8,11.8,11.8,11.9,12,12,12,12.1,12.2,12.2,12.3,12.3,12.4,12.6,12.7,12.7,12.7,12.8,12.8,13,13.1,13.1,13.2,13.3,13.3,13.3,13.4,13.4,13.6,13.6,13.7,13.7,13.7,13.8,13.8,14.2,14.3,14.5,14.5,14.5,14.6,14.7,14.7,14.8,14.8,14.9,15.1,15.2,15.2,15.4,15.7,15.8,15.8,15.9,16,16,16.2,16.3,16.4,16.4,16.4,16.4,16.7,16.8,17.2,17.3,17.3,17.6,17.6,17.6,18,18.5,18.5,18.6,18.7,18.8,18.8,19,19.5,19.6,19.8,19.9,20.7,20.8,21,21,21.1,21.2,21.8,21.9,21.9,21.9,22.2,22.6,22.8,23.2,23.5,23.5,23.5,23.7,24.3,24.8,24.9,24.9,26.1,26.2,26.8) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.4358184 0.4380324 0.4402666 0.4425211 0.4447958 0.4470909 0.4494064 [8] 0.4517423 0.4540987 0.4564756 0.4588731 0.4612912 0.4637299 0.4661892 [15] 0.4686691 0.4711696 0.4736909 0.4762327 0.4787952 0.4813782 0.4839819 [22] 0.4866061 0.4892508 0.4919160 0.4946016 0.4973076 0.5000339 0.5027804 [29] 0.5055470 0.5083337 0.5111404 0.5139670 0.5168133 0.5196792 0.5225647 [36] 0.5254695 0.5283936 0.5313367 0.5342987 0.5372795 0.5402789 0.5432966 [43] 0.5463325 0.5493864 0.5524580 0.5555472 0.5586536 0.5617770 0.5649173 [50] 0.5680740 0.5712470 0.5744360 0.5776406 0.5808605 0.5840955 0.5873452 [57] 0.5906092 0.5938872 0.5971789 0.6004839 0.6038018 0.6071322 0.6104747 [64] 0.6138290 0.6171945 0.6205708 0.6239576 0.6273544 0.6307606 0.6341760 [71] 0.6375998 0.6410318 0.6444713 0.6479179 0.6513711 0.6548303 0.6582951 [78] 0.6617648 0.6652389 0.6687169 0.6721983 0.6756824 0.6791687 0.6826565 [85] 0.6861454 0.6896347 0.6931239 0.6966122 0.7000992 0.7035842 0.7070666 [92] 0.7105458 0.7140211 0.7174920 0.7209578 0.7244179 0.7278716 0.7313184 [99] 0.7347576 0.7381886 0.7416107 0.7450233 0.7484259 0.7518177 0.7551982 [106] 0.7585667 0.7619226 0.7652654 0.7685944 0.7719090 0.7752086 0.7784926 [113] 0.7817604 0.7850116 0.7882454 0.7914613 0.7946589 0.7978374 0.8009965 [120] 0.8041355 0.8072540 0.8103514 0.8134273 0.8164811 0.8195124 0.8225207 [127] 0.8255055 0.8284665 0.8314032 0.8343151 0.8372019 0.8400632 0.8428986 [134] 0.8457077 0.8484901 0.8512457 0.8539739 0.8566745 0.8593473 0.8619919 [141] 0.8646080 0.8671954 0.8697539 0.8722833 0.8747832 0.8772536 0.8796943 [148] 0.8821050 0.8844856 0.8868360 0.8891561 0.8914457 0.8937048 0.8959332 [155] 0.8981310 0.9002979 0.9024340 0.9045393 0.9066137 0.9086573 0.9106699 [162] 0.9126517 0.9146027 0.9165229 0.9184124 0.9202712 0.9220994 0.9238971 [169] 0.9256643 0.9274013 0.9291081 0.9307847 0.9324315 0.9340484 0.9356357 [176] 0.9371936 0.9387220 0.9402214 0.9416918 0.9431334 0.9445464 0.9459310 [183] 0.9472875 0.9486160 0.9499167 0.9511900 0.9524360 0.9536549 0.9548470 [190] 0.9560126 0.9571519 0.9582650 0.9593524 0.9604143 0.9614508 0.9624623 [197] 0.9634491 0.9644113 0.9653494 0.9662635 0.9671539 0.9680209 0.9688648 [204] 0.9696859 0.9704844 0.9712606 0.9720148 0.9727472 0.9734582 0.9741481 [211] 0.9748170 0.9754653 0.9760933 0.9767012 0.9772893 0.9778579 0.9784073 [218] 0.9789377 0.9794494 0.9799427 0.9804178 0.9808751 0.9813147 0.9817369 [225] 0.9821420 0.9825303 0.9829021 0.9832574 0.9835967 0.9839202 0.9842281 [232] 0.9845206 0.9847981 0.9850607 0.9853087 0.9855423 0.9857618 0.9859673 [239] 0.9861592 0.9863376 0.9865027 0.9866549 0.9867942 0.9869210 0.9870353 [246] 0.9871375 0.9872278 0.9873063 0.9873732 0.9874288 0.9874732 0.9875066 [253] 0.9875292 0.9875413 0.9875429 0.9875343 0.9875157 0.9874872 0.9874490 [260] 0.9874012 0.9873441 0.9872778 0.9872025 0.9871183 0.9870253 0.9869239 [267] 0.9868140 0.9866958 0.9865696 0.9864353 0.9862933 0.9861436 0.9859863 [274] 0.9858217 0.9856497 0.9854707 0.9852846 0.9850916 0.9848919 0.9846855 [281] 0.9844727 0.9842534 0.9840279 0.9837962 0.9835584 0.9833147 0.9830652 [288] 0.9828099 0.9825490 0.9822826 0.9820108 0.9817336 0.9814513 0.9811638 [295] 0.9808713 0.9805738 0.9802715 0.9799644 0.9796527 0.9793363 0.9790155 [302] 0.9786902 0.9783606 0.9780268 0.9776887 0.9773466 0.9770004 0.9766502 [309] 0.9762962 0.9759384 0.9755768 0.9752115 0.9748427 0.9744703 0.9740944 [316] 0.9737151 0.9733324 0.9729465 0.9725574 0.9721650 0.9717696 0.9713711 [323] 0.9709696 0.9705651 0.9701578 0.9697477 0.9693347 0.9689190 0.9685006 [330] 0.9680796 0.9676561 0.9672299 0.9668013 0.9663702 0.9659368 0.9655009 [337] 0.9650628 0.9646224 0.9641797 0.9637349 0.9632879 0.9628388 0.9623877 [344] 0.9619345 0.9614793 0.9610221 0.9605631 0.9601021 0.9596393 0.9591747 [351] 0.9587083 0.9582401 0.9577702 0.9572986 0.9568254 0.9563506 0.9558741 [358] 0.9553961 0.9549166 0.9544355 0.9539530 0.9534690 0.9529836 0.9524968 [365] 0.9520086 0.9515191 0.9510283 0.9505362 0.9500428 0.9495482 0.9490523 [372] 0.9485553 0.9480570 0.9475577 0.9470572 0.9465556 0.9460529 0.9455491 [379] 0.9450443 0.9445385 0.9440317 0.9435239 0.9430151 0.9425054 0.9419948 [386] 0.9414833 0.9409709 0.9404576 0.9399435 0.9394285 0.9389127 0.9383962 [393] 0.9378788 0.9373607 0.9368418 0.9363223 0.9358019 0.9352809 0.9347593 [400] 0.9342369 0.9337139 > mx [1] 0.987543 > mxli [1] 0.54 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1rcp81203799952.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/freestat/rcomp/tmp/2oxny1203799952.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/freestat/rcomp/tmp/3d6bd1203799952.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/freestat/rcomp/tmp/4wtck1203799952.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/55wy01203799952.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > load(file='/var/www/html/freestat/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/freestat/rcomp/tmp/6ep8k1203799952.tab") > > system("convert tmp/1rcp81203799952.ps tmp/1rcp81203799952.png") > system("convert tmp/2oxny1203799952.ps tmp/2oxny1203799952.png") > system("convert tmp/3d6bd1203799952.ps tmp/3d6bd1203799952.png") > system("convert tmp/4wtck1203799952.ps tmp/4wtck1203799952.png") > system("convert tmp/55wy01203799952.ps tmp/55wy01203799952.png") > > > proc.time() user system elapsed 1.900 1.189 2.035