R version 2.7.0 (2008-04-22) 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(98,97,96,96,96,96,96,96,96,97,97,98,99,101,102,103,104,105,106,107,106,105,105,105,105,105,105,105,105,106,106,106,105,105,107,108,110,111,111,112,112,112,112,113,115,117,118,118,118,118,118,118,119,121,121,122,123,123,124,124) > #'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.9551761 0.9552009 0.9552255 0.9552501 0.9552745 0.9552988 0.9553229 [8] 0.9553470 0.9553709 0.9553947 0.9554183 0.9554419 0.9554653 0.9554886 [15] 0.9555118 0.9555348 0.9555577 0.9555805 0.9556032 0.9556258 0.9556482 [22] 0.9556705 0.9556926 0.9557147 0.9557366 0.9557584 0.9557801 0.9558016 [29] 0.9558231 0.9558444 0.9558655 0.9558866 0.9559075 0.9559283 0.9559490 [36] 0.9559695 0.9559900 0.9560103 0.9560304 0.9560505 0.9560704 0.9560902 [43] 0.9561099 0.9561294 0.9561489 0.9561682 0.9561873 0.9562064 0.9562253 [50] 0.9562441 0.9562628 0.9562813 0.9562997 0.9563180 0.9563362 0.9563542 [57] 0.9563722 0.9563900 0.9564076 0.9564252 0.9564426 0.9564599 0.9564770 [64] 0.9564941 0.9565110 0.9565278 0.9565444 0.9565610 0.9565774 0.9565937 [71] 0.9566098 0.9566258 0.9566418 0.9566575 0.9566732 0.9566887 0.9567041 [78] 0.9567194 0.9567345 0.9567496 0.9567645 0.9567792 0.9567939 0.9568084 [85] 0.9568228 0.9568371 0.9568512 0.9568652 0.9568791 0.9568929 0.9569065 [92] 0.9569200 0.9569334 0.9569467 0.9569598 0.9569728 0.9569857 0.9569984 [99] 0.9570111 0.9570236 0.9570359 0.9570482 0.9570603 0.9570723 0.9570842 [106] 0.9570959 0.9571075 0.9571190 0.9571304 0.9571416 0.9571527 0.9571637 [113] 0.9571746 0.9571853 0.9571959 0.9572064 0.9572168 0.9572270 0.9572371 [120] 0.9572471 0.9572569 0.9572667 0.9572762 0.9572857 0.9572951 0.9573043 [127] 0.9573134 0.9573223 0.9573312 0.9573399 0.9573485 0.9573569 0.9573653 [134] 0.9573735 0.9573816 0.9573895 0.9573973 0.9574050 0.9574126 0.9574201 [141] 0.9574274 0.9574346 0.9574417 0.9574486 0.9574554 0.9574621 0.9574687 [148] 0.9574751 0.9574814 0.9574876 0.9574937 0.9574996 0.9575054 0.9575111 [155] 0.9575167 0.9575221 0.9575274 0.9575326 0.9575376 0.9575426 0.9575474 [162] 0.9575520 0.9575566 0.9575610 0.9575653 0.9575695 0.9575735 0.9575774 [169] 0.9575812 0.9575849 0.9575884 0.9575919 0.9575951 0.9575983 0.9576013 [176] 0.9576043 0.9576070 0.9576097 0.9576122 0.9576146 0.9576169 0.9576191 [183] 0.9576211 0.9576230 0.9576248 0.9576264 0.9576280 0.9576294 0.9576306 [190] 0.9576318 0.9576328 0.9576337 0.9576345 0.9576351 0.9576357 0.9576361 [197] 0.9576363 0.9576365 0.9576365 0.9576364 0.9576362 0.9576358 0.9576353 [204] 0.9576347 0.9576340 0.9576331 0.9576322 0.9576311 0.9576298 0.9576285 [211] 0.9576270 0.9576254 0.9576237 0.9576218 0.9576198 0.9576177 0.9576155 [218] 0.9576131 0.9576106 0.9576080 0.9576053 0.9576024 0.9575995 0.9575964 [225] 0.9575931 0.9575898 0.9575863 0.9575827 0.9575790 0.9575751 0.9575711 [232] 0.9575670 0.9575628 0.9575585 0.9575540 0.9575494 0.9575447 0.9575398 [239] 0.9575349 0.9575298 0.9575245 0.9575192 0.9575137 0.9575081 0.9575024 [246] 0.9574966 0.9574906 0.9574845 0.9574783 0.9574720 0.9574655 0.9574589 [253] 0.9574522 0.9574454 0.9574385 0.9574314 0.9574242 0.9574169 0.9574094 [260] 0.9574018 0.9573942 0.9573863 0.9573784 0.9573703 0.9573621 0.9573538 [267] 0.9573454 0.9573369 0.9573282 0.9573194 0.9573104 0.9573014 0.9572922 [274] 0.9572829 0.9572735 0.9572640 0.9572543 0.9572445 0.9572346 0.9572246 [281] 0.9572145 0.9572042 0.9571938 0.9571833 0.9571726 0.9571619 0.9571510 [288] 0.9571400 0.9571289 0.9571176 0.9571062 0.9570948 0.9570831 0.9570714 [295] 0.9570595 0.9570476 0.9570355 0.9570232 0.9570109 0.9569984 0.9569858 [302] 0.9569731 0.9569603 0.9569474 0.9569343 0.9569211 0.9569078 0.9568943 [309] 0.9568808 0.9568671 0.9568533 0.9568394 0.9568254 0.9568112 0.9567969 [316] 0.9567825 0.9567680 0.9567534 0.9567386 0.9567237 0.9567087 0.9566936 [323] 0.9566784 0.9566630 0.9566475 0.9566319 0.9566162 0.9566003 0.9565844 [330] 0.9565683 0.9565521 0.9565358 0.9565193 0.9565028 0.9564861 0.9564693 [337] 0.9564524 0.9564354 0.9564182 0.9564009 0.9563835 0.9563660 0.9563484 [344] 0.9563306 0.9563128 0.9562948 0.9562767 0.9562585 0.9562401 0.9562217 [351] 0.9562031 0.9561844 0.9561656 0.9561466 0.9561276 0.9561084 0.9560891 [358] 0.9560697 0.9560502 0.9560306 0.9560108 0.9559909 0.9559709 0.9559508 [365] 0.9559306 0.9559102 0.9558898 0.9558692 0.9558485 0.9558277 0.9558068 [372] 0.9557857 0.9557646 0.9557433 0.9557219 0.9557004 0.9556787 0.9556570 [379] 0.9556351 0.9556131 0.9555911 0.9555688 0.9555465 0.9555241 0.9555015 [386] 0.9554788 0.9554561 0.9554331 0.9554101 0.9553870 0.9553637 0.9553404 [393] 0.9553169 0.9552933 0.9552696 0.9552458 0.9552218 0.9551978 0.9551736 [400] 0.9551493 0.9551249 > mx [1] 0.9576365 > mxli [1] -0.02 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/15ojd1226320138.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/2aq8f1226320138.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/39y821226320138.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/44k491226320138.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/5crdt1226320138.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/6729t1226320138.tab") > > system("convert tmp/15ojd1226320138.ps tmp/15ojd1226320138.png") > system("convert tmp/2aq8f1226320138.ps tmp/2aq8f1226320138.png") > system("convert tmp/39y821226320138.ps tmp/39y821226320138.png") > system("convert tmp/44k491226320138.ps tmp/44k491226320138.png") > system("convert tmp/5crdt1226320138.ps tmp/5crdt1226320138.png") > > > proc.time() user system elapsed 2.371 1.303 2.571