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(93.5,94.7,112.9,99.2,105.6,113,83.1,81.1,96.9,104.3,97.7,102.6,89.9,96,112.7,107.1,106.2,121,101.2,83.2,105.1,113.3,99.1,100.3,93.5,98.8,106.2,98.3,102.1,117.1,101.5,80.5,105.9,109.5,97.2,114.5,93.5,100.9,121.1,116.5,109.3,118.1,108.3,105.4,116.2,111.2,105.8,122.7,99.5,107.9,124.6,115,110.3,132.7,99.7,96.5,118.7,112.9,130.5,137.9,115,116.8,140.9,120.7,134.2,147.3,112.4,107.1,128.4,137.7,135,151,137.4,132.4,161.3,139.8,146,166.5,143.3,121,152.6,154.4,154.6,158) > #'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.7259289 0.7262364 0.7265430 0.7268488 0.7271537 0.7274578 0.7277611 [8] 0.7280635 0.7283651 0.7286659 0.7289658 0.7292648 0.7295630 0.7298604 [15] 0.7301569 0.7304526 0.7307474 0.7310413 0.7313344 0.7316266 0.7319180 [22] 0.7322085 0.7324981 0.7327869 0.7330748 0.7333619 0.7336481 0.7339334 [29] 0.7342178 0.7345014 0.7347841 0.7350659 0.7353469 0.7356269 0.7359061 [36] 0.7361844 0.7364618 0.7367384 0.7370140 0.7372888 0.7375627 0.7378357 [43] 0.7381078 0.7383790 0.7386493 0.7389187 0.7391872 0.7394549 0.7397216 [50] 0.7399874 0.7402524 0.7405164 0.7407796 0.7410418 0.7413031 0.7415635 [57] 0.7418231 0.7420817 0.7423394 0.7425962 0.7428521 0.7431070 0.7433611 [64] 0.7436142 0.7438665 0.7441178 0.7443682 0.7446177 0.7448662 0.7451139 [71] 0.7453606 0.7456064 0.7458513 0.7460953 0.7463383 0.7465804 0.7468216 [78] 0.7470618 0.7473012 0.7475396 0.7477770 0.7480136 0.7482492 0.7484839 [85] 0.7487176 0.7489504 0.7491823 0.7494133 0.7496433 0.7498723 0.7501005 [92] 0.7503277 0.7505539 0.7507793 0.7510036 0.7512271 0.7514496 0.7516711 [99] 0.7518918 0.7521114 0.7523302 0.7525480 0.7527648 0.7529807 0.7531957 [106] 0.7534097 0.7536227 0.7538348 0.7540460 0.7542562 0.7544655 0.7546738 [113] 0.7548812 0.7550876 0.7552930 0.7554976 0.7557011 0.7559037 0.7561054 [120] 0.7563061 0.7565058 0.7567046 0.7569025 0.7570994 0.7572953 0.7574903 [127] 0.7576843 0.7578774 0.7580695 0.7582607 0.7584509 0.7586401 0.7588284 [134] 0.7590157 0.7592021 0.7593875 0.7595720 0.7597555 0.7599380 0.7601196 [141] 0.7603002 0.7604799 0.7606586 0.7608363 0.7610131 0.7611889 0.7613638 [148] 0.7615377 0.7617106 0.7618826 0.7620537 0.7622237 0.7623928 0.7625610 [155] 0.7627282 0.7628944 0.7630597 0.7632240 0.7633873 0.7635497 0.7637111 [162] 0.7638716 0.7640311 0.7641897 0.7643472 0.7645039 0.7646595 0.7648142 [169] 0.7649680 0.7651208 0.7652726 0.7654235 0.7655734 0.7657223 0.7658703 [176] 0.7660174 0.7661635 0.7663086 0.7664527 0.7665960 0.7667382 0.7668795 [183] 0.7670198 0.7671592 0.7672976 0.7674351 0.7675716 0.7677072 0.7678418 [190] 0.7679754 0.7681081 0.7682399 0.7683706 0.7685005 0.7686294 0.7687573 [197] 0.7688843 0.7690103 0.7691353 0.7692595 0.7693826 0.7695049 0.7696261 [204] 0.7697465 0.7698658 0.7699843 0.7701017 0.7702183 0.7703338 0.7704485 [211] 0.7705622 0.7706749 0.7707867 0.7708976 0.7710075 0.7711165 0.7712245 [218] 0.7713316 0.7714377 0.7715429 0.7716472 0.7717505 0.7718529 0.7719544 [225] 0.7720549 0.7721544 0.7722531 0.7723508 0.7724476 0.7725434 0.7726383 [232] 0.7727323 0.7728253 0.7729174 0.7730086 0.7730988 0.7731881 0.7732765 [239] 0.7733640 0.7734505 0.7735361 0.7736208 0.7737045 0.7737874 0.7738693 [246] 0.7739502 0.7740303 0.7741094 0.7741877 0.7742650 0.7743414 0.7744168 [253] 0.7744914 0.7745650 0.7746377 0.7747095 0.7747804 0.7748504 0.7749195 [260] 0.7749876 0.7750549 0.7751212 0.7751867 0.7752512 0.7753148 0.7753775 [267] 0.7754394 0.7755003 0.7755603 0.7756194 0.7756776 0.7757349 0.7757913 [274] 0.7758468 0.7759014 0.7759552 0.7760080 0.7760599 0.7761110 0.7761611 [281] 0.7762104 0.7762588 0.7763063 0.7763529 0.7763986 0.7764434 0.7764874 [288] 0.7765304 0.7765726 0.7766139 0.7766544 0.7766939 0.7767326 0.7767704 [295] 0.7768073 0.7768433 0.7768785 0.7769128 0.7769463 0.7769788 0.7770105 [302] 0.7770414 0.7770713 0.7771004 0.7771287 0.7771561 0.7771826 0.7772083 [309] 0.7772331 0.7772570 0.7772801 0.7773023 0.7773237 0.7773442 0.7773639 [316] 0.7773828 0.7774007 0.7774179 0.7774342 0.7774496 0.7774642 0.7774780 [323] 0.7774909 0.7775030 0.7775142 0.7775246 0.7775342 0.7775429 0.7775508 [330] 0.7775579 0.7775642 0.7775696 0.7775742 0.7775779 0.7775809 0.7775830 [337] 0.7775843 0.7775847 0.7775844 0.7775832 0.7775812 0.7775784 0.7775748 [344] 0.7775704 0.7775651 0.7775591 0.7775522 0.7775446 0.7775361 0.7775268 [351] 0.7775168 0.7775059 0.7774942 0.7774817 0.7774684 0.7774544 0.7774395 [358] 0.7774238 0.7774074 0.7773901 0.7773721 0.7773533 0.7773337 0.7773133 [365] 0.7772921 0.7772702 0.7772474 0.7772239 0.7771996 0.7771746 0.7771487 [372] 0.7771221 0.7770947 0.7770666 0.7770376 0.7770080 0.7769775 0.7769463 [379] 0.7769143 0.7768815 0.7768480 0.7768138 0.7767788 0.7767430 0.7767064 [386] 0.7766692 0.7766311 0.7765924 0.7765528 0.7765125 0.7764715 0.7764298 [393] 0.7763873 0.7763440 0.7763000 0.7762553 0.7762098 0.7761637 0.7761167 [400] 0.7760691 0.7760207 > mx [1] 0.7775847 > mxli [1] 1.37 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1a9mw1226402433.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/23drk1226402433.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/3sw0e1226402433.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/4pkk91226402433.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/freestat/rcomp/tmp/5zh0b1226402433.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > 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/6wi1x1226402433.tab") > > system("convert tmp/1a9mw1226402433.ps tmp/1a9mw1226402433.png") > system("convert tmp/23drk1226402433.ps tmp/23drk1226402433.png") > system("convert tmp/3sw0e1226402433.ps tmp/3sw0e1226402433.png") > system("convert tmp/4pkk91226402433.ps tmp/4pkk91226402433.png") > system("convert tmp/5zh0b1226402433.ps tmp/5zh0b1226402433.png") > > > proc.time() user system elapsed 1.716 1.260 2.593