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(188.5,188.6,191.9,193.5,194.9,194.9,196.2,196.2,198,198.6,201.3,203.5,204.1,204.8,206.5,207.8,208.6,209.7,210,211.7,212.4,213.7,214.8,216.4,217.5,218.6,220.4,221.8,222.5,223.4,225.5,226.5,227.8,228.5,229.1,229.9,230.8,231.9,236,237.5) > #'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.9817166 0.9817387 0.9817607 0.9817826 0.9818045 0.9818263 0.9818480 [8] 0.9818696 0.9818912 0.9819127 0.9819342 0.9819555 0.9819768 0.9819981 [15] 0.9820192 0.9820403 0.9820613 0.9820823 0.9821031 0.9821239 0.9821447 [22] 0.9821653 0.9821859 0.9822065 0.9822269 0.9822473 0.9822676 0.9822879 [29] 0.9823080 0.9823281 0.9823482 0.9823681 0.9823880 0.9824078 0.9824276 [36] 0.9824473 0.9824669 0.9824864 0.9825059 0.9825253 0.9825446 0.9825639 [43] 0.9825831 0.9826022 0.9826212 0.9826402 0.9826591 0.9826779 0.9826967 [50] 0.9827154 0.9827340 0.9827526 0.9827710 0.9827895 0.9828078 0.9828261 [57] 0.9828443 0.9828624 0.9828804 0.9828984 0.9829163 0.9829342 0.9829519 [64] 0.9829696 0.9829873 0.9830048 0.9830223 0.9830397 0.9830571 0.9830744 [71] 0.9830916 0.9831087 0.9831257 0.9831427 0.9831597 0.9831765 0.9831933 [78] 0.9832100 0.9832266 0.9832432 0.9832597 0.9832761 0.9832924 0.9833087 [85] 0.9833249 0.9833411 0.9833571 0.9833731 0.9833890 0.9834049 0.9834207 [92] 0.9834364 0.9834520 0.9834676 0.9834831 0.9834985 0.9835138 0.9835291 [99] 0.9835443 0.9835595 0.9835745 0.9835895 0.9836045 0.9836193 0.9836341 [106] 0.9836488 0.9836634 0.9836780 0.9836925 0.9837069 0.9837213 0.9837355 [113] 0.9837498 0.9837639 0.9837780 0.9837919 0.9838059 0.9838197 0.9838335 [120] 0.9838472 0.9838608 0.9838744 0.9838879 0.9839013 0.9839147 0.9839279 [127] 0.9839411 0.9839543 0.9839673 0.9839803 0.9839932 0.9840061 0.9840189 [134] 0.9840316 0.9840442 0.9840568 0.9840692 0.9840817 0.9840940 0.9841063 [141] 0.9841185 0.9841306 0.9841427 0.9841546 0.9841666 0.9841784 0.9841902 [148] 0.9842019 0.9842135 0.9842250 0.9842365 0.9842479 0.9842593 0.9842705 [155] 0.9842817 0.9842929 0.9843039 0.9843149 0.9843258 0.9843366 0.9843474 [162] 0.9843581 0.9843687 0.9843792 0.9843897 0.9844001 0.9844105 0.9844207 [169] 0.9844309 0.9844410 0.9844511 0.9844610 0.9844709 0.9844808 0.9844905 [176] 0.9845002 0.9845098 0.9845193 0.9845288 0.9845382 0.9845475 0.9845568 [183] 0.9845659 0.9845751 0.9845841 0.9845930 0.9846019 0.9846108 0.9846195 [190] 0.9846282 0.9846368 0.9846453 0.9846538 0.9846621 0.9846705 0.9846787 [197] 0.9846869 0.9846950 0.9847030 0.9847109 0.9847188 0.9847266 0.9847344 [204] 0.9847420 0.9847496 0.9847571 0.9847646 0.9847719 0.9847793 0.9847865 [211] 0.9847936 0.9848007 0.9848077 0.9848147 0.9848215 0.9848283 0.9848351 [218] 0.9848417 0.9848483 0.9848548 0.9848612 0.9848676 0.9848739 0.9848801 [225] 0.9848863 0.9848923 0.9848983 0.9849043 0.9849101 0.9849159 0.9849216 [232] 0.9849273 0.9849328 0.9849383 0.9849438 0.9849491 0.9849544 0.9849596 [239] 0.9849647 0.9849698 0.9849748 0.9849797 0.9849846 0.9849893 0.9849940 [246] 0.9849987 0.9850032 0.9850077 0.9850121 0.9850165 0.9850207 0.9850249 [253] 0.9850291 0.9850331 0.9850371 0.9850410 0.9850448 0.9850486 0.9850523 [260] 0.9850559 0.9850595 0.9850629 0.9850663 0.9850697 0.9850729 0.9850761 [267] 0.9850792 0.9850823 0.9850852 0.9850881 0.9850910 0.9850937 0.9850964 [274] 0.9850990 0.9851015 0.9851040 0.9851064 0.9851087 0.9851110 0.9851131 [281] 0.9851152 0.9851173 0.9851192 0.9851211 0.9851229 0.9851247 0.9851263 [288] 0.9851279 0.9851295 0.9851309 0.9851323 0.9851336 0.9851348 0.9851360 [295] 0.9851371 0.9851381 0.9851391 0.9851400 0.9851408 0.9851415 0.9851422 [302] 0.9851427 0.9851433 0.9851437 0.9851441 0.9851444 0.9851446 0.9851448 [309] 0.9851448 0.9851449 0.9851448 0.9851447 0.9851445 0.9851442 0.9851438 [316] 0.9851434 0.9851429 0.9851424 0.9851417 0.9851410 0.9851402 0.9851394 [323] 0.9851385 0.9851375 0.9851364 0.9851353 0.9851341 0.9851328 0.9851314 [330] 0.9851300 0.9851285 0.9851269 0.9851253 0.9851236 0.9851218 0.9851199 [337] 0.9851180 0.9851160 0.9851139 0.9851118 0.9851096 0.9851073 0.9851049 [344] 0.9851025 0.9851000 0.9850974 0.9850947 0.9850920 0.9850892 0.9850864 [351] 0.9850834 0.9850804 0.9850774 0.9850742 0.9850710 0.9850677 0.9850643 [358] 0.9850609 0.9850574 0.9850538 0.9850501 0.9850464 0.9850426 0.9850388 [365] 0.9850348 0.9850308 0.9850267 0.9850226 0.9850184 0.9850141 0.9850097 [372] 0.9850053 0.9850007 0.9849962 0.9849915 0.9849868 0.9849820 0.9849771 [379] 0.9849722 0.9849672 0.9849621 0.9849569 0.9849517 0.9849464 0.9849410 [386] 0.9849356 0.9849301 0.9849245 0.9849189 0.9849131 0.9849073 0.9849015 [393] 0.9848955 0.9848895 0.9848834 0.9848773 0.9848711 0.9848648 0.9848584 [400] 0.9848520 0.9848455 > mx [1] 0.9851449 > mxli [1] 1.09 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/182oc1229253050.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/2ri4d1229253050.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/3ked11229253050.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/4j8jz1229253050.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/5w23z1229253050.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/6cqub1229253050.tab") > > system("convert tmp/182oc1229253050.ps tmp/182oc1229253050.png") > system("convert tmp/2ri4d1229253050.ps tmp/2ri4d1229253050.png") > system("convert tmp/3ked11229253050.ps tmp/3ked11229253050.png") > system("convert tmp/4j8jz1229253050.ps tmp/4j8jz1229253050.png") > system("convert tmp/5w23z1229253050.ps tmp/5w23z1229253050.png") > > > proc.time() user system elapsed 1.095 0.800 1.427