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(97.7,101.5,119.6,108.1,117.8,125.5,89.2,92.3,104.6,122.8,96.0,94.6,93.3,101.1,114.2,104.7,113.3,118.2,83.6,73.9,99.5,97.7,103.0,106.3,92.2,101.8,122.8,111.8,106.3,121.5,81.9,85.4,110.9,117.3,106.3,105.5,101.3,105.9,126.3,111.9,108.9,127.2,94.2,85.7,116.2,107.2,110.6,112.0,104.5,112.0,132.8,110.8,128.7,136.8,94.9,88.8,123.2,125.3,122.7,125.7,116.3,118.7,142.0,127.9,131.9,152.3,110.8,99.1,135.0,133.2,131.0,133.9,119.9,136.9,148.9,145.1,142.4,159.6,120.7,109.0,142.0) > #'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.4878830 0.4882408 0.4885983 0.4889553 0.4893120 0.4896682 0.4900239 [8] 0.4903793 0.4907342 0.4910887 0.4914428 0.4917965 0.4921497 0.4925025 [15] 0.4928548 0.4932067 0.4935582 0.4939092 0.4942598 0.4946099 0.4949597 [22] 0.4953089 0.4956577 0.4960061 0.4963540 0.4967014 0.4970484 0.4973950 [29] 0.4977411 0.4980867 0.4984319 0.4987766 0.4991208 0.4994646 0.4998079 [36] 0.5001508 0.5004932 0.5008351 0.5011765 0.5015175 0.5018580 0.5021980 [43] 0.5025375 0.5028766 0.5032151 0.5035532 0.5038908 0.5042280 0.5045646 [50] 0.5049008 0.5052364 0.5055716 0.5059063 0.5062404 0.5065741 0.5069073 [57] 0.5072400 0.5075722 0.5079039 0.5082351 0.5085658 0.5088959 0.5092256 [64] 0.5095548 0.5098834 0.5102116 0.5105392 0.5108663 0.5111929 0.5115190 [71] 0.5118446 0.5121697 0.5124942 0.5128182 0.5131417 0.5134646 0.5137871 [78] 0.5141090 0.5144304 0.5147512 0.5150716 0.5153913 0.5157106 0.5160293 [85] 0.5163475 0.5166651 0.5169823 0.5172988 0.5176149 0.5179303 0.5182453 [92] 0.5185597 0.5188735 0.5191868 0.5194996 0.5198118 0.5201234 0.5204345 [99] 0.5207451 0.5210551 0.5213645 0.5216734 0.5219817 0.5222895 0.5225967 [106] 0.5229033 0.5232094 0.5235149 0.5238198 0.5241242 0.5244280 0.5247312 [113] 0.5250339 0.5253360 0.5256375 0.5259384 0.5262388 0.5265386 0.5268378 [120] 0.5271365 0.5274345 0.5277320 0.5280289 0.5283252 0.5286209 0.5289161 [127] 0.5292106 0.5295046 0.5297980 0.5300908 0.5303830 0.5306746 0.5309656 [134] 0.5312560 0.5315459 0.5318351 0.5321237 0.5324118 0.5326992 0.5329860 [141] 0.5332723 0.5335579 0.5338429 0.5341274 0.5344112 0.5346944 0.5349770 [148] 0.5352590 0.5355404 0.5358212 0.5361013 0.5363809 0.5366598 0.5369382 [155] 0.5372159 0.5374930 0.5377694 0.5380453 0.5383205 0.5385952 0.5388692 [162] 0.5391425 0.5394153 0.5396874 0.5399589 0.5402298 0.5405001 0.5407697 [169] 0.5410387 0.5413071 0.5415748 0.5418420 0.5421084 0.5423743 0.5426395 [176] 0.5429041 0.5431680 0.5434313 0.5436940 0.5439560 0.5442174 0.5444782 [183] 0.5447383 0.5449978 0.5452566 0.5455148 0.5457724 0.5460293 0.5462856 [190] 0.5465412 0.5467961 0.5470505 0.5473041 0.5475572 0.5478095 0.5480613 [197] 0.5483124 0.5485628 0.5488126 0.5490617 0.5493101 0.5495580 0.5498051 [204] 0.5500516 0.5502975 0.5505426 0.5507872 0.5510310 0.5512743 0.5515168 [211] 0.5517587 0.5519999 0.5522405 0.5524804 0.5527196 0.5529582 0.5531961 [218] 0.5534334 0.5536700 0.5539059 0.5541411 0.5543757 0.5546096 0.5548429 [225] 0.5550754 0.5553073 0.5555386 0.5557691 0.5559990 0.5562282 0.5564568 [232] 0.5566847 0.5569119 0.5571384 0.5573642 0.5575894 0.5578139 0.5580377 [239] 0.5582609 0.5584833 0.5587051 0.5589262 0.5591466 0.5593664 0.5595855 [246] 0.5598038 0.5600215 0.5602386 0.5604549 0.5606706 0.5608855 0.5610998 [253] 0.5613134 0.5615263 0.5617386 0.5619501 0.5621610 0.5623712 0.5625807 [260] 0.5627895 0.5629976 0.5632050 0.5634118 0.5636178 0.5638232 0.5640278 [267] 0.5642318 0.5644351 0.5646377 0.5648396 0.5650409 0.5652414 0.5654412 [274] 0.5656404 0.5658388 0.5660366 0.5662336 0.5664300 0.5666257 0.5668206 [281] 0.5670149 0.5672085 0.5674014 0.5675936 0.5677851 0.5679759 0.5681660 [288] 0.5683555 0.5685442 0.5687322 0.5689195 0.5691061 0.5692921 0.5694773 [295] 0.5696618 0.5698456 0.5700288 0.5702112 0.5703929 0.5705740 0.5707543 [302] 0.5709339 0.5711129 0.5712911 0.5714686 0.5716454 0.5718216 0.5719970 [309] 0.5721717 0.5723457 0.5725191 0.5726917 0.5728636 0.5730348 0.5732053 [316] 0.5733751 0.5735442 0.5737126 0.5738803 0.5740473 0.5742136 0.5743792 [323] 0.5745441 0.5747083 0.5748718 0.5750345 0.5751966 0.5753580 0.5755187 [330] 0.5756786 0.5758379 0.5759964 0.5761543 0.5763114 0.5764679 0.5766236 [337] 0.5767786 0.5769329 0.5770866 0.5772395 0.5773917 0.5775432 0.5776940 [344] 0.5778441 0.5779935 0.5781422 0.5782902 0.5784374 0.5785840 0.5787299 [351] 0.5788751 0.5790195 0.5791633 0.5793063 0.5794487 0.5795903 0.5797313 [358] 0.5798715 0.5800110 0.5801499 0.5802880 0.5804254 0.5805621 0.5806981 [365] 0.5808334 0.5809680 0.5811019 0.5812351 0.5813676 0.5814994 0.5816305 [372] 0.5817609 0.5818906 0.5820195 0.5821478 0.5822754 0.5824023 0.5825284 [379] 0.5826539 0.5827787 0.5829027 0.5830261 0.5831488 0.5832707 0.5833920 [386] 0.5835125 0.5836324 0.5837515 0.5838700 0.5839878 0.5841048 0.5842212 [393] 0.5843368 0.5844518 0.5845660 0.5846796 0.5847925 0.5849046 0.5850161 [400] 0.5851269 0.5852369 > mx [1] 0.5852369 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/103g21229010440.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/2n4nc1229010440.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/3wzet1229010440.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/48m1t1229010440.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/5adhz1229010440.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/6m8fb1229010440.tab") > > system("convert tmp/103g21229010440.ps tmp/103g21229010440.png") > system("convert tmp/2n4nc1229010440.ps tmp/2n4nc1229010440.png") > system("convert tmp/3wzet1229010440.ps tmp/3wzet1229010440.png") > system("convert tmp/48m1t1229010440.ps tmp/48m1t1229010440.png") > system("convert tmp/5adhz1229010440.ps tmp/5adhz1229010440.png") > > > proc.time() user system elapsed 1.070 0.774 1.260