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(104.2,103.2,112.7,106.4,102.6,110.6,95.2,89.0,112.5,116.8,107.2,113.6,101.8,102.6,122.7,110.3,110.5,121.6,100.3,100.7,123.4,127.1,124.1,131.2,111.6,114.2,130.1,125.9,119.0,133.8,107.5,113.5,134.4,126.8,135.6,139.9,129.8,131.0,153.1,134.1,144.1,155.9,123.3,128.1,144.3,153.0,149.9,150.9,141.0,138.9,157.4,142.9,151.7,161.0,138.5,135.9,151.5,164.0,159.1,157.0,142.1,144.8,152.1,154.6,148.7,157.7,146.7) > #'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.8102471 0.8104336 0.8106194 0.8108046 0.8109892 0.8111731 0.8113564 [8] 0.8115391 0.8117212 0.8119026 0.8120834 0.8122636 0.8124432 0.8126221 [15] 0.8128004 0.8129781 0.8131551 0.8133315 0.8135073 0.8136825 0.8138570 [22] 0.8140309 0.8142042 0.8143769 0.8145489 0.8147203 0.8148911 0.8150612 [29] 0.8152307 0.8153996 0.8155678 0.8157355 0.8159024 0.8160688 0.8162345 [36] 0.8163996 0.8165641 0.8167279 0.8168911 0.8170537 0.8172157 0.8173770 [43] 0.8175377 0.8176977 0.8178572 0.8180160 0.8181741 0.8183317 0.8184886 [50] 0.8186448 0.8188005 0.8189555 0.8191099 0.8192636 0.8194167 0.8195692 [57] 0.8197210 0.8198723 0.8200229 0.8201728 0.8203221 0.8204708 0.8206189 [64] 0.8207663 0.8209131 0.8210593 0.8212048 0.8213497 0.8214940 0.8216376 [71] 0.8217807 0.8219230 0.8220648 0.8222059 0.8223464 0.8224862 0.8226255 [78] 0.8227640 0.8229020 0.8230393 0.8231760 0.8233121 0.8234475 0.8235823 [85] 0.8237165 0.8238500 0.8239830 0.8241152 0.8242469 0.8243779 0.8245083 [92] 0.8246380 0.8247672 0.8248957 0.8250235 0.8251508 0.8252774 0.8254033 [99] 0.8255287 0.8256534 0.8257775 0.8259009 0.8260238 0.8261460 0.8262675 [106] 0.8263885 0.8265088 0.8266285 0.8267475 0.8268659 0.8269837 0.8271009 [113] 0.8272174 0.8273334 0.8274486 0.8275633 0.8276773 0.8277907 0.8279035 [120] 0.8280157 0.8281272 0.8282381 0.8283483 0.8284580 0.8285670 0.8286754 [127] 0.8287831 0.8288903 0.8289968 0.8291027 0.8292079 0.8293126 0.8294166 [134] 0.8295200 0.8296228 0.8297249 0.8298264 0.8299273 0.8300276 0.8301272 [141] 0.8302263 0.8303247 0.8304224 0.8305196 0.8306161 0.8307120 0.8308073 [148] 0.8309020 0.8309961 0.8310895 0.8311823 0.8312745 0.8313661 0.8314570 [155] 0.8315474 0.8316371 0.8317262 0.8318146 0.8319025 0.8319897 0.8320764 [162] 0.8321624 0.8322478 0.8323325 0.8324167 0.8325002 0.8325832 0.8326655 [169] 0.8327472 0.8328283 0.8329087 0.8329886 0.8330678 0.8331464 0.8332245 [176] 0.8333019 0.8333786 0.8334548 0.8335304 0.8336053 0.8336797 0.8337534 [183] 0.8338265 0.8338990 0.8339709 0.8340422 0.8341129 0.8341830 0.8342524 [190] 0.8343213 0.8343895 0.8344572 0.8345242 0.8345907 0.8346565 0.8347217 [197] 0.8347863 0.8348503 0.8349137 0.8349765 0.8350387 0.8351003 0.8351613 [204] 0.8352217 0.8352815 0.8353407 0.8353992 0.8354572 0.8355146 0.8355714 [211] 0.8356276 0.8356832 0.8357382 0.8357925 0.8358463 0.8358995 0.8359521 [218] 0.8360041 0.8360555 0.8361063 0.8361565 0.8362062 0.8362552 0.8363036 [225] 0.8363515 0.8363987 0.8364454 0.8364914 0.8365369 0.8365818 0.8366261 [232] 0.8366698 0.8367129 0.8367554 0.8367973 0.8368387 0.8368794 0.8369196 [239] 0.8369592 0.8369982 0.8370366 0.8370744 0.8371117 0.8371483 0.8371844 [246] 0.8372199 0.8372548 0.8372891 0.8373229 0.8373560 0.8373886 0.8374206 [253] 0.8374520 0.8374829 0.8375132 0.8375428 0.8375720 0.8376005 0.8376285 [260] 0.8376558 0.8376827 0.8377089 0.8377346 0.8377596 0.8377842 0.8378081 [267] 0.8378315 0.8378543 0.8378765 0.8378982 0.8379193 0.8379398 0.8379597 [274] 0.8379791 0.8379979 0.8380162 0.8380339 0.8380510 0.8380675 0.8380835 [281] 0.8380990 0.8381138 0.8381281 0.8381419 0.8381550 0.8381677 0.8381797 [288] 0.8381912 0.8382022 0.8382125 0.8382224 0.8382316 0.8382403 0.8382485 [295] 0.8382561 0.8382631 0.8382696 0.8382756 0.8382809 0.8382858 0.8382900 [302] 0.8382938 0.8382970 0.8382996 0.8383017 0.8383032 0.8383042 0.8383046 [309] 0.8383045 0.8383038 0.8383026 0.8383009 0.8382986 0.8382958 0.8382924 [316] 0.8382885 0.8382840 0.8382790 0.8382735 0.8382674 0.8382608 0.8382536 [323] 0.8382459 0.8382377 0.8382289 0.8382196 0.8382098 0.8381994 0.8381885 [330] 0.8381771 0.8381651 0.8381526 0.8381396 0.8381260 0.8381119 0.8380973 [337] 0.8380821 0.8380665 0.8380503 0.8380335 0.8380163 0.8379985 0.8379802 [344] 0.8379614 0.8379420 0.8379222 0.8379018 0.8378809 0.8378594 0.8378375 [351] 0.8378150 0.8377920 0.8377685 0.8377445 0.8377200 0.8376949 0.8376694 [358] 0.8376433 0.8376167 0.8375896 0.8375620 0.8375339 0.8375053 0.8374761 [365] 0.8374465 0.8374163 0.8373857 0.8373545 0.8373228 0.8372907 0.8372580 [372] 0.8372248 0.8371911 0.8371569 0.8371222 0.8370871 0.8370514 0.8370152 [379] 0.8369785 0.8369413 0.8369037 0.8368655 0.8368268 0.8367877 0.8367480 [386] 0.8367079 0.8366672 0.8366261 0.8365845 0.8365424 0.8364998 0.8364567 [393] 0.8364131 0.8363690 0.8363245 0.8362795 0.8362340 0.8361880 0.8361415 [400] 0.8360945 0.8360471 > mx [1] 0.8383046 > mxli [1] 1.07 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1x4xx1226403249.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/2szz21226403249.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/3wr311226403249.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/4f4141226403249.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/5fjbo1226403249.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/6bdw81226403249.tab") > > system("convert tmp/1x4xx1226403249.ps tmp/1x4xx1226403249.png") > system("convert tmp/2szz21226403249.ps tmp/2szz21226403249.png") > system("convert tmp/3wr311226403249.ps tmp/3wr311226403249.png") > system("convert tmp/4f4141226403249.ps tmp/4f4141226403249.png") > system("convert tmp/5fjbo1226403249.ps tmp/5fjbo1226403249.png") > > > proc.time() user system elapsed 2.413 1.329 2.590