R version 2.7.2 (2008-08-25) 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(0.9059,0.8883,0.8924,0.8833,0.8700,0.8758,0.8858,0.9170,0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,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.2490,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.2020,1.2271,1.2770,1.2650,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) > #'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.8693145 0.8694874 0.8696600 0.8698325 0.8700048 0.8701770 0.8703489 [8] 0.8705207 0.8706923 0.8708638 0.8710351 0.8712061 0.8713771 0.8715478 [15] 0.8717183 0.8718887 0.8720589 0.8722289 0.8723987 0.8725684 0.8727378 [22] 0.8729071 0.8730762 0.8732451 0.8734138 0.8735824 0.8737507 0.8739189 [29] 0.8740868 0.8742546 0.8744222 0.8745896 0.8747568 0.8749238 0.8750906 [36] 0.8752573 0.8754237 0.8755899 0.8757560 0.8759218 0.8760874 0.8762529 [43] 0.8764181 0.8765832 0.8767480 0.8769127 0.8770771 0.8772413 0.8774054 [50] 0.8775692 0.8777328 0.8778963 0.8780595 0.8782225 0.8783853 0.8785479 [57] 0.8787103 0.8788724 0.8790344 0.8791961 0.8793577 0.8795190 0.8796801 [64] 0.8798410 0.8800017 0.8801622 0.8803224 0.8804825 0.8806423 0.8808019 [71] 0.8809613 0.8811205 0.8812794 0.8814381 0.8815966 0.8817549 0.8819130 [78] 0.8820708 0.8822284 0.8823858 0.8825430 0.8826999 0.8828566 0.8830131 [85] 0.8831693 0.8833254 0.8834811 0.8836367 0.8837920 0.8839471 0.8841020 [92] 0.8842566 0.8844110 0.8845652 0.8847191 0.8848728 0.8850263 0.8851795 [99] 0.8853324 0.8854852 0.8856377 0.8857899 0.8859420 0.8860937 0.8862453 [106] 0.8863966 0.8865476 0.8866984 0.8868490 0.8869993 0.8871494 0.8872992 [113] 0.8874487 0.8875981 0.8877471 0.8878960 0.8880445 0.8881929 0.8883409 [120] 0.8884887 0.8886363 0.8887836 0.8889307 0.8890775 0.8892240 0.8893703 [127] 0.8895163 0.8896621 0.8898076 0.8899529 0.8900979 0.8902426 0.8903871 [134] 0.8905313 0.8906752 0.8908189 0.8909623 0.8911055 0.8912484 0.8913910 [141] 0.8915334 0.8916755 0.8918173 0.8919588 0.8921001 0.8922411 0.8923819 [148] 0.8925223 0.8926625 0.8928025 0.8929421 0.8930815 0.8932206 0.8933594 [155] 0.8934980 0.8936363 0.8937743 0.8939120 0.8940494 0.8941866 0.8943235 [162] 0.8944601 0.8945964 0.8947324 0.8948682 0.8950037 0.8951389 0.8952738 [169] 0.8954084 0.8955427 0.8956768 0.8958106 0.8959440 0.8960772 0.8962101 [176] 0.8963427 0.8964750 0.8966071 0.8967388 0.8968703 0.8970014 0.8971323 [183] 0.8972628 0.8973931 0.8975231 0.8976528 0.8977821 0.8979112 0.8980400 [190] 0.8981685 0.8982967 0.8984246 0.8985522 0.8986795 0.8988065 0.8989331 [197] 0.8990595 0.8991856 0.8993114 0.8994369 0.8995620 0.8996869 0.8998115 [204] 0.8999357 0.9000596 0.9001833 0.9003066 0.9004296 0.9005523 0.9006747 [211] 0.9007968 0.9009186 0.9010401 0.9011612 0.9012820 0.9014026 0.9015228 [218] 0.9016427 0.9017622 0.9018815 0.9020004 0.9021191 0.9022374 0.9023554 [225] 0.9024730 0.9025904 0.9027074 0.9028241 0.9029405 0.9030566 0.9031723 [232] 0.9032877 0.9034028 0.9035176 0.9036320 0.9037462 0.9038600 0.9039734 [239] 0.9040866 0.9041994 0.9043119 0.9044240 0.9045359 0.9046474 0.9047585 [246] 0.9048694 0.9049799 0.9050900 0.9051999 0.9053094 0.9054186 0.9055274 [253] 0.9056359 0.9057441 0.9058519 0.9059594 0.9060666 0.9061734 0.9062799 [260] 0.9063860 0.9064918 0.9065973 0.9067024 0.9068072 0.9069116 0.9070157 [267] 0.9071195 0.9072229 0.9073260 0.9074287 0.9075311 0.9076332 0.9077349 [274] 0.9078362 0.9079372 0.9080379 0.9081382 0.9082382 0.9083378 0.9084371 [281] 0.9085360 0.9086345 0.9087328 0.9088306 0.9089282 0.9090253 0.9091221 [288] 0.9092186 0.9093147 0.9094105 0.9095059 0.9096009 0.9096956 0.9097899 [295] 0.9098839 0.9099776 0.9100708 0.9101637 0.9102563 0.9103485 0.9104403 [302] 0.9105318 0.9106229 0.9107137 0.9108041 0.9108941 0.9109838 0.9110731 [309] 0.9111621 0.9112507 0.9113389 0.9114267 0.9115142 0.9116014 0.9116882 [316] 0.9117746 0.9118606 0.9119463 0.9120316 0.9121165 0.9122011 0.9122853 [323] 0.9123692 0.9124526 0.9125357 0.9126185 0.9127008 0.9127828 0.9128644 [330] 0.9129457 0.9130266 0.9131071 0.9131872 0.9132670 0.9133464 0.9134254 [337] 0.9135040 0.9135823 0.9136602 0.9137377 0.9138149 0.9138916 0.9139680 [344] 0.9140441 0.9141197 0.9141950 0.9142698 0.9143444 0.9144185 0.9144922 [351] 0.9145656 0.9146386 0.9147112 0.9147835 0.9148553 0.9149268 0.9149979 [358] 0.9150686 0.9151389 0.9152089 0.9152785 0.9153476 0.9154164 0.9154849 [365] 0.9155529 0.9156205 0.9156878 0.9157547 0.9158212 0.9158873 0.9159530 [372] 0.9160184 0.9160833 0.9161479 0.9162121 0.9162759 0.9163393 0.9164023 [379] 0.9164649 0.9165272 0.9165890 0.9166505 0.9167116 0.9167723 0.9168326 [386] 0.9168925 0.9169520 0.9170111 0.9170699 0.9171282 0.9171862 0.9172437 [393] 0.9173009 0.9173577 0.9174141 0.9174701 0.9175257 0.9175809 0.9176357 [400] 0.9176901 0.9177442 > mx [1] 0.9177442 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/184xi1226503989.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/25q8f1226503989.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/3rkwq1226503989.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/45pnn1226503989.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/5ythj1226503989.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/6jp2l1226503989.tab") > > system("convert tmp/184xi1226503989.ps tmp/184xi1226503989.png") > system("convert tmp/25q8f1226503989.ps tmp/25q8f1226503989.png") > system("convert tmp/3rkwq1226503989.ps tmp/3rkwq1226503989.png") > system("convert tmp/45pnn1226503989.ps tmp/45pnn1226503989.png") > system("convert tmp/5ythj1226503989.ps tmp/5ythj1226503989.png") > > > proc.time() user system elapsed 1.314 0.798 1.572