R version 2.8.1 (2008-12-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(449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430,424,433,456,459) > #'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.5772032 -0.5772435 -0.5772837 -0.5773239 -0.5773640 -0.5774041 [7] -0.5774441 -0.5774841 -0.5775240 -0.5775639 -0.5776037 -0.5776435 [13] -0.5776832 -0.5777228 -0.5777624 -0.5778020 -0.5778414 -0.5778809 [19] -0.5779203 -0.5779596 -0.5779988 -0.5780381 -0.5780772 -0.5781163 [25] -0.5781554 -0.5781944 -0.5782333 -0.5782722 -0.5783111 -0.5783498 [31] -0.5783886 -0.5784272 -0.5784659 -0.5785044 -0.5785429 -0.5785814 [37] -0.5786198 -0.5786582 -0.5786964 -0.5787347 -0.5787729 -0.5788110 [43] -0.5788491 -0.5788871 -0.5789251 -0.5789630 -0.5790008 -0.5790387 [49] -0.5790764 -0.5791141 -0.5791517 -0.5791893 -0.5792269 -0.5792643 [55] -0.5793018 -0.5793391 -0.5793765 -0.5794137 -0.5794509 -0.5794881 [61] -0.5795252 -0.5795622 -0.5795992 -0.5796361 -0.5796730 -0.5797098 [67] -0.5797466 -0.5797833 -0.5798200 -0.5798566 -0.5798932 -0.5799297 [73] -0.5799661 -0.5800025 -0.5800388 -0.5800751 -0.5801113 -0.5801475 [79] -0.5801836 -0.5802197 -0.5802557 -0.5802916 -0.5803275 -0.5803634 [85] -0.5803992 -0.5804349 -0.5804706 -0.5805062 -0.5805418 -0.5805773 [91] -0.5806128 -0.5806482 -0.5806835 -0.5807188 -0.5807541 -0.5807893 [97] -0.5808244 -0.5808595 -0.5808945 -0.5809295 -0.5809644 -0.5809992 [103] -0.5810340 -0.5810688 -0.5811035 -0.5811381 -0.5811727 -0.5812072 [109] -0.5812417 -0.5812761 -0.5813105 -0.5813448 -0.5813791 -0.5814133 [115] -0.5814474 -0.5814815 -0.5815156 -0.5815496 -0.5815835 -0.5816174 [121] -0.5816512 -0.5816849 -0.5817187 -0.5817523 -0.5817859 -0.5818195 [127] -0.5818529 -0.5818864 -0.5819198 -0.5819531 -0.5819864 -0.5820196 [133] -0.5820527 -0.5820859 -0.5821189 -0.5821519 -0.5821848 -0.5822177 [139] -0.5822506 -0.5822833 -0.5823161 -0.5823487 -0.5823813 -0.5824139 [145] -0.5824464 -0.5824789 -0.5825113 -0.5825436 -0.5825759 -0.5826081 [151] -0.5826403 -0.5826724 -0.5827045 -0.5827365 -0.5827684 -0.5828003 [157] -0.5828322 -0.5828640 -0.5828957 -0.5829274 -0.5829590 -0.5829906 [163] -0.5830221 -0.5830536 -0.5830850 -0.5831163 -0.5831476 -0.5831788 [169] -0.5832100 -0.5832412 -0.5832722 -0.5833033 -0.5833342 -0.5833651 [175] -0.5833960 -0.5834268 -0.5834575 -0.5834882 -0.5835189 -0.5835495 [181] -0.5835800 -0.5836105 -0.5836409 -0.5836712 -0.5837015 -0.5837318 [187] -0.5837620 -0.5837921 -0.5838222 -0.5838522 -0.5838822 -0.5839121 [193] -0.5839420 -0.5839718 -0.5840016 -0.5840313 -0.5840609 -0.5840905 [199] -0.5841201 -0.5841495 -0.5841790 -0.5842083 -0.5842376 -0.5842669 [205] -0.5842961 -0.5843253 -0.5843544 -0.5843834 -0.5844124 -0.5844413 [211] -0.5844702 -0.5844990 -0.5845278 -0.5845565 -0.5845852 -0.5846138 [217] -0.5846423 -0.5846708 -0.5846992 -0.5847276 -0.5847559 -0.5847842 [223] -0.5848124 -0.5848406 -0.5848687 -0.5848967 -0.5849247 -0.5849527 [229] -0.5849806 -0.5850084 -0.5850362 -0.5850639 -0.5850916 -0.5851192 [235] -0.5851467 -0.5851742 -0.5852017 -0.5852291 -0.5852564 -0.5852837 [241] -0.5853109 -0.5853381 -0.5853652 -0.5853922 -0.5854193 -0.5854462 [247] -0.5854731 -0.5854999 -0.5855267 -0.5855535 -0.5855801 -0.5856067 [253] -0.5856333 -0.5856598 -0.5856863 -0.5857127 -0.5857390 -0.5857653 [259] -0.5857915 -0.5858177 -0.5858439 -0.5858699 -0.5858959 -0.5859219 [265] -0.5859478 -0.5859737 -0.5859994 -0.5860252 -0.5860509 -0.5860765 [271] -0.5861021 -0.5861276 -0.5861531 -0.5861785 -0.5862038 -0.5862291 [277] -0.5862544 -0.5862796 -0.5863047 -0.5863298 -0.5863548 -0.5863798 [283] -0.5864047 -0.5864296 -0.5864544 -0.5864791 -0.5865038 -0.5865284 [289] -0.5865530 -0.5865776 -0.5866020 -0.5866265 -0.5866508 -0.5866751 [295] -0.5866994 -0.5867236 -0.5867477 -0.5867718 -0.5867959 -0.5868198 [301] -0.5868438 -0.5868676 -0.5868915 -0.5869152 -0.5869389 -0.5869626 [307] -0.5869862 -0.5870097 -0.5870332 -0.5870566 -0.5870800 -0.5871033 [313] -0.5871266 -0.5871498 -0.5871730 -0.5871961 -0.5872191 -0.5872421 [319] -0.5872650 -0.5872879 -0.5873107 -0.5873335 -0.5873562 -0.5873789 [325] -0.5874015 -0.5874241 -0.5874466 -0.5874690 -0.5874914 -0.5875137 [331] -0.5875360 -0.5875582 -0.5875804 -0.5876025 -0.5876246 -0.5876466 [337] -0.5876685 -0.5876904 -0.5877123 -0.5877340 -0.5877558 -0.5877775 [343] -0.5877991 -0.5878206 -0.5878422 -0.5878636 -0.5878850 -0.5879064 [349] -0.5879277 -0.5879489 -0.5879701 -0.5879912 -0.5880123 -0.5880333 [355] -0.5880543 -0.5880752 -0.5880960 -0.5881168 -0.5881376 -0.5881583 [361] -0.5881789 -0.5881995 -0.5882200 -0.5882405 -0.5882609 -0.5882812 [367] -0.5883016 -0.5883218 -0.5883420 -0.5883621 -0.5883822 -0.5884023 [373] -0.5884222 -0.5884422 -0.5884620 -0.5884819 -0.5885016 -0.5885213 [379] -0.5885410 -0.5885606 -0.5885801 -0.5885996 -0.5886190 -0.5886384 [385] -0.5886577 -0.5886770 -0.5886962 -0.5887154 -0.5887345 -0.5887535 [391] -0.5887725 -0.5887915 -0.5888104 -0.5888292 -0.5888480 -0.5888667 [397] -0.5888854 -0.5889040 -0.5889225 -0.5889410 -0.5889595 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1e49d1257766764.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/rcomp/tmp/2ti7x1257766764.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/rcomp/tmp/3k8g21257766764.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/rcomp/tmp/4h7ak1257766764.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/rcomp/tmp/58ez81257766764.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/68nv91257766764.tab") > > system("convert tmp/1e49d1257766764.ps tmp/1e49d1257766764.png") > system("convert tmp/2ti7x1257766764.ps tmp/2ti7x1257766764.png") > system("convert tmp/3k8g21257766764.ps tmp/3k8g21257766764.png") > system("convert tmp/4h7ak1257766764.ps tmp/4h7ak1257766764.png") > system("convert tmp/58ez81257766764.ps tmp/58ez81257766764.png") > > > proc.time() user system elapsed 1.400 1.210 2.317