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(100.00,99.97,101.03,101.00,101.30,101.43,101.49,102.14,102.58,102.34,102.07,101.83,102.14,102.58,102.63,102.74,103.32,103.27,102.48,102.14,102.07,101.69,101.15,100.90,101.77,101.93,102.27,102.49,102.80,102.82,102.83,102.89,102.87,102.67,102.96,103.22,103.53,104.63,104.63,104.17,103.93,104.01,104.16,105.22,105.85,106.21,105.77,105.63,106.49,107.51,110.43,111.42,111.58,111.34,111.08,111.66,112.36,112.31,111.52,110.87,111.13,112.71,113.25,113.09,112.55,112.87,113.59,115.14,116.38,116.50,116.25,116.73) > #'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.9110799 0.9110597 0.9110395 0.9110194 0.9109992 0.9109789 0.9109587 [8] 0.9109385 0.9109182 0.9108980 0.9108777 0.9108574 0.9108371 0.9108168 [15] 0.9107965 0.9107761 0.9107558 0.9107354 0.9107151 0.9106947 0.9106743 [22] 0.9106539 0.9106335 0.9106130 0.9105926 0.9105721 0.9105517 0.9105312 [29] 0.9105107 0.9104902 0.9104697 0.9104491 0.9104286 0.9104080 0.9103875 [36] 0.9103669 0.9103463 0.9103257 0.9103051 0.9102845 0.9102638 0.9102432 [43] 0.9102225 0.9102019 0.9101812 0.9101605 0.9101398 0.9101190 0.9100983 [50] 0.9100776 0.9100568 0.9100360 0.9100152 0.9099944 0.9099736 0.9099528 [57] 0.9099320 0.9099111 0.9098903 0.9098694 0.9098485 0.9098276 0.9098067 [64] 0.9097858 0.9097649 0.9097440 0.9097230 0.9097020 0.9096811 0.9096601 [71] 0.9096391 0.9096180 0.9095970 0.9095760 0.9095549 0.9095339 0.9095128 [78] 0.9094917 0.9094706 0.9094495 0.9094284 0.9094072 0.9093861 0.9093649 [85] 0.9093438 0.9093226 0.9093014 0.9092802 0.9092589 0.9092377 0.9092165 [92] 0.9091952 0.9091739 0.9091527 0.9091314 0.9091101 0.9090887 0.9090674 [99] 0.9090461 0.9090247 0.9090033 0.9089820 0.9089606 0.9089392 0.9089178 [106] 0.9088963 0.9088749 0.9088534 0.9088320 0.9088105 0.9087890 0.9087675 [113] 0.9087460 0.9087245 0.9087029 0.9086814 0.9086598 0.9086382 0.9086167 [120] 0.9085951 0.9085735 0.9085518 0.9085302 0.9085085 0.9084869 0.9084652 [127] 0.9084435 0.9084218 0.9084001 0.9083784 0.9083567 0.9083349 0.9083132 [134] 0.9082914 0.9082696 0.9082478 0.9082260 0.9082042 0.9081824 0.9081605 [141] 0.9081387 0.9081168 0.9080949 0.9080730 0.9080511 0.9080292 0.9080073 [148] 0.9079854 0.9079634 0.9079414 0.9079195 0.9078975 0.9078755 0.9078535 [155] 0.9078314 0.9078094 0.9077873 0.9077653 0.9077432 0.9077211 0.9076990 [162] 0.9076769 0.9076548 0.9076327 0.9076105 0.9075884 0.9075662 0.9075440 [169] 0.9075218 0.9074996 0.9074774 0.9074551 0.9074329 0.9074106 0.9073884 [176] 0.9073661 0.9073438 0.9073215 0.9072992 0.9072768 0.9072545 0.9072321 [183] 0.9072098 0.9071874 0.9071650 0.9071426 0.9071202 0.9070977 0.9070753 [190] 0.9070528 0.9070304 0.9070079 0.9069854 0.9069629 0.9069404 0.9069179 [197] 0.9068953 0.9068728 0.9068502 0.9068276 0.9068051 0.9067825 0.9067598 [204] 0.9067372 0.9067146 0.9066919 0.9066693 0.9066466 0.9066239 0.9066012 [211] 0.9065785 0.9065558 0.9065330 0.9065103 0.9064875 0.9064648 0.9064420 [218] 0.9064192 0.9063964 0.9063736 0.9063507 0.9063279 0.9063050 0.9062821 [225] 0.9062593 0.9062364 0.9062135 0.9061905 0.9061676 0.9061447 0.9061217 [232] 0.9060987 0.9060758 0.9060528 0.9060298 0.9060067 0.9059837 0.9059607 [239] 0.9059376 0.9059145 0.9058915 0.9058684 0.9058453 0.9058222 0.9057990 [246] 0.9057759 0.9057527 0.9057296 0.9057064 0.9056832 0.9056600 0.9056368 [253] 0.9056136 0.9055903 0.9055671 0.9055438 0.9055205 0.9054972 0.9054739 [260] 0.9054506 0.9054273 0.9054040 0.9053806 0.9053573 0.9053339 0.9053105 [267] 0.9052871 0.9052637 0.9052403 0.9052168 0.9051934 0.9051699 0.9051464 [274] 0.9051230 0.9050995 0.9050759 0.9050524 0.9050289 0.9050053 0.9049818 [281] 0.9049582 0.9049346 0.9049110 0.9048874 0.9048638 0.9048402 0.9048165 [288] 0.9047929 0.9047692 0.9047455 0.9047218 0.9046981 0.9046744 0.9046507 [295] 0.9046269 0.9046031 0.9045794 0.9045556 0.9045318 0.9045080 0.9044842 [302] 0.9044603 0.9044365 0.9044126 0.9043888 0.9043649 0.9043410 0.9043171 [309] 0.9042932 0.9042693 0.9042453 0.9042214 0.9041974 0.9041734 0.9041494 [316] 0.9041254 0.9041014 0.9040774 0.9040533 0.9040293 0.9040052 0.9039811 [323] 0.9039570 0.9039329 0.9039088 0.9038847 0.9038605 0.9038364 0.9038122 [330] 0.9037880 0.9037639 0.9037397 0.9037154 0.9036912 0.9036670 0.9036427 [337] 0.9036185 0.9035942 0.9035699 0.9035456 0.9035213 0.9034969 0.9034726 [344] 0.9034483 0.9034239 0.9033995 0.9033751 0.9033507 0.9033263 0.9033019 [351] 0.9032774 0.9032530 0.9032285 0.9032041 0.9031796 0.9031551 0.9031305 [358] 0.9031060 0.9030815 0.9030569 0.9030324 0.9030078 0.9029832 0.9029586 [365] 0.9029340 0.9029094 0.9028847 0.9028601 0.9028354 0.9028107 0.9027861 [372] 0.9027614 0.9027366 0.9027119 0.9026872 0.9026624 0.9026377 0.9026129 [379] 0.9025881 0.9025633 0.9025385 0.9025137 0.9024888 0.9024640 0.9024391 [386] 0.9024142 0.9023894 0.9023645 0.9023395 0.9023146 0.9022897 0.9022647 [393] 0.9022398 0.9022148 0.9021898 0.9021648 0.9021398 0.9021148 0.9020897 [400] 0.9020647 0.9020396 > mx [1] 0.9110799 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/115nu1258052524.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/2ize01258052524.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/31c9b1258052524.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/4aq741258052524.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/5j72g1258052524.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/6kx3d1258052524.tab") > > system("convert tmp/115nu1258052524.ps tmp/115nu1258052524.png") > system("convert tmp/2ize01258052524.ps tmp/2ize01258052524.png") > system("convert tmp/31c9b1258052524.ps tmp/31c9b1258052524.png") > system("convert tmp/4aq741258052524.ps tmp/4aq741258052524.png") > system("convert tmp/5j72g1258052524.ps tmp/5j72g1258052524.png") > > > proc.time() user system elapsed 1.113 0.804 1.315