R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(131.6,132.05,132.4,132.57,133.02,133.47,133.66,133.96,134.19,134.93,134.9,135.05,135.16,135.23,135.15,135.12,137.29,137.41,137.44,137.62,137.78,137.98,138.06,138.16,138.28,138.33,138.43,138.44,138.41,138.55,138.64,138.72,138.9,139.02,139.04,139.15,139.3,140.73,141.84,141.95,142.1,142.36,142.58,142.75,142.85,143.03,143.19,143.62,143.89,144.69,147.51,147.78,148.04,148.21,148.29,148.34,148.33,148.38,148.37,148.37) > #'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.9745290 0.9745131 0.9744971 0.9744812 0.9744652 0.9744492 0.9744332 [8] 0.9744171 0.9744010 0.9743849 0.9743688 0.9743526 0.9743364 0.9743202 [15] 0.9743039 0.9742876 0.9742713 0.9742549 0.9742386 0.9742222 0.9742057 [22] 0.9741893 0.9741728 0.9741563 0.9741397 0.9741232 0.9741066 0.9740899 [29] 0.9740733 0.9740566 0.9740399 0.9740232 0.9740064 0.9739896 0.9739728 [36] 0.9739559 0.9739390 0.9739221 0.9739052 0.9738882 0.9738712 0.9738542 [43] 0.9738371 0.9738201 0.9738030 0.9737858 0.9737687 0.9737515 0.9737343 [50] 0.9737170 0.9736997 0.9736824 0.9736651 0.9736477 0.9736304 0.9736129 [57] 0.9735955 0.9735780 0.9735605 0.9735430 0.9735254 0.9735079 0.9734902 [64] 0.9734726 0.9734549 0.9734372 0.9734195 0.9734018 0.9733840 0.9733662 [71] 0.9733483 0.9733305 0.9733126 0.9732947 0.9732767 0.9732587 0.9732407 [78] 0.9732227 0.9732046 0.9731866 0.9731684 0.9731503 0.9731321 0.9731139 [85] 0.9730957 0.9730774 0.9730592 0.9730409 0.9730225 0.9730042 0.9729858 [92] 0.9729673 0.9729489 0.9729304 0.9729119 0.9728934 0.9728748 0.9728562 [99] 0.9728376 0.9728190 0.9728003 0.9727816 0.9727629 0.9727441 0.9727253 [106] 0.9727065 0.9726877 0.9726688 0.9726499 0.9726310 0.9726120 0.9725931 [113] 0.9725741 0.9725550 0.9725360 0.9725169 0.9724978 0.9724786 0.9724594 [120] 0.9724403 0.9724210 0.9724018 0.9723825 0.9723632 0.9723438 0.9723245 [127] 0.9723051 0.9722857 0.9722662 0.9722467 0.9722272 0.9722077 0.9721882 [134] 0.9721686 0.9721490 0.9721293 0.9721097 0.9720900 0.9720702 0.9720505 [141] 0.9720307 0.9720109 0.9719911 0.9719712 0.9719513 0.9719314 0.9719115 [148] 0.9718915 0.9718715 0.9718515 0.9718314 0.9718113 0.9717912 0.9717711 [155] 0.9717509 0.9717308 0.9717105 0.9716903 0.9716700 0.9716497 0.9716294 [162] 0.9716090 0.9715887 0.9715683 0.9715478 0.9715274 0.9715069 0.9714864 [169] 0.9714658 0.9714452 0.9714246 0.9714040 0.9713834 0.9713627 0.9713420 [176] 0.9713212 0.9713005 0.9712797 0.9712589 0.9712380 0.9712171 0.9711963 [183] 0.9711753 0.9711544 0.9711334 0.9711124 0.9710914 0.9710703 0.9710492 [190] 0.9710281 0.9710069 0.9709858 0.9709646 0.9709434 0.9709221 0.9709008 [197] 0.9708795 0.9708582 0.9708368 0.9708154 0.9707940 0.9707726 0.9707511 [204] 0.9707296 0.9707081 0.9706866 0.9706650 0.9706434 0.9706217 0.9706001 [211] 0.9705784 0.9705567 0.9705350 0.9705132 0.9704914 0.9704696 0.9704477 [218] 0.9704259 0.9704040 0.9703821 0.9703601 0.9703381 0.9703161 0.9702941 [225] 0.9702720 0.9702499 0.9702278 0.9702057 0.9701835 0.9701613 0.9701391 [232] 0.9701169 0.9700946 0.9700723 0.9700500 0.9700276 0.9700052 0.9699828 [239] 0.9699604 0.9699379 0.9699154 0.9698929 0.9698704 0.9698478 0.9698252 [246] 0.9698026 0.9697799 0.9697573 0.9697346 0.9697118 0.9696891 0.9696663 [253] 0.9696435 0.9696207 0.9695978 0.9695749 0.9695520 0.9695291 0.9695061 [260] 0.9694831 0.9694601 0.9694370 0.9694140 0.9693909 0.9693677 0.9693446 [267] 0.9693214 0.9692982 0.9692750 0.9692517 0.9692284 0.9692051 0.9691818 [274] 0.9691584 0.9691350 0.9691116 0.9690882 0.9690647 0.9690412 0.9690177 [281] 0.9689941 0.9689705 0.9689469 0.9689233 0.9688997 0.9688760 0.9688523 [288] 0.9688285 0.9688048 0.9687810 0.9687572 0.9687334 0.9687095 0.9686856 [295] 0.9686617 0.9686377 0.9686138 0.9685898 0.9685658 0.9685417 0.9685176 [302] 0.9684935 0.9684694 0.9684453 0.9684211 0.9683969 0.9683727 0.9683484 [309] 0.9683241 0.9682998 0.9682755 0.9682511 0.9682267 0.9682023 0.9681779 [316] 0.9681534 0.9681289 0.9681044 0.9680799 0.9680553 0.9680307 0.9680061 [323] 0.9679814 0.9679568 0.9679321 0.9679073 0.9678826 0.9678578 0.9678330 [330] 0.9678082 0.9677833 0.9677585 0.9677335 0.9677086 0.9676837 0.9676587 [337] 0.9676337 0.9676086 0.9675836 0.9675585 0.9675334 0.9675082 0.9674831 [344] 0.9674579 0.9674327 0.9674074 0.9673822 0.9673569 0.9673316 0.9673062 [351] 0.9672809 0.9672555 0.9672300 0.9672046 0.9671791 0.9671536 0.9671281 [358] 0.9671026 0.9670770 0.9670514 0.9670258 0.9670001 0.9669744 0.9669487 [365] 0.9669230 0.9668973 0.9668715 0.9668457 0.9668198 0.9667940 0.9667681 [372] 0.9667422 0.9667163 0.9666903 0.9666643 0.9666383 0.9666123 0.9665862 [379] 0.9665602 0.9665340 0.9665079 0.9664818 0.9664556 0.9664294 0.9664031 [386] 0.9663769 0.9663506 0.9663243 0.9662979 0.9662716 0.9662452 0.9662188 [393] 0.9661923 0.9661659 0.9661394 0.9661129 0.9660863 0.9660598 0.9660332 [400] 0.9660066 0.9659799 > mx [1] 0.974529 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1wwfw1258143204.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/2s6b51258143204.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/3mjjp1258143204.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/4lrl41258143204.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/5usc61258143204.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/6q41b1258143205.tab") > > system("convert tmp/1wwfw1258143204.ps tmp/1wwfw1258143204.png") > system("convert tmp/2s6b51258143204.ps tmp/2s6b51258143204.png") > system("convert tmp/3mjjp1258143204.ps tmp/3mjjp1258143204.png") > system("convert tmp/4lrl41258143204.ps tmp/4lrl41258143204.png") > system("convert tmp/5usc61258143204.ps tmp/5usc61258143204.png") > > > proc.time() user system elapsed 1.066 0.785 1.288