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(1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718,1.4748,1.5527,1.575,1.5557,1.5553,1.577) > #'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.8624361 0.8624403 0.8624442 0.8624480 0.8624516 0.8624550 0.8624582 [8] 0.8624612 0.8624640 0.8624666 0.8624691 0.8624713 0.8624733 0.8624751 [15] 0.8624768 0.8624782 0.8624794 0.8624805 0.8624813 0.8624820 0.8624824 [22] 0.8624827 0.8624828 0.8624826 0.8624823 0.8624818 0.8624810 0.8624801 [29] 0.8624790 0.8624777 0.8624762 0.8624745 0.8624726 0.8624705 0.8624682 [36] 0.8624657 0.8624630 0.8624602 0.8624571 0.8624538 0.8624503 0.8624467 [43] 0.8624428 0.8624387 0.8624345 0.8624300 0.8624254 0.8624206 0.8624155 [50] 0.8624103 0.8624048 0.8623992 0.8623934 0.8623874 0.8623811 0.8623747 [57] 0.8623681 0.8623613 0.8623543 0.8623471 0.8623397 0.8623321 0.8623243 [64] 0.8623164 0.8623082 0.8622998 0.8622912 0.8622825 0.8622735 0.8622643 [71] 0.8622550 0.8622454 0.8622357 0.8622257 0.8622156 0.8622053 0.8621947 [78] 0.8621840 0.8621731 0.8621619 0.8621506 0.8621391 0.8621274 0.8621155 [85] 0.8621034 0.8620911 0.8620786 0.8620659 0.8620530 0.8620400 0.8620267 [92] 0.8620132 0.8619996 0.8619857 0.8619716 0.8619574 0.8619429 0.8619283 [99] 0.8619135 0.8618984 0.8618832 0.8618678 0.8618522 0.8618363 0.8618203 [106] 0.8618041 0.8617877 0.8617711 0.8617544 0.8617374 0.8617202 0.8617028 [113] 0.8616852 0.8616675 0.8616495 0.8616314 0.8616130 0.8615945 0.8615757 [120] 0.8615568 0.8615377 0.8615184 0.8614989 0.8614791 0.8614592 0.8614391 [127] 0.8614189 0.8613984 0.8613777 0.8613568 0.8613357 0.8613145 0.8612930 [134] 0.8612714 0.8612495 0.8612275 0.8612053 0.8611829 0.8611602 0.8611374 [141] 0.8611144 0.8610912 0.8610678 0.8610443 0.8610205 0.8609965 0.8609723 [148] 0.8609480 0.8609234 0.8608987 0.8608738 0.8608486 0.8608233 0.8607978 [155] 0.8607721 0.8607462 0.8607201 0.8606939 0.8606674 0.8606407 0.8606139 [162] 0.8605868 0.8605596 0.8605321 0.8605045 0.8604767 0.8604487 0.8604205 [169] 0.8603921 0.8603635 0.8603348 0.8603058 0.8602766 0.8602473 0.8602178 [176] 0.8601880 0.8601581 0.8601280 0.8600977 0.8600672 0.8600365 0.8600057 [183] 0.8599746 0.8599434 0.8599119 0.8598803 0.8598485 0.8598165 0.8597843 [190] 0.8597519 0.8597193 0.8596865 0.8596536 0.8596204 0.8595871 0.8595535 [197] 0.8595198 0.8594859 0.8594518 0.8594176 0.8593831 0.8593484 0.8593136 [204] 0.8592786 0.8592433 0.8592079 0.8591723 0.8591365 0.8591006 0.8590644 [211] 0.8590281 0.8589915 0.8589548 0.8589179 0.8588808 0.8588435 0.8588060 [218] 0.8587684 0.8587305 0.8586925 0.8586543 0.8586159 0.8585773 0.8585385 [225] 0.8584995 0.8584604 0.8584211 0.8583815 0.8583418 0.8583019 0.8582619 [232] 0.8582216 0.8581811 0.8581405 0.8580997 0.8580587 0.8580175 0.8579761 [239] 0.8579346 0.8578928 0.8578509 0.8578088 0.8577665 0.8577240 0.8576814 [246] 0.8576385 0.8575955 0.8575523 0.8575089 0.8574653 0.8574216 0.8573776 [253] 0.8573335 0.8572892 0.8572447 0.8572000 0.8571552 0.8571102 0.8570649 [260] 0.8570195 0.8569740 0.8569282 0.8568823 0.8568361 0.8567898 0.8567433 [267] 0.8566967 0.8566498 0.8566028 0.8565556 0.8565082 0.8564606 0.8564129 [274] 0.8563649 0.8563168 0.8562685 0.8562201 0.8561714 0.8561226 0.8560736 [281] 0.8560244 0.8559750 0.8559255 0.8558758 0.8558259 0.8557758 0.8557256 [288] 0.8556751 0.8556245 0.8555737 0.8555228 0.8554716 0.8554203 0.8553688 [295] 0.8553171 0.8552653 0.8552133 0.8551611 0.8551087 0.8550561 0.8550034 [302] 0.8549505 0.8548974 0.8548442 0.8547907 0.8547371 0.8546833 0.8546294 [309] 0.8545752 0.8545209 0.8544665 0.8544118 0.8543570 0.8543020 0.8542468 [316] 0.8541914 0.8541359 0.8540802 0.8540244 0.8539683 0.8539121 0.8538557 [323] 0.8537992 0.8537424 0.8536855 0.8536285 0.8535712 0.8535138 0.8534562 [330] 0.8533984 0.8533405 0.8532824 0.8532241 0.8531657 0.8531071 0.8530483 [337] 0.8529893 0.8529302 0.8528709 0.8528115 0.8527518 0.8526920 0.8526321 [344] 0.8525719 0.8525116 0.8524511 0.8523905 0.8523297 0.8522687 0.8522075 [351] 0.8521462 0.8520848 0.8520231 0.8519613 0.8518993 0.8518372 0.8517748 [358] 0.8517124 0.8516497 0.8515869 0.8515239 0.8514608 0.8513975 0.8513340 [365] 0.8512703 0.8512065 0.8511426 0.8510784 0.8510141 0.8509497 0.8508850 [372] 0.8508203 0.8507553 0.8506902 0.8506249 0.8505595 0.8504939 0.8504281 [379] 0.8503622 0.8502961 0.8502298 0.8501634 0.8500968 0.8500301 0.8499632 [386] 0.8498961 0.8498289 0.8497615 0.8496940 0.8496263 0.8495584 0.8494904 [393] 0.8494222 0.8493539 0.8492854 0.8492167 0.8491479 0.8490789 0.8490098 [400] 0.8489405 0.8488710 > mx [1] 0.8624828 > mxli [1] -1.78 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1x9t21227446146.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/22uit1227446146.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/3k7ny1227446146.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/4b6m51227446146.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/587301227446146.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/6yje91227446146.tab") > > system("convert tmp/1x9t21227446146.ps tmp/1x9t21227446146.png") > system("convert tmp/22uit1227446146.ps tmp/22uit1227446146.png") > system("convert tmp/3k7ny1227446146.ps tmp/3k7ny1227446146.png") > system("convert tmp/4b6m51227446146.ps tmp/4b6m51227446146.png") > system("convert tmp/587301227446146.ps tmp/587301227446146.png") > > > proc.time() user system elapsed 1.074 0.769 1.272