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(9987,10022,10068,10101,10131,10143,10170,10192,10214,10239,10263,10310,10355,10396,10446,10511,10585,10667) > #'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.9863689 0.9863570 0.9863450 0.9863331 0.9863211 0.9863092 0.9862972 [8] 0.9862852 0.9862732 0.9862612 0.9862492 0.9862372 0.9862252 0.9862132 [15] 0.9862012 0.9861891 0.9861771 0.9861650 0.9861530 0.9861409 0.9861288 [22] 0.9861167 0.9861046 0.9860925 0.9860804 0.9860683 0.9860562 0.9860440 [29] 0.9860319 0.9860197 0.9860076 0.9859954 0.9859833 0.9859711 0.9859589 [36] 0.9859467 0.9859345 0.9859223 0.9859100 0.9858978 0.9858856 0.9858733 [43] 0.9858611 0.9858488 0.9858366 0.9858243 0.9858120 0.9857997 0.9857874 [50] 0.9857751 0.9857628 0.9857505 0.9857382 0.9857258 0.9857135 0.9857011 [57] 0.9856888 0.9856764 0.9856640 0.9856516 0.9856392 0.9856268 0.9856144 [64] 0.9856020 0.9855896 0.9855772 0.9855647 0.9855523 0.9855398 0.9855274 [71] 0.9855149 0.9855024 0.9854899 0.9854774 0.9854649 0.9854524 0.9854399 [78] 0.9854274 0.9854148 0.9854023 0.9853898 0.9853772 0.9853646 0.9853521 [85] 0.9853395 0.9853269 0.9853143 0.9853017 0.9852891 0.9852765 0.9852638 [92] 0.9852512 0.9852386 0.9852259 0.9852133 0.9852006 0.9851879 0.9851752 [99] 0.9851626 0.9851499 0.9851372 0.9851244 0.9851117 0.9850990 0.9850863 [106] 0.9850735 0.9850608 0.9850480 0.9850352 0.9850225 0.9850097 0.9849969 [113] 0.9849841 0.9849713 0.9849585 0.9849457 0.9849328 0.9849200 0.9849072 [120] 0.9848943 0.9848814 0.9848686 0.9848557 0.9848428 0.9848299 0.9848170 [127] 0.9848041 0.9847912 0.9847783 0.9847654 0.9847524 0.9847395 0.9847265 [134] 0.9847136 0.9847006 0.9846876 0.9846746 0.9846616 0.9846486 0.9846356 [141] 0.9846226 0.9846096 0.9845966 0.9845835 0.9845705 0.9845574 0.9845444 [148] 0.9845313 0.9845182 0.9845051 0.9844920 0.9844789 0.9844658 0.9844527 [155] 0.9844396 0.9844264 0.9844133 0.9844002 0.9843870 0.9843738 0.9843607 [162] 0.9843475 0.9843343 0.9843211 0.9843079 0.9842947 0.9842815 0.9842683 [169] 0.9842550 0.9842418 0.9842285 0.9842153 0.9842020 0.9841887 0.9841755 [176] 0.9841622 0.9841489 0.9841356 0.9841223 0.9841090 0.9840956 0.9840823 [183] 0.9840690 0.9840556 0.9840423 0.9840289 0.9840155 0.9840021 0.9839887 [190] 0.9839754 0.9839619 0.9839485 0.9839351 0.9839217 0.9839083 0.9838948 [197] 0.9838814 0.9838679 0.9838544 0.9838410 0.9838275 0.9838140 0.9838005 [204] 0.9837870 0.9837735 0.9837600 0.9837464 0.9837329 0.9837194 0.9837058 [211] 0.9836923 0.9836787 0.9836651 0.9836515 0.9836380 0.9836244 0.9836108 [218] 0.9835971 0.9835835 0.9835699 0.9835563 0.9835426 0.9835290 0.9835153 [225] 0.9835016 0.9834880 0.9834743 0.9834606 0.9834469 0.9834332 0.9834195 [232] 0.9834058 0.9833920 0.9833783 0.9833646 0.9833508 0.9833371 0.9833233 [239] 0.9833095 0.9832957 0.9832819 0.9832681 0.9832543 0.9832405 0.9832267 [246] 0.9832129 0.9831990 0.9831852 0.9831714 0.9831575 0.9831436 0.9831298 [253] 0.9831159 0.9831020 0.9830881 0.9830742 0.9830603 0.9830463 0.9830324 [260] 0.9830185 0.9830045 0.9829906 0.9829766 0.9829627 0.9829487 0.9829347 [267] 0.9829207 0.9829067 0.9828927 0.9828787 0.9828647 0.9828507 0.9828366 [274] 0.9828226 0.9828085 0.9827945 0.9827804 0.9827663 0.9827523 0.9827382 [281] 0.9827241 0.9827100 0.9826958 0.9826817 0.9826676 0.9826535 0.9826393 [288] 0.9826252 0.9826110 0.9825968 0.9825827 0.9825685 0.9825543 0.9825401 [295] 0.9825259 0.9825117 0.9824975 0.9824832 0.9824690 0.9824548 0.9824405 [302] 0.9824263 0.9824120 0.9823977 0.9823834 0.9823692 0.9823549 0.9823406 [309] 0.9823262 0.9823119 0.9822976 0.9822833 0.9822689 0.9822546 0.9822402 [316] 0.9822258 0.9822115 0.9821971 0.9821827 0.9821683 0.9821539 0.9821395 [323] 0.9821251 0.9821107 0.9820962 0.9820818 0.9820673 0.9820529 0.9820384 [330] 0.9820239 0.9820095 0.9819950 0.9819805 0.9819660 0.9819515 0.9819369 [337] 0.9819224 0.9819079 0.9818933 0.9818788 0.9818642 0.9818497 0.9818351 [344] 0.9818205 0.9818059 0.9817913 0.9817767 0.9817621 0.9817475 0.9817329 [351] 0.9817183 0.9817036 0.9816890 0.9816743 0.9816597 0.9816450 0.9816303 [358] 0.9816156 0.9816009 0.9815862 0.9815715 0.9815568 0.9815421 0.9815273 [365] 0.9815126 0.9814979 0.9814831 0.9814683 0.9814536 0.9814388 0.9814240 [372] 0.9814092 0.9813944 0.9813796 0.9813648 0.9813500 0.9813351 0.9813203 [379] 0.9813055 0.9812906 0.9812757 0.9812609 0.9812460 0.9812311 0.9812162 [386] 0.9812013 0.9811864 0.9811715 0.9811566 0.9811417 0.9811267 0.9811118 [393] 0.9810968 0.9810819 0.9810669 0.9810519 0.9810369 0.9810220 0.9810070 [400] 0.9809920 0.9809769 > mx [1] 0.9863689 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1ovbr1226504752.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/2l5oh1226504752.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/3ftim1226504752.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/4l12s1226504752.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/5bi741226504752.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/6snw81226504752.tab") > > system("convert tmp/1ovbr1226504752.ps tmp/1ovbr1226504752.png") > system("convert tmp/2l5oh1226504752.ps tmp/2l5oh1226504752.png") > system("convert tmp/3ftim1226504752.ps tmp/3ftim1226504752.png") > system("convert tmp/4l12s1226504752.ps tmp/4l12s1226504752.png") > system("convert tmp/5bi741226504752.ps tmp/5bi741226504752.png") > > > proc.time() user system elapsed 1.704 1.274 1.951