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(153.24,184.48,191.81,168.19,163.81,190.57,163.81,129.62,173.90,198.76,135.52,179.81,137.05,142.57,187.52,220.48,208.76,210.19,232.57,173.81,218.86,226.76,196.67,237.43,173.14,207.62,234.67,204.10,230.76,210.19,194.76,172.10,221.90,225.24,228.00,198.76,199.05,235.43,270.76,234.10,237.24,239.43,239.24,197.33,217.43,242.19,207.52,232.76,222.10,202.48,228.10,319.52,236.95,252.00,262.29,172.10,243.90,235.62,216.95,236.29) > #'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.5896545 0.5899470 0.5902388 0.5905299 0.5908203 0.5911099 0.5913987 [8] 0.5916869 0.5919743 0.5922609 0.5925469 0.5928320 0.5931164 0.5934000 [15] 0.5936829 0.5939650 0.5942464 0.5945269 0.5948067 0.5950857 0.5953640 [22] 0.5956414 0.5959180 0.5961939 0.5964689 0.5967432 0.5970166 0.5972892 [29] 0.5975611 0.5978321 0.5981022 0.5983716 0.5986401 0.5989078 0.5991747 [36] 0.5994407 0.5997059 0.5999703 0.6002337 0.6004964 0.6007582 0.6010191 [43] 0.6012792 0.6015384 0.6017967 0.6020541 0.6023107 0.6025664 0.6028212 [50] 0.6030752 0.6033282 0.6035803 0.6038316 0.6040819 0.6043313 0.6045799 [57] 0.6048275 0.6050742 0.6053200 0.6055648 0.6058087 0.6060517 0.6062938 [64] 0.6065349 0.6067751 0.6070144 0.6072527 0.6074900 0.6077264 0.6079619 [71] 0.6081963 0.6084299 0.6086624 0.6088940 0.6091246 0.6093542 0.6095828 [78] 0.6098105 0.6100372 0.6102628 0.6104875 0.6107112 0.6109339 0.6111555 [85] 0.6113762 0.6115958 0.6118145 0.6120321 0.6122487 0.6124642 0.6126787 [92] 0.6128922 0.6131047 0.6133161 0.6135265 0.6137358 0.6139441 0.6141513 [99] 0.6143575 0.6145626 0.6147667 0.6149697 0.6151716 0.6153724 0.6155722 [106] 0.6157708 0.6159684 0.6161649 0.6163603 0.6165547 0.6167479 0.6169400 [113] 0.6171310 0.6173210 0.6175098 0.6176974 0.6178840 0.6180695 0.6182538 [120] 0.6184370 0.6186191 0.6188000 0.6189798 0.6191585 0.6193360 0.6195124 [127] 0.6196876 0.6198617 0.6200346 0.6202063 0.6203769 0.6205463 0.6207146 [134] 0.6208817 0.6210476 0.6212123 0.6213759 0.6215382 0.6216994 0.6218594 [141] 0.6220182 0.6221758 0.6223322 0.6224874 0.6226414 0.6227941 0.6229457 [148] 0.6230960 0.6232452 0.6233931 0.6235397 0.6236852 0.6238294 0.6239724 [155] 0.6241141 0.6242546 0.6243939 0.6245319 0.6246687 0.6248042 0.6249384 [162] 0.6250714 0.6252031 0.6253336 0.6254628 0.6255907 0.6257174 0.6258428 [169] 0.6259668 0.6260897 0.6262112 0.6263314 0.6264504 0.6265680 0.6266844 [176] 0.6267994 0.6269132 0.6270256 0.6271367 0.6272466 0.6273551 0.6274623 [183] 0.6275681 0.6276727 0.6277759 0.6278778 0.6279783 0.6280775 0.6281754 [190] 0.6282720 0.6283672 0.6284610 0.6285535 0.6286447 0.6287345 0.6288229 [197] 0.6289100 0.6289957 0.6290801 0.6291631 0.6292447 0.6293249 0.6294038 [204] 0.6294813 0.6295574 0.6296321 0.6297054 0.6297774 0.6298479 0.6299171 [211] 0.6299849 0.6300512 0.6301162 0.6301798 0.6302419 0.6303027 0.6303620 [218] 0.6304199 0.6304764 0.6305315 0.6305851 0.6306374 0.6306882 0.6307375 [225] 0.6307855 0.6308320 0.6308771 0.6309207 0.6309629 0.6310036 0.6310429 [232] 0.6310808 0.6311172 0.6311521 0.6311856 0.6312176 0.6312482 0.6312773 [239] 0.6313050 0.6313311 0.6313558 0.6313791 0.6314008 0.6314211 0.6314399 [246] 0.6314572 0.6314731 0.6314874 0.6315003 0.6315117 0.6315216 0.6315300 [253] 0.6315369 0.6315423 0.6315462 0.6315486 0.6315495 0.6315489 0.6315468 [260] 0.6315431 0.6315380 0.6315313 0.6315232 0.6315135 0.6315023 0.6314896 [267] 0.6314753 0.6314595 0.6314422 0.6314234 0.6314030 0.6313811 0.6313577 [274] 0.6313327 0.6313062 0.6312782 0.6312486 0.6312175 0.6311848 0.6311506 [281] 0.6311148 0.6310775 0.6310386 0.6309982 0.6309562 0.6309127 0.6308676 [288] 0.6308209 0.6307727 0.6307229 0.6306716 0.6306187 0.6305642 0.6305082 [295] 0.6304506 0.6303914 0.6303306 0.6302683 0.6302044 0.6301389 0.6300718 [302] 0.6300032 0.6299329 0.6298611 0.6297877 0.6297127 0.6296362 0.6295580 [309] 0.6294783 0.6293969 0.6293140 0.6292295 0.6291434 0.6290557 0.6289664 [316] 0.6288755 0.6287830 0.6286889 0.6285932 0.6284959 0.6283970 0.6282965 [323] 0.6281944 0.6280907 0.6279854 0.6278785 0.6277700 0.6276598 0.6275481 [330] 0.6274347 0.6273198 0.6272032 0.6270850 0.6269652 0.6268438 0.6267208 [337] 0.6265962 0.6264699 0.6263420 0.6262125 0.6260814 0.6259487 0.6258144 [344] 0.6256784 0.6255409 0.6254017 0.6252609 0.6251184 0.6249744 0.6248287 [351] 0.6246814 0.6245325 0.6243820 0.6242298 0.6240760 0.6239206 0.6237636 [358] 0.6236049 0.6234447 0.6232828 0.6231193 0.6229541 0.6227874 0.6226190 [365] 0.6224490 0.6222773 0.6221041 0.6219292 0.6217527 0.6215746 0.6213948 [372] 0.6212134 0.6210305 0.6208458 0.6206596 0.6204717 0.6202823 0.6200912 [379] 0.6198985 0.6197041 0.6195082 0.6193106 0.6191114 0.6189106 0.6187081 [386] 0.6185041 0.6182984 0.6180911 0.6178822 0.6176717 0.6174596 0.6172458 [393] 0.6170305 0.6168135 0.6165949 0.6163748 0.6161530 0.6159295 0.6157045 [400] 0.6154779 0.6152497 > mx [1] 0.6315495 > mxli [1] 0.56 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1zyq71258141590.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/2l3dp1258141590.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/3cb741258141590.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/453jy1258141590.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/593pg1258141590.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/6cxpb1258141590.tab") > system("convert tmp/1zyq71258141590.ps tmp/1zyq71258141590.png") > system("convert tmp/2l3dp1258141590.ps tmp/2l3dp1258141590.png") > system("convert tmp/3cb741258141590.ps tmp/3cb741258141590.png") > system("convert tmp/453jy1258141590.ps tmp/453jy1258141590.png") > system("convert tmp/593pg1258141590.ps tmp/593pg1258141590.png") > > > proc.time() user system elapsed 1.099 0.790 1.287