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(91.25,91.5,91.68,91.81,91.84,91.93,92.08,92.11,92.26,92.28,92.39,92.46,92.82,93.16,93.33,93.51,93.56,93.67,93.76,93.88,94.01,94.21,94.31,94.4,94.9,95.31,95.52,95.68,95.91,95.97,96.15,96.34,96.42,96.54,96.72,96.81,97.19,97.5,97.71,97.86,98.04,98.2,98.25,98.41,98.56,98.62,98.75,98.71,99.05,99.52,99.71,99.8,100.01,99.99,100.12,100.15,100.27,100.42,100.43,100.5,100.95,101.26,101.42,101.68,101.75,101.89,102.07,102.22,102.45,102.62,102.67,102.86,104.78,104.87,105.06,105.14,105.32,105.54,105.68,105.77,106.07,106.03,106.13,106.28,106.61,106.74,107.01,107.1,107.28,107.4,107.59,107.69,107.78) > #'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.9762478 0.9762484 0.9762490 0.9762495 0.9762500 0.9762505 0.9762509 [8] 0.9762512 0.9762515 0.9762518 0.9762520 0.9762522 0.9762524 0.9762525 [15] 0.9762526 0.9762526 0.9762526 0.9762525 0.9762524 0.9762523 0.9762521 [22] 0.9762519 0.9762517 0.9762514 0.9762510 0.9762506 0.9762502 0.9762497 [29] 0.9762492 0.9762487 0.9762481 0.9762475 0.9762468 0.9762461 0.9762453 [36] 0.9762445 0.9762437 0.9762428 0.9762419 0.9762410 0.9762400 0.9762389 [43] 0.9762378 0.9762367 0.9762355 0.9762343 0.9762331 0.9762318 0.9762305 [50] 0.9762291 0.9762277 0.9762262 0.9762247 0.9762232 0.9762216 0.9762200 [57] 0.9762183 0.9762166 0.9762149 0.9762131 0.9762113 0.9762094 0.9762075 [64] 0.9762056 0.9762036 0.9762015 0.9761995 0.9761973 0.9761952 0.9761930 [71] 0.9761907 0.9761885 0.9761861 0.9761838 0.9761814 0.9761789 0.9761764 [78] 0.9761739 0.9761713 0.9761687 0.9761661 0.9761634 0.9761606 0.9761579 [85] 0.9761551 0.9761522 0.9761493 0.9761463 0.9761434 0.9761403 0.9761373 [92] 0.9761342 0.9761310 0.9761278 0.9761246 0.9761213 0.9761180 0.9761146 [99] 0.9761112 0.9761078 0.9761043 0.9761008 0.9760972 0.9760936 0.9760900 [106] 0.9760863 0.9760826 0.9760788 0.9760750 0.9760711 0.9760672 0.9760633 [113] 0.9760593 0.9760553 0.9760513 0.9760472 0.9760430 0.9760388 0.9760346 [120] 0.9760303 0.9760260 0.9760217 0.9760173 0.9760128 0.9760084 0.9760039 [127] 0.9759993 0.9759947 0.9759901 0.9759854 0.9759807 0.9759759 0.9759711 [134] 0.9759662 0.9759613 0.9759564 0.9759514 0.9759464 0.9759414 0.9759363 [141] 0.9759311 0.9759260 0.9759207 0.9759155 0.9759102 0.9759048 0.9758995 [148] 0.9758940 0.9758886 0.9758830 0.9758775 0.9758719 0.9758663 0.9758606 [155] 0.9758549 0.9758491 0.9758433 0.9758375 0.9758316 0.9758257 0.9758197 [162] 0.9758137 0.9758077 0.9758016 0.9757954 0.9757893 0.9757830 0.9757768 [169] 0.9757705 0.9757642 0.9757578 0.9757514 0.9757449 0.9757384 0.9757318 [176] 0.9757253 0.9757186 0.9757120 0.9757053 0.9756985 0.9756917 0.9756849 [183] 0.9756780 0.9756711 0.9756641 0.9756571 0.9756501 0.9756430 0.9756359 [190] 0.9756287 0.9756215 0.9756142 0.9756070 0.9755996 0.9755923 0.9755848 [197] 0.9755774 0.9755699 0.9755624 0.9755548 0.9755472 0.9755395 0.9755318 [204] 0.9755240 0.9755163 0.9755084 0.9755006 0.9754927 0.9754847 0.9754767 [211] 0.9754687 0.9754606 0.9754525 0.9754443 0.9754361 0.9754279 0.9754196 [218] 0.9754113 0.9754029 0.9753945 0.9753861 0.9753776 0.9753691 0.9753605 [225] 0.9753519 0.9753432 0.9753345 0.9753258 0.9753170 0.9753082 0.9752993 [232] 0.9752904 0.9752815 0.9752725 0.9752635 0.9752544 0.9752453 0.9752362 [239] 0.9752270 0.9752178 0.9752085 0.9751992 0.9751898 0.9751804 0.9751710 [246] 0.9751615 0.9751520 0.9751424 0.9751328 0.9751232 0.9751135 0.9751038 [253] 0.9750940 0.9750842 0.9750744 0.9750645 0.9750545 0.9750446 0.9750346 [260] 0.9750245 0.9750144 0.9750043 0.9749941 0.9749839 0.9749736 0.9749633 [267] 0.9749530 0.9749426 0.9749322 0.9749217 0.9749112 0.9749007 0.9748901 [274] 0.9748795 0.9748688 0.9748581 0.9748473 0.9748365 0.9748257 0.9748148 [281] 0.9748039 0.9747930 0.9747820 0.9747709 0.9747598 0.9747487 0.9747376 [288] 0.9747264 0.9747151 0.9747038 0.9746925 0.9746811 0.9746697 0.9746583 [295] 0.9746468 0.9746353 0.9746237 0.9746121 0.9746004 0.9745887 0.9745770 [302] 0.9745652 0.9745534 0.9745416 0.9745297 0.9745177 0.9745057 0.9744937 [309] 0.9744817 0.9744696 0.9744574 0.9744452 0.9744330 0.9744208 0.9744084 [316] 0.9743961 0.9743837 0.9743713 0.9743588 0.9743463 0.9743338 0.9743212 [323] 0.9743085 0.9742959 0.9742832 0.9742704 0.9742576 0.9742448 0.9742319 [330] 0.9742190 0.9742060 0.9741930 0.9741800 0.9741669 0.9741538 0.9741406 [337] 0.9741274 0.9741142 0.9741009 0.9740876 0.9740742 0.9740608 0.9740474 [344] 0.9740339 0.9740204 0.9740068 0.9739932 0.9739795 0.9739659 0.9739521 [351] 0.9739384 0.9739246 0.9739107 0.9738968 0.9738829 0.9738689 0.9738549 [358] 0.9738409 0.9738268 0.9738126 0.9737985 0.9737842 0.9737700 0.9737557 [365] 0.9737414 0.9737270 0.9737126 0.9736981 0.9736836 0.9736691 0.9736545 [372] 0.9736399 0.9736252 0.9736105 0.9735958 0.9735810 0.9735662 0.9735513 [379] 0.9735364 0.9735215 0.9735065 0.9734915 0.9734764 0.9734613 0.9734462 [386] 0.9734310 0.9734158 0.9734005 0.9733852 0.9733699 0.9733545 0.9733391 [393] 0.9733236 0.9733081 0.9732926 0.9732770 0.9732614 0.9732457 0.9732300 [400] 0.9732143 0.9731985 > mx [1] 0.9762526 > mxli [1] -1.85 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/14c4a1194172718.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/2rh5i1194172718.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/3wyup1194172718.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/4o9k11194172719.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/58l1f1194172719.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/6oxlv1194172719.tab") > > system("convert tmp/14c4a1194172718.ps tmp/14c4a1194172718.png") > system("convert tmp/2rh5i1194172718.ps tmp/2rh5i1194172718.png") > system("convert tmp/3wyup1194172718.ps tmp/3wyup1194172718.png") > system("convert tmp/4o9k11194172719.ps tmp/4o9k11194172719.png") > system("convert tmp/58l1f1194172719.ps tmp/58l1f1194172719.png") > > > proc.time() user system elapsed 1.354 0.813 1.598