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,108.16,114.02,102.19,110.37,96.86,94.19,99.52,94.06,97.55,78.15,81.24,92.36,96.06,114.05,110.66,104.92,90.00,95.70,86.03,84.85,100.04,80.92,74.07,77.30,97.23,90.76,100.56,92.01,99.24,105.87,90.99,93.31,91.17,77.33,91.13,85.01,83.90,104.86,110.90,95.44,111.62,108.89,96.18,101.97,99.12,86.78,118.42,118.74,106.53,134.78,104.68,105.30,139.41,103.61,99.78,103.46,120.06,96.71,107.13,105.36,111.69,132.05,126.80,154.48,141.56,109.95,127.90,133.09,120.08,117.56,143.04) > #'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.4728297 0.4731540 0.4734779 0.4738016 0.4741249 0.4744479 0.4747706 [8] 0.4750930 0.4754150 0.4757367 0.4760581 0.4763791 0.4766998 0.4770202 [15] 0.4773402 0.4776599 0.4779793 0.4782983 0.4786169 0.4789352 0.4792532 [22] 0.4795708 0.4798880 0.4802049 0.4805214 0.4808375 0.4811533 0.4814687 [29] 0.4817838 0.4820984 0.4824127 0.4827267 0.4830402 0.4833533 0.4836661 [36] 0.4839785 0.4842905 0.4846021 0.4849133 0.4852241 0.4855345 0.4858445 [43] 0.4861541 0.4864633 0.4867721 0.4870805 0.4873885 0.4876961 0.4880032 [50] 0.4883099 0.4886162 0.4889221 0.4892276 0.4895326 0.4898372 0.4901414 [57] 0.4904451 0.4907484 0.4910513 0.4913537 0.4916557 0.4919572 0.4922583 [64] 0.4925589 0.4928591 0.4931588 0.4934581 0.4937569 0.4940553 0.4943532 [71] 0.4946506 0.4949475 0.4952440 0.4955400 0.4958356 0.4961307 0.4964252 [78] 0.4967193 0.4970130 0.4973061 0.4975988 0.4978909 0.4981826 0.4984738 [85] 0.4987645 0.4990547 0.4993443 0.4996335 0.4999222 0.5002104 0.5004980 [92] 0.5007852 0.5010718 0.5013580 0.5016436 0.5019287 0.5022132 0.5024973 [99] 0.5027808 0.5030638 0.5033462 0.5036282 0.5039096 0.5041904 0.5044708 [106] 0.5047505 0.5050298 0.5053085 0.5055866 0.5058642 0.5061413 0.5064178 [113] 0.5066937 0.5069691 0.5072439 0.5075182 0.5077919 0.5080650 0.5083376 [120] 0.5086096 0.5088811 0.5091519 0.5094222 0.5096919 0.5099611 0.5102296 [127] 0.5104976 0.5107650 0.5110317 0.5112980 0.5115636 0.5118286 0.5120930 [134] 0.5123569 0.5126201 0.5128827 0.5131448 0.5134062 0.5136670 0.5139272 [141] 0.5141868 0.5144458 0.5147042 0.5149620 0.5152191 0.5154756 0.5157315 [148] 0.5159868 0.5162415 0.5164955 0.5167489 0.5170017 0.5172538 0.5175053 [155] 0.5177562 0.5180064 0.5182560 0.5185050 0.5187533 0.5190009 0.5192480 [162] 0.5194943 0.5197400 0.5199851 0.5202295 0.5204733 0.5207164 0.5209588 [169] 0.5212006 0.5214417 0.5216822 0.5219219 0.5221611 0.5223995 0.5226373 [176] 0.5228744 0.5231108 0.5233466 0.5235817 0.5238161 0.5240498 0.5242828 [183] 0.5245152 0.5247469 0.5249778 0.5252081 0.5254377 0.5256667 0.5258949 [190] 0.5261224 0.5263492 0.5265753 0.5268008 0.5270255 0.5272495 0.5274728 [197] 0.5276955 0.5279174 0.5281386 0.5283590 0.5285788 0.5287979 0.5290162 [204] 0.5292339 0.5294508 0.5296670 0.5298824 0.5300972 0.5303112 0.5305245 [211] 0.5307371 0.5309490 0.5311601 0.5313705 0.5315801 0.5317891 0.5319973 [218] 0.5322047 0.5324114 0.5326174 0.5328227 0.5330272 0.5332309 0.5334340 [225] 0.5336362 0.5338378 0.5340385 0.5342386 0.5344378 0.5346364 0.5348342 [232] 0.5350312 0.5352275 0.5354230 0.5356177 0.5358117 0.5360050 0.5361974 [239] 0.5363892 0.5365801 0.5367703 0.5369597 0.5371484 0.5373363 0.5375234 [246] 0.5377098 0.5378954 0.5380802 0.5382642 0.5384475 0.5386300 0.5388117 [253] 0.5389927 0.5391728 0.5393522 0.5395308 0.5397087 0.5398857 0.5400620 [260] 0.5402374 0.5404121 0.5405861 0.5407592 0.5409315 0.5411031 0.5412738 [267] 0.5414438 0.5416130 0.5417814 0.5419490 0.5421158 0.5422818 0.5424470 [274] 0.5426114 0.5427750 0.5429379 0.5430999 0.5432611 0.5434215 0.5435812 [281] 0.5437400 0.5438980 0.5440552 0.5442117 0.5443673 0.5445221 0.5446761 [288] 0.5448293 0.5449817 0.5451333 0.5452841 0.5454340 0.5455832 0.5457315 [295] 0.5458791 0.5460258 0.5461717 0.5463168 0.5464611 0.5466046 0.5467473 [302] 0.5468891 0.5470302 0.5471704 0.5473098 0.5474484 0.5475861 0.5477231 [309] 0.5478592 0.5479945 0.5481290 0.5482627 0.5483956 0.5485276 0.5486588 [316] 0.5487892 0.5489188 0.5490476 0.5491755 0.5493026 0.5494289 0.5495544 [323] 0.5496790 0.5498028 0.5499258 0.5500480 0.5501694 0.5502899 0.5504096 [330] 0.5505284 0.5506465 0.5507637 0.5508801 0.5509957 0.5511104 0.5512243 [337] 0.5513374 0.5514497 0.5515611 0.5516717 0.5517815 0.5518904 0.5519985 [344] 0.5521058 0.5522123 0.5523179 0.5524227 0.5525267 0.5526299 0.5527322 [351] 0.5528337 0.5529343 0.5530342 0.5531332 0.5532313 0.5533287 0.5534252 [358] 0.5535209 0.5536158 0.5537098 0.5538030 0.5538954 0.5539869 0.5540776 [365] 0.5541675 0.5542566 0.5543448 0.5544322 0.5545188 0.5546046 0.5546895 [372] 0.5547736 0.5548568 0.5549393 0.5550209 0.5551017 0.5551816 0.5552608 [379] 0.5553391 0.5554165 0.5554932 0.5555690 0.5556440 0.5557182 0.5557915 [386] 0.5558641 0.5559358 0.5560066 0.5560767 0.5561459 0.5562143 0.5562819 [393] 0.5563486 0.5564146 0.5564797 0.5565440 0.5566075 0.5566701 0.5567319 [400] 0.5567929 0.5568531 > mx [1] 0.5568531 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1k2ff1257864322.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/2jo1j1257864322.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/359141257864322.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/49eg11257864322.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/5jwpi1257864322.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/64yzy1257864322.tab") > > system("convert tmp/1k2ff1257864322.ps tmp/1k2ff1257864322.png") > system("convert tmp/2jo1j1257864322.ps tmp/2jo1j1257864322.png") > system("convert tmp/359141257864322.ps tmp/359141257864322.png") > system("convert tmp/49eg11257864322.ps tmp/49eg11257864322.png") > system("convert tmp/5jwpi1257864322.ps tmp/5jwpi1257864322.png") > > > proc.time() user system elapsed 1.005 0.692 1.441