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(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.9759973 0.9759851 0.9759727 0.9759605 0.9759482 0.9759359 0.9759236 [8] 0.9759113 0.9758989 0.9758866 0.9758743 0.9758620 0.9758496 0.9758373 [15] 0.9758249 0.9758126 0.9758002 0.9757878 0.9757755 0.9757631 0.9757507 [22] 0.9757383 0.9757259 0.9757136 0.9757012 0.9756887 0.9756763 0.9756639 [29] 0.9756515 0.9756391 0.9756266 0.9756142 0.9756018 0.9755893 0.9755769 [36] 0.9755644 0.9755520 0.9755395 0.9755270 0.9755145 0.9755021 0.9754896 [43] 0.9754771 0.9754646 0.9754521 0.9754396 0.9754270 0.9754145 0.9754020 [50] 0.9753895 0.9753769 0.9753644 0.9753519 0.9753393 0.9753268 0.9753142 [57] 0.9753016 0.9752891 0.9752765 0.9752639 0.9752513 0.9752387 0.9752261 [64] 0.9752135 0.9752009 0.9751883 0.9751757 0.9751631 0.9751505 0.9751378 [71] 0.9751252 0.9751125 0.9750999 0.9750872 0.9750746 0.9750619 0.9750493 [78] 0.9750366 0.9750239 0.9750112 0.9749985 0.9749858 0.9749731 0.9749604 [85] 0.9749477 0.9749350 0.9749223 0.9749096 0.9748968 0.9748841 0.9748714 [92] 0.9748586 0.9748459 0.9748331 0.9748204 0.9748076 0.9747948 0.9747820 [99] 0.9747693 0.9747565 0.9747437 0.9747309 0.9747181 0.9747053 0.9746925 [106] 0.9746797 0.9746668 0.9746540 0.9746412 0.9746283 0.9746155 0.9746026 [113] 0.9745898 0.9745769 0.9745641 0.9745512 0.9745383 0.9745255 0.9745126 [120] 0.9744997 0.9744868 0.9744739 0.9744610 0.9744481 0.9744352 0.9744222 [127] 0.9744093 0.9743964 0.9743835 0.9743705 0.9743576 0.9743446 0.9743317 [134] 0.9743187 0.9743057 0.9742928 0.9742798 0.9742668 0.9742538 0.9742408 [141] 0.9742278 0.9742148 0.9742018 0.9741888 0.9741758 0.9741628 0.9741497 [148] 0.9741367 0.9741237 0.9741106 0.9740976 0.9740845 0.9740715 0.9740584 [155] 0.9740453 0.9740323 0.9740192 0.9740061 0.9739930 0.9739799 0.9739668 [162] 0.9739537 0.9739406 0.9739275 0.9739144 0.9739013 0.9738881 0.9738750 [169] 0.9738618 0.9738487 0.9738356 0.9738224 0.9738092 0.9737961 0.9737829 [176] 0.9737697 0.9737565 0.9737434 0.9737302 0.9737170 0.9737038 0.9736906 [183] 0.9736773 0.9736641 0.9736509 0.9736377 0.9736245 0.9736112 0.9735980 [190] 0.9735847 0.9735715 0.9735582 0.9735449 0.9735317 0.9735184 0.9735051 [197] 0.9734918 0.9734786 0.9734653 0.9734520 0.9734387 0.9734254 0.9734120 [204] 0.9733987 0.9733854 0.9733721 0.9733587 0.9733454 0.9733320 0.9733187 [211] 0.9733053 0.9732920 0.9732786 0.9732652 0.9732519 0.9732385 0.9732251 [218] 0.9732117 0.9731983 0.9731849 0.9731715 0.9731581 0.9731447 0.9731313 [225] 0.9731178 0.9731044 0.9730910 0.9730775 0.9730641 0.9730506 0.9730372 [232] 0.9730237 0.9730102 0.9729968 0.9729833 0.9729698 0.9729563 0.9729428 [239] 0.9729293 0.9729158 0.9729023 0.9728888 0.9728753 0.9728618 0.9728482 [246] 0.9728347 0.9728211 0.9728076 0.9727941 0.9727805 0.9727669 0.9727534 [253] 0.9727398 0.9727262 0.9727127 0.9726991 0.9726855 0.9726719 0.9726583 [260] 0.9726447 0.9726311 0.9726175 0.9726038 0.9725902 0.9725766 0.9725629 [267] 0.9725493 0.9725356 0.9725220 0.9725083 0.9724947 0.9724810 0.9724673 [274] 0.9724537 0.9724400 0.9724263 0.9724126 0.9723989 0.9723852 0.9723715 [281] 0.9723578 0.9723441 0.9723303 0.9723166 0.9723029 0.9722891 0.9722754 [288] 0.9722617 0.9722479 0.9722341 0.9722204 0.9722066 0.9721928 0.9721791 [295] 0.9721653 0.9721515 0.9721377 0.9721239 0.9721101 0.9720963 0.9720825 [302] 0.9720686 0.9720548 0.9720410 0.9720272 0.9720133 0.9719995 0.9719856 [309] 0.9719718 0.9719579 0.9719440 0.9719302 0.9719163 0.9719024 0.9718885 [316] 0.9718746 0.9718607 0.9718468 0.9718329 0.9718190 0.9718051 0.9717912 [323] 0.9717773 0.9717633 0.9717494 0.9717354 0.9717215 0.9717075 0.9716936 [330] 0.9716796 0.9716657 0.9716517 0.9716377 0.9716237 0.9716097 0.9715957 [337] 0.9715818 0.9715677 0.9715537 0.9715397 0.9715257 0.9715117 0.9714977 [344] 0.9714836 0.9714696 0.9714555 0.9714415 0.9714274 0.9714134 0.9713993 [351] 0.9713853 0.9713712 0.9713571 0.9713430 0.9713289 0.9713148 0.9713007 [358] 0.9712866 0.9712725 0.9712584 0.9712443 0.9712302 0.9712160 0.9712019 [365] 0.9711878 0.9711736 0.9711595 0.9711453 0.9711311 0.9711170 0.9711028 [372] 0.9710886 0.9710745 0.9710603 0.9710461 0.9710319 0.9710177 0.9710035 [379] 0.9709893 0.9709750 0.9709608 0.9709466 0.9709324 0.9709181 0.9709039 [386] 0.9708896 0.9708754 0.9708611 0.9708469 0.9708326 0.9708183 0.9708041 [393] 0.9707898 0.9707755 0.9707612 0.9707469 0.9707326 0.9707183 0.9707040 [400] 0.9706897 0.9706753 > mx [1] 0.9759973 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1421r1226417499.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/2hojo1226417499.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/3ve7q1226417499.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/45npz1226417499.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/5ltq61226417499.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/62cwf1226417499.tab") > > system("convert tmp/1421r1226417499.ps tmp/1421r1226417499.png") > system("convert tmp/2hojo1226417499.ps tmp/2hojo1226417499.png") > system("convert tmp/3ve7q1226417499.ps tmp/3ve7q1226417499.png") > system("convert tmp/45npz1226417499.ps tmp/45npz1226417499.png") > system("convert tmp/5ltq61226417499.ps tmp/5ltq61226417499.png") > > > proc.time() user system elapsed 1.685 1.275 2.256