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(7.5,7.2,6.9,6.7,6.4,6.3,6.8,7.3,7.1,7.1,6.8,6.5,6.3,6.1,6.1,6.3,6.3,6,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8,8.1,8.2,8.3,8.2,8,7.9,7.6,7.6,8.2,8.3,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.5,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.6,8.2,8.1,8,8.6,8.7,8.8,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.1,8.2,8.1,8.1,7.9,7.9,7.9) > #'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.6713146 0.6713956 0.6714764 0.6715569 0.6716370 0.6717169 0.6717965 [8] 0.6718758 0.6719548 0.6720335 0.6721119 0.6721901 0.6722679 0.6723454 [15] 0.6724227 0.6724996 0.6725763 0.6726526 0.6727287 0.6728045 0.6728799 [22] 0.6729551 0.6730300 0.6731046 0.6731788 0.6732528 0.6733265 0.6733999 [29] 0.6734730 0.6735458 0.6736183 0.6736905 0.6737624 0.6738340 0.6739052 [36] 0.6739762 0.6740469 0.6741173 0.6741874 0.6742572 0.6743267 0.6743959 [43] 0.6744647 0.6745333 0.6746016 0.6746696 0.6747372 0.6748046 0.6748716 [50] 0.6749384 0.6750048 0.6750710 0.6751368 0.6752023 0.6752676 0.6753325 [57] 0.6753971 0.6754614 0.6755254 0.6755891 0.6756525 0.6757155 0.6757783 [64] 0.6758408 0.6759029 0.6759647 0.6760263 0.6760875 0.6761484 0.6762090 [71] 0.6762693 0.6763293 0.6763889 0.6764483 0.6765073 0.6765661 0.6766245 [78] 0.6766826 0.6767404 0.6767979 0.6768550 0.6769119 0.6769684 0.6770247 [85] 0.6770806 0.6771362 0.6771915 0.6772464 0.6773011 0.6773554 0.6774095 [92] 0.6774632 0.6775166 0.6775696 0.6776224 0.6776748 0.6777270 0.6777788 [99] 0.6778303 0.6778815 0.6779323 0.6779829 0.6780331 0.6780830 0.6781326 [106] 0.6781818 0.6782308 0.6782794 0.6783277 0.6783757 0.6784234 0.6784707 [113] 0.6785178 0.6785645 0.6786109 0.6786569 0.6787027 0.6787481 0.6787932 [120] 0.6788380 0.6788824 0.6789266 0.6789704 0.6790139 0.6790570 0.6790999 [127] 0.6791424 0.6791846 0.6792265 0.6792680 0.6793093 0.6793502 0.6793907 [134] 0.6794310 0.6794709 0.6795105 0.6795498 0.6795887 0.6796274 0.6796657 [141] 0.6797036 0.6797413 0.6797786 0.6798156 0.6798523 0.6798886 0.6799246 [148] 0.6799603 0.6799957 0.6800307 0.6800654 0.6800998 0.6801339 0.6801676 [155] 0.6802010 0.6802340 0.6802668 0.6802992 0.6803313 0.6803630 0.6803944 [162] 0.6804255 0.6804563 0.6804867 0.6805168 0.6805466 0.6805760 0.6806051 [169] 0.6806339 0.6806623 0.6806905 0.6807183 0.6807457 0.6807728 0.6807996 [176] 0.6808261 0.6808522 0.6808780 0.6809035 0.6809286 0.6809534 0.6809779 [183] 0.6810020 0.6810258 0.6810493 0.6810724 0.6810952 0.6811177 0.6811398 [190] 0.6811616 0.6811831 0.6812042 0.6812250 0.6812455 0.6812656 0.6812854 [197] 0.6813049 0.6813240 0.6813428 0.6813613 0.6813794 0.6813972 0.6814147 [204] 0.6814318 0.6814486 0.6814650 0.6814812 0.6814969 0.6815124 0.6815275 [211] 0.6815423 0.6815567 0.6815708 0.6815846 0.6815980 0.6816111 0.6816239 [218] 0.6816363 0.6816484 0.6816601 0.6816715 0.6816826 0.6816933 0.6817037 [225] 0.6817138 0.6817235 0.6817329 0.6817420 0.6817507 0.6817591 0.6817671 [232] 0.6817748 0.6817822 0.6817892 0.6817959 0.6818022 0.6818082 0.6818139 [239] 0.6818193 0.6818243 0.6818289 0.6818332 0.6818372 0.6818409 0.6818442 [246] 0.6818471 0.6818498 0.6818521 0.6818540 0.6818556 0.6818569 0.6818578 [253] 0.6818584 0.6818587 0.6818586 0.6818582 0.6818574 0.6818563 0.6818549 [260] 0.6818531 0.6818510 0.6818485 0.6818458 0.6818426 0.6818391 0.6818353 [267] 0.6818312 0.6818267 0.6818219 0.6818167 0.6818112 0.6818053 0.6817991 [274] 0.6817926 0.6817857 0.6817785 0.6817710 0.6817631 0.6817549 0.6817463 [281] 0.6817374 0.6817282 0.6817186 0.6817086 0.6816984 0.6816878 0.6816768 [288] 0.6816655 0.6816539 0.6816420 0.6816296 0.6816170 0.6816040 0.6815907 [295] 0.6815770 0.6815630 0.6815487 0.6815340 0.6815190 0.6815036 0.6814879 [302] 0.6814719 0.6814555 0.6814388 0.6814217 0.6814043 0.6813866 0.6813685 [309] 0.6813501 0.6813313 0.6813122 0.6812928 0.6812730 0.6812529 0.6812324 [316] 0.6812116 0.6811905 0.6811690 0.6811472 0.6811250 0.6811025 0.6810797 [323] 0.6810565 0.6810330 0.6810092 0.6809850 0.6809604 0.6809356 0.6809104 [330] 0.6808848 0.6808589 0.6808327 0.6808061 0.6807792 0.6807520 0.6807244 [337] 0.6806965 0.6806682 0.6806396 0.6806107 0.6805814 0.6805518 0.6805219 [344] 0.6804916 0.6804610 0.6804300 0.6803987 0.6803670 0.6803351 0.6803028 [351] 0.6802701 0.6802371 0.6802038 0.6801701 0.6801361 0.6801018 0.6800671 [358] 0.6800321 0.6799967 0.6799610 0.6799250 0.6798886 0.6798519 0.6798149 [365] 0.6797775 0.6797398 0.6797017 0.6796633 0.6796246 0.6795856 0.6795462 [372] 0.6795064 0.6794664 0.6794260 0.6793852 0.6793442 0.6793027 0.6792610 [379] 0.6792189 0.6791765 0.6791337 0.6790907 0.6790472 0.6790035 0.6789594 [386] 0.6789149 0.6788702 0.6788251 0.6787797 0.6787339 0.6786878 0.6786414 [393] 0.6785946 0.6785475 0.6785000 0.6784523 0.6784042 0.6783557 0.6783070 [400] 0.6782579 0.6782084 > mx [1] 0.6818587 > mxli [1] 0.53 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1sf611228662876.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/2ke6w1228662876.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/3nrdt1228662876.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/4asx41228662876.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/5yyeq1228662876.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/65rou1228662876.tab") > > system("convert tmp/1sf611228662876.ps tmp/1sf611228662876.png") > system("convert tmp/2ke6w1228662876.ps tmp/2ke6w1228662876.png") > system("convert tmp/3nrdt1228662876.ps tmp/3nrdt1228662876.png") > system("convert tmp/4asx41228662876.ps tmp/4asx41228662876.png") > system("convert tmp/5yyeq1228662876.ps tmp/5yyeq1228662876.png") > > > proc.time() user system elapsed 1.083 0.776 1.406