R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(281,295,294,302,314,321,313,310,319,316,319,333,356,358,340,328,355,356,351,359,378,378,389.,407,413,404,406,402,383,392,398,400,405,420,439,441,424,423,434,429,421,430,424,437,456,469,476,510,549,554,557,610,675,596,633,632,596,585,627,629) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.9685512 0.9686228 0.9686932 0.9687625 0.9688305 0.9688974 0.9689630 [8] 0.9690275 0.9690907 0.9691527 0.9692136 0.9692732 0.9693316 0.9693887 [15] 0.9694446 0.9694994 0.9695528 0.9696051 0.9696561 0.9697058 0.9697544 [22] 0.9698016 0.9698476 0.9698924 0.9699359 0.9699782 0.9700192 0.9700589 [29] 0.9700974 0.9701346 0.9701705 0.9702051 0.9702385 0.9702706 0.9703014 [36] 0.9703309 0.9703591 0.9703861 0.9704117 0.9704361 0.9704591 0.9704809 [43] 0.9705013 0.9705205 0.9705383 0.9705548 0.9705700 0.9705839 0.9705965 [50] 0.9706077 0.9706177 0.9706263 0.9706335 0.9706395 0.9706441 0.9706474 [57] 0.9706493 0.9706499 0.9706492 0.9706471 0.9706437 0.9706389 0.9706328 [64] 0.9706254 0.9706165 0.9706064 0.9705948 0.9705820 0.9705677 0.9705521 [71] 0.9705351 0.9705168 0.9704971 0.9704760 0.9704536 0.9704298 0.9704046 [78] 0.9703781 0.9703501 0.9703208 0.9702901 0.9702581 0.9702246 0.9701898 [85] 0.9701536 0.9701160 0.9700770 0.9700366 0.9699948 0.9699517 0.9699071 [92] 0.9698612 0.9698138 0.9697651 0.9697150 0.9696634 0.9696105 0.9695562 [99] 0.9695005 0.9694433 0.9693848 0.9693249 0.9692635 0.9692008 0.9691367 [106] 0.9690711 0.9690042 0.9689358 0.9688661 0.9687949 0.9687223 0.9686483 [113] 0.9685729 0.9684961 0.9684179 0.9683383 0.9682573 0.9681748 0.9680910 [120] 0.9680057 0.9679190 0.9678309 0.9677414 0.9676505 0.9675582 0.9674645 [127] 0.9673693 0.9672727 0.9671748 0.9670754 0.9669746 0.9668724 0.9667688 [134] 0.9666638 0.9665574 0.9664495 0.9663403 0.9662296 0.9661175 0.9660041 [141] 0.9658892 0.9657729 0.9656552 0.9655361 0.9654156 0.9652937 0.9651704 [148] 0.9650457 0.9649196 0.9647921 0.9646631 0.9645328 0.9644011 0.9642680 [155] 0.9641335 0.9639976 0.9638603 0.9637216 0.9635815 0.9634401 0.9632972 [162] 0.9631530 0.9630073 0.9628603 0.9627119 0.9625621 0.9624110 0.9622584 [169] 0.9621045 0.9619492 0.9617925 0.9616345 0.9614750 0.9613143 0.9611521 [176] 0.9609886 0.9608237 0.9606574 0.9604898 0.9603208 0.9601505 0.9599788 [183] 0.9598057 0.9596313 0.9594556 0.9592785 0.9591001 0.9589203 0.9587391 [190] 0.9585567 0.9583729 0.9581877 0.9580013 0.9578135 0.9576243 0.9574339 [197] 0.9572421 0.9570490 0.9568546 0.9566588 0.9564618 0.9562634 0.9560638 [204] 0.9558628 0.9556605 0.9554570 0.9552521 0.9550459 0.9548385 0.9546297 [211] 0.9544197 0.9542084 0.9539958 0.9537819 0.9535667 0.9533503 0.9531326 [218] 0.9529137 0.9526934 0.9524720 0.9522492 0.9520252 0.9518000 0.9515735 [225] 0.9513458 0.9511168 0.9508866 0.9506551 0.9504225 0.9501886 0.9499535 [232] 0.9497171 0.9494795 0.9492408 0.9490008 0.9487596 0.9485172 0.9482736 [239] 0.9480288 0.9477828 0.9475357 0.9472873 0.9470378 0.9467870 0.9465352 [246] 0.9462821 0.9460279 0.9457725 0.9455159 0.9452582 0.9449994 0.9447394 [253] 0.9444782 0.9442160 0.9439525 0.9436880 0.9434223 0.9431555 0.9428876 [260] 0.9426186 0.9423484 0.9420772 0.9418048 0.9415314 0.9412568 0.9409812 [267] 0.9407044 0.9404266 0.9401478 0.9398678 0.9395868 0.9393047 0.9390215 [274] 0.9387373 0.9384521 0.9381657 0.9378784 0.9375900 0.9373006 0.9370101 [281] 0.9367186 0.9364261 0.9361326 0.9358381 0.9355425 0.9352460 0.9349484 [288] 0.9346499 0.9343504 0.9340499 0.9337484 0.9334459 0.9331425 0.9328381 [295] 0.9325327 0.9322264 0.9319191 0.9316109 0.9313017 0.9309916 0.9306805 [302] 0.9303686 0.9300557 0.9297418 0.9294271 0.9291115 0.9287949 0.9284775 [309] 0.9281591 0.9278399 0.9275198 0.9271987 0.9268769 0.9265541 0.9262305 [316] 0.9259060 0.9255807 0.9252545 0.9249274 0.9245995 0.9242708 0.9239412 [323] 0.9236109 0.9232796 0.9229476 0.9226148 0.9222811 0.9219467 0.9216114 [330] 0.9212754 0.9209385 0.9206009 0.9202625 0.9199233 0.9195834 0.9192426 [337] 0.9189012 0.9185590 0.9182160 0.9178723 0.9175278 0.9171826 0.9168367 [344] 0.9164900 0.9161426 0.9157946 0.9154458 0.9150963 0.9147461 0.9143952 [351] 0.9140436 0.9136913 0.9133384 0.9129847 0.9126304 0.9122755 0.9119198 [358] 0.9115635 0.9112066 0.9108490 0.9104908 0.9101320 0.9097725 0.9094124 [365] 0.9090516 0.9086903 0.9083283 0.9079657 0.9076026 0.9072388 0.9068745 [372] 0.9065095 0.9061440 0.9057779 0.9054112 0.9050440 0.9046762 0.9043078 [379] 0.9039389 0.9035694 0.9031994 0.9028289 0.9024578 0.9020862 0.9017141 [386] 0.9013414 0.9009683 0.9005946 0.9002204 0.8998457 0.8994706 0.8990949 [393] 0.8987188 0.8983421 0.8979650 0.8975875 0.8972094 0.8968309 0.8964520 [400] 0.8960726 0.8956927 > mx [1] 0.97065 > mxli [1] -1.43 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1zg8h1200496053.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/235pe1200496053.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/381dq1200496053.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/49dgc1200496053.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5n0am1200496053.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > 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/6jbum1200496053.tab") > > system("convert tmp/1zg8h1200496053.ps tmp/1zg8h1200496053.png") > system("convert tmp/235pe1200496053.ps tmp/235pe1200496053.png") > system("convert tmp/381dq1200496053.ps tmp/381dq1200496053.png") > system("convert tmp/49dgc1200496053.ps tmp/49dgc1200496053.png") > system("convert tmp/5n0am1200496053.ps tmp/5n0am1200496053.png") > > > proc.time() user system elapsed 1.290 0.758 1.621