R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(14.2,13.5,11.9,14.6,15.6,14.1,14.9,14.2,14.6,17.2,15.4,14.3,17.5,14.5,14.4,16.6,16.7,16.6,16.9,15.7,16.4,18.4,16.9,16.5,18.3,15.1,15.7,18.1,16.8,18.9,19,18.1,17.8,21.5,17.1,18.7,19,16.4,16.9,18.6,19.3,19.4,17.6,18.6,18.1,20.4,18.1,19.6,19.9,19.2,17.8,19.2,22,21.1,19.5,22.2,20.9,22.2,23.5,21.5,24.3,22.8,20.3,23.7,23.3,19.6,18,17.3,16.8,18.2,16.5,16,18.4) > #'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.6922867 0.6922724 0.6922573 0.6922412 0.6922242 0.6922064 0.6921876 [8] 0.6921679 0.6921474 0.6921260 0.6921036 0.6920804 0.6920563 0.6920313 [15] 0.6920054 0.6919786 0.6919510 0.6919224 0.6918930 0.6918627 0.6918315 [22] 0.6917994 0.6917664 0.6917326 0.6916978 0.6916622 0.6916257 0.6915884 [29] 0.6915501 0.6915110 0.6914710 0.6914301 0.6913884 0.6913458 0.6913023 [36] 0.6912579 0.6912127 0.6911666 0.6911197 0.6910718 0.6910231 0.6909736 [43] 0.6909231 0.6908718 0.6908197 0.6907667 0.6907128 0.6906581 0.6906025 [50] 0.6905460 0.6904887 0.6904305 0.6903715 0.6903117 0.6902509 0.6901894 [57] 0.6901269 0.6900637 0.6899995 0.6899346 0.6898687 0.6898021 0.6897346 [64] 0.6896662 0.6895970 0.6895270 0.6894561 0.6893844 0.6893119 0.6892385 [71] 0.6891642 0.6890892 0.6890133 0.6889366 0.6888590 0.6887806 0.6887014 [78] 0.6886214 0.6885405 0.6884588 0.6883763 0.6882930 0.6882088 0.6881239 [85] 0.6880381 0.6879514 0.6878640 0.6877758 0.6876867 0.6875968 0.6875061 [92] 0.6874146 0.6873223 0.6872292 0.6871353 0.6870405 0.6869450 0.6868487 [99] 0.6867515 0.6866536 0.6865548 0.6864553 0.6863549 0.6862538 0.6861519 [106] 0.6860492 0.6859456 0.6858413 0.6857362 0.6856304 0.6855237 0.6854162 [113] 0.6853080 0.6851990 0.6850892 0.6849786 0.6848672 0.6847551 0.6846422 [120] 0.6845285 0.6844140 0.6842988 0.6841828 0.6840660 0.6839485 0.6838302 [127] 0.6837111 0.6835913 0.6834707 0.6833493 0.6832272 0.6831043 0.6829807 [134] 0.6828563 0.6827311 0.6826052 0.6824786 0.6823512 0.6822230 0.6820942 [141] 0.6819645 0.6818341 0.6817030 0.6815712 0.6814386 0.6813052 0.6811711 [148] 0.6810363 0.6809008 0.6807645 0.6806275 0.6804898 0.6803513 0.6802121 [155] 0.6800722 0.6799316 0.6797902 0.6796481 0.6795053 0.6793618 0.6792176 [162] 0.6790727 0.6789270 0.6787806 0.6786336 0.6784858 0.6783373 0.6781881 [169] 0.6780382 0.6778876 0.6777363 0.6775843 0.6774316 0.6772782 0.6771242 [176] 0.6769694 0.6768139 0.6766578 0.6765009 0.6763434 0.6761852 0.6760263 [183] 0.6758668 0.6757065 0.6755456 0.6753840 0.6752217 0.6750587 0.6748951 [190] 0.6747308 0.6745659 0.6744003 0.6742340 0.6740670 0.6738994 0.6737311 [197] 0.6735622 0.6733926 0.6732224 0.6730515 0.6728799 0.6727077 0.6725349 [204] 0.6723614 0.6721872 0.6720125 0.6718370 0.6716610 0.6714843 0.6713069 [211] 0.6711290 0.6709504 0.6707711 0.6705913 0.6704108 0.6702297 0.6700479 [218] 0.6698655 0.6696826 0.6694989 0.6693147 0.6691299 0.6689444 0.6687584 [225] 0.6685717 0.6683844 0.6681965 0.6680080 0.6678189 0.6676292 0.6674389 [232] 0.6672480 0.6670565 0.6668644 0.6666717 0.6664784 0.6662845 0.6660900 [239] 0.6658950 0.6656993 0.6655031 0.6653063 0.6651089 0.6649110 0.6647125 [246] 0.6645133 0.6643137 0.6641134 0.6639126 0.6637112 0.6635092 0.6633067 [253] 0.6631036 0.6629000 0.6626958 0.6624910 0.6622857 0.6620799 0.6618735 [260] 0.6616665 0.6614590 0.6612509 0.6610423 0.6608332 0.6606235 0.6604132 [267] 0.6602025 0.6599912 0.6597793 0.6595670 0.6593541 0.6591407 0.6589267 [274] 0.6587122 0.6584972 0.6582817 0.6580657 0.6578491 0.6576321 0.6574145 [281] 0.6571964 0.6569778 0.6567587 0.6565390 0.6563189 0.6560983 0.6558772 [288] 0.6556555 0.6554334 0.6552108 0.6549877 0.6547641 0.6545400 0.6543154 [295] 0.6540903 0.6538647 0.6536387 0.6534122 0.6531852 0.6529577 0.6527297 [302] 0.6525013 0.6522724 0.6520430 0.6518132 0.6515829 0.6513521 0.6511209 [309] 0.6508892 0.6506570 0.6504244 0.6501913 0.6499578 0.6497238 0.6494894 [316] 0.6492545 0.6490192 0.6487834 0.6485472 0.6483106 0.6480735 0.6478360 [323] 0.6475980 0.6473596 0.6471208 0.6468815 0.6466418 0.6464017 0.6461612 [330] 0.6459202 0.6456788 0.6454370 0.6451948 0.6449522 0.6447091 0.6444657 [337] 0.6442218 0.6439775 0.6437328 0.6434878 0.6432423 0.6429964 0.6427501 [344] 0.6425034 0.6422563 0.6420088 0.6417610 0.6415127 0.6412640 0.6410150 [351] 0.6407656 0.6405158 0.6402656 0.6400150 0.6397641 0.6395128 0.6392611 [358] 0.6390090 0.6387566 0.6385038 0.6382506 0.6379971 0.6377432 0.6374889 [365] 0.6372343 0.6369793 0.6367240 0.6364683 0.6362123 0.6359559 0.6356992 [372] 0.6354421 0.6351847 0.6349269 0.6346688 0.6344104 0.6341516 0.6338924 [379] 0.6336330 0.6333732 0.6331131 0.6328526 0.6325919 0.6323308 0.6320693 [386] 0.6318076 0.6315455 0.6312831 0.6310205 0.6307574 0.6304941 0.6302305 [393] 0.6299665 0.6297023 0.6294377 0.6291729 0.6289077 0.6286422 0.6283765 [400] 0.6281104 0.6278441 > mx [1] 0.6922867 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1clac1257418570.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/2suvl1257418570.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/3nbdi1257418570.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/49bwk1257418570.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/5cd3v1257418570.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/6hb7s1257418570.tab") > > system("convert tmp/1clac1257418570.ps tmp/1clac1257418570.png") > system("convert tmp/2suvl1257418570.ps tmp/2suvl1257418570.png") > system("convert tmp/3nbdi1257418570.ps tmp/3nbdi1257418570.png") > system("convert tmp/49bwk1257418570.ps tmp/49bwk1257418570.png") > system("convert tmp/5cd3v1257418570.ps tmp/5cd3v1257418570.png") > > > proc.time() user system elapsed 1.059 0.775 1.367