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(95.05,96.84,96.92,97.44,97.78,97.69,96.67,98.29,98.2,98.71,98.54,98.2,96.92,99.06,99.65,99.82,99.99,100.33,99.31,101.1,101.1,100.93,100.85,100.93,99.6,101.88,101.81,102.38,102.74,102.82,101.72,103.47,102.98,102.68,102.9,103.03,101.29,103.69,103.68,104.2,104.08,104.16,103.05,104.66,104.46,104.95,105.85,106.23,104.86,107.44,108.23,108.45,109.39,110.15,109.13,110.28,110.17,109.99,109.26,109.11) > #'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.9656262 0.9656131 0.9655999 0.9655867 0.9655734 0.9655601 0.9655467 [8] 0.9655333 0.9655199 0.9655064 0.9654929 0.9654793 0.9654657 0.9654521 [15] 0.9654384 0.9654247 0.9654109 0.9653971 0.9653833 0.9653694 0.9653554 [22] 0.9653415 0.9653275 0.9653134 0.9652993 0.9652852 0.9652710 0.9652568 [29] 0.9652426 0.9652283 0.9652139 0.9651996 0.9651851 0.9651707 0.9651562 [36] 0.9651417 0.9651271 0.9651125 0.9650978 0.9650831 0.9650684 0.9650536 [43] 0.9650388 0.9650239 0.9650090 0.9649941 0.9649791 0.9649641 0.9649490 [50] 0.9649339 0.9649187 0.9649036 0.9648883 0.9648731 0.9648578 0.9648424 [57] 0.9648270 0.9648116 0.9647961 0.9647806 0.9647651 0.9647495 0.9647338 [64] 0.9647182 0.9647024 0.9646867 0.9646709 0.9646551 0.9646392 0.9646233 [71] 0.9646073 0.9645913 0.9645753 0.9645592 0.9645431 0.9645269 0.9645107 [78] 0.9644945 0.9644782 0.9644619 0.9644456 0.9644292 0.9644127 0.9643962 [85] 0.9643797 0.9643632 0.9643466 0.9643299 0.9643132 0.9642965 0.9642797 [92] 0.9642629 0.9642461 0.9642292 0.9642123 0.9641953 0.9641783 0.9641613 [99] 0.9641442 0.9641271 0.9641099 0.9640927 0.9640755 0.9640582 0.9640409 [106] 0.9640235 0.9640061 0.9639886 0.9639712 0.9639536 0.9639361 0.9639185 [113] 0.9639008 0.9638831 0.9638654 0.9638476 0.9638298 0.9638120 0.9637941 [120] 0.9637762 0.9637582 0.9637402 0.9637221 0.9637041 0.9636859 0.9636678 [127] 0.9636495 0.9636313 0.9636130 0.9635947 0.9635763 0.9635579 0.9635395 [134] 0.9635210 0.9635024 0.9634839 0.9634653 0.9634466 0.9634279 0.9634092 [141] 0.9633904 0.9633716 0.9633528 0.9633339 0.9633150 0.9632960 0.9632770 [148] 0.9632580 0.9632389 0.9632198 0.9632006 0.9631814 0.9631621 0.9631428 [155] 0.9631235 0.9631042 0.9630848 0.9630653 0.9630458 0.9630263 0.9630067 [162] 0.9629871 0.9629675 0.9629478 0.9629281 0.9629083 0.9628885 0.9628687 [169] 0.9628488 0.9628289 0.9628089 0.9627889 0.9627689 0.9627488 0.9627287 [176] 0.9627085 0.9626883 0.9626681 0.9626478 0.9626275 0.9626071 0.9625867 [183] 0.9625663 0.9625458 0.9625253 0.9625048 0.9624842 0.9624635 0.9624429 [190] 0.9624222 0.9624014 0.9623806 0.9623598 0.9623389 0.9623180 0.9622971 [197] 0.9622761 0.9622550 0.9622340 0.9622129 0.9621917 0.9621705 0.9621493 [204] 0.9621281 0.9621068 0.9620854 0.9620640 0.9620426 0.9620211 0.9619997 [211] 0.9619781 0.9619565 0.9619349 0.9619133 0.9618916 0.9618698 0.9618481 [218] 0.9618262 0.9618044 0.9617825 0.9617606 0.9617386 0.9617166 0.9616945 [225] 0.9616725 0.9616503 0.9616282 0.9616060 0.9615837 0.9615614 0.9615391 [232] 0.9615167 0.9614943 0.9614719 0.9614494 0.9614269 0.9614044 0.9613818 [239] 0.9613591 0.9613365 0.9613137 0.9612910 0.9612682 0.9612454 0.9612225 [246] 0.9611996 0.9611767 0.9611537 0.9611306 0.9611076 0.9610845 0.9610613 [253] 0.9610382 0.9610149 0.9609917 0.9609684 0.9609451 0.9609217 0.9608983 [260] 0.9608748 0.9608513 0.9608278 0.9608042 0.9607806 0.9607570 0.9607333 [267] 0.9607096 0.9606858 0.9606620 0.9606382 0.9606143 0.9605904 0.9605664 [274] 0.9605425 0.9605184 0.9604944 0.9604702 0.9604461 0.9604219 0.9603977 [281] 0.9603734 0.9603491 0.9603248 0.9603004 0.9602760 0.9602515 0.9602271 [288] 0.9602025 0.9601780 0.9601533 0.9601287 0.9601040 0.9600793 0.9600545 [295] 0.9600297 0.9600049 0.9599800 0.9599551 0.9599301 0.9599052 0.9598801 [302] 0.9598551 0.9598300 0.9598048 0.9597796 0.9597544 0.9597291 0.9597038 [309] 0.9596785 0.9596531 0.9596277 0.9596023 0.9595768 0.9595513 0.9595257 [316] 0.9595001 0.9594745 0.9594488 0.9594231 0.9593973 0.9593715 0.9593457 [323] 0.9593198 0.9592939 0.9592680 0.9592420 0.9592160 0.9591899 0.9591638 [330] 0.9591377 0.9591115 0.9590853 0.9590590 0.9590327 0.9590064 0.9589801 [337] 0.9589537 0.9589272 0.9589008 0.9588742 0.9588477 0.9588211 0.9587945 [344] 0.9587678 0.9587411 0.9587144 0.9586876 0.9586608 0.9586339 0.9586070 [351] 0.9585801 0.9585531 0.9585261 0.9584991 0.9584720 0.9584449 0.9584177 [358] 0.9583906 0.9583633 0.9583361 0.9583088 0.9582814 0.9582540 0.9582266 [365] 0.9581992 0.9581717 0.9581441 0.9581166 0.9580890 0.9580613 0.9580337 [372] 0.9580059 0.9579782 0.9579504 0.9579226 0.9578947 0.9578668 0.9578389 [379] 0.9578109 0.9577829 0.9577548 0.9577267 0.9576986 0.9576704 0.9576422 [386] 0.9576140 0.9575857 0.9575574 0.9575291 0.9575007 0.9574723 0.9574438 [393] 0.9574153 0.9573868 0.9573582 0.9573296 0.9573009 0.9572723 0.9572435 [400] 0.9572148 0.9571860 > mx [1] 0.9656262 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/10s1a1258025013.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/2usma1258025013.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/3zuh91258025013.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/4j62e1258025013.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/5haam1258025013.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/6tfov1258025013.tab") > > system("convert tmp/10s1a1258025013.ps tmp/10s1a1258025013.png") > system("convert tmp/2usma1258025013.ps tmp/2usma1258025013.png") > system("convert tmp/3zuh91258025013.ps tmp/3zuh91258025013.png") > system("convert tmp/4j62e1258025013.ps tmp/4j62e1258025013.png") > system("convert tmp/5haam1258025013.ps tmp/5haam1258025013.png") > > > proc.time() user system elapsed 1.745 1.299 2.004