R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(513,503,471,471,476,475,470,461,455,456,517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.5721444 0.5720789 0.5720133 0.5719475 0.5718815 0.5718154 0.5717491 [8] 0.5716827 0.5716161 0.5715493 0.5714824 0.5714154 0.5713481 0.5712808 [15] 0.5712132 0.5711455 0.5710777 0.5710097 0.5709415 0.5708732 0.5708047 [22] 0.5707361 0.5706673 0.5705984 0.5705293 0.5704601 0.5703907 0.5703211 [29] 0.5702514 0.5701815 0.5701115 0.5700413 0.5699710 0.5699005 0.5698298 [36] 0.5697590 0.5696881 0.5696170 0.5695457 0.5694743 0.5694027 0.5693310 [43] 0.5692591 0.5691871 0.5691149 0.5690426 0.5689701 0.5688974 0.5688246 [50] 0.5687517 0.5686786 0.5686053 0.5685319 0.5684583 0.5683846 0.5683108 [57] 0.5682367 0.5681626 0.5680882 0.5680137 0.5679391 0.5678643 0.5677894 [64] 0.5677143 0.5676391 0.5675637 0.5674881 0.5674124 0.5673366 0.5672606 [71] 0.5671844 0.5671081 0.5670317 0.5669551 0.5668783 0.5668014 0.5667244 [78] 0.5666472 0.5665698 0.5664923 0.5664147 0.5663369 0.5662589 0.5661808 [85] 0.5661025 0.5660241 0.5659456 0.5658669 0.5657880 0.5657090 0.5656299 [92] 0.5655506 0.5654711 0.5653915 0.5653118 0.5652319 0.5651519 0.5650717 [99] 0.5649913 0.5649109 0.5648302 0.5647494 0.5646685 0.5645874 0.5645062 [106] 0.5644249 0.5643433 0.5642617 0.5641799 0.5640979 0.5640158 0.5639335 [113] 0.5638512 0.5637686 0.5636859 0.5636031 0.5635201 0.5634370 0.5633537 [120] 0.5632703 0.5631867 0.5631030 0.5630192 0.5629352 0.5628510 0.5627667 [127] 0.5626823 0.5625977 0.5625130 0.5624281 0.5623431 0.5622580 0.5621727 [134] 0.5620872 0.5620016 0.5619159 0.5618300 0.5617440 0.5616579 0.5615716 [141] 0.5614851 0.5613985 0.5613118 0.5612249 0.5611379 0.5610508 0.5609635 [148] 0.5608760 0.5607884 0.5607007 0.5606128 0.5605248 0.5604367 0.5603484 [155] 0.5602600 0.5601714 0.5600827 0.5599938 0.5599048 0.5598157 0.5597264 [162] 0.5596370 0.5595475 0.5594578 0.5593680 0.5592780 0.5591879 0.5590976 [169] 0.5590072 0.5589167 0.5588260 0.5587352 0.5586443 0.5585532 0.5584620 [176] 0.5583706 0.5582791 0.5581875 0.5580957 0.5580038 0.5579118 0.5578196 [183] 0.5577273 0.5576348 0.5575422 0.5574495 0.5573567 0.5572637 0.5571705 [190] 0.5570772 0.5569838 0.5568903 0.5567966 0.5567028 0.5566088 0.5565148 [197] 0.5564205 0.5563262 0.5562317 0.5561371 0.5560423 0.5559474 0.5558524 [204] 0.5557572 0.5556619 0.5555665 0.5554710 0.5553753 0.5552794 0.5551835 [211] 0.5550874 0.5549912 0.5548948 0.5547983 0.5547017 0.5546049 0.5545081 [218] 0.5544110 0.5543139 0.5542166 0.5541192 0.5540217 0.5539240 0.5538262 [225] 0.5537283 0.5536302 0.5535320 0.5534337 0.5533352 0.5532366 0.5531379 [232] 0.5530391 0.5529401 0.5528410 0.5527418 0.5526424 0.5525429 0.5524433 [239] 0.5523436 0.5522437 0.5521437 0.5520436 0.5519433 0.5518429 0.5517424 [246] 0.5516418 0.5515410 0.5514402 0.5513391 0.5512380 0.5511367 0.5510353 [253] 0.5509338 0.5508322 0.5507304 0.5506285 0.5505265 0.5504243 0.5503220 [260] 0.5502197 0.5501171 0.5500145 0.5499117 0.5498088 0.5497058 0.5496027 [267] 0.5494994 0.5493960 0.5492925 0.5491889 0.5490851 0.5489812 0.5488772 [274] 0.5487731 0.5486688 0.5485645 0.5484600 0.5483554 0.5482506 0.5481458 [281] 0.5480408 0.5479357 0.5478305 0.5477251 0.5476197 0.5475141 0.5474084 [288] 0.5473026 0.5471966 0.5470906 0.5469844 0.5468781 0.5467717 0.5466652 [295] 0.5465585 0.5464517 0.5463448 0.5462378 0.5461307 0.5460235 0.5459161 [302] 0.5458086 0.5457010 0.5455933 0.5454855 0.5453775 0.5452695 0.5451613 [309] 0.5450530 0.5449446 0.5448360 0.5447274 0.5446186 0.5445098 0.5444008 [316] 0.5442917 0.5441825 0.5440731 0.5439637 0.5438541 0.5437444 0.5436347 [323] 0.5435248 0.5434147 0.5433046 0.5431944 0.5430840 0.5429735 0.5428630 [330] 0.5427523 0.5426415 0.5425305 0.5424195 0.5423084 0.5421971 0.5420858 [337] 0.5419743 0.5418627 0.5417510 0.5416392 0.5415273 0.5414153 0.5413031 [344] 0.5411909 0.5410785 0.5409661 0.5408535 0.5407408 0.5406280 0.5405151 [351] 0.5404021 0.5402890 0.5401758 0.5400625 0.5399490 0.5398355 0.5397218 [358] 0.5396081 0.5394942 0.5393802 0.5392661 0.5391519 0.5390377 0.5389233 [365] 0.5388088 0.5386941 0.5385794 0.5384646 0.5383497 0.5382347 0.5381195 [372] 0.5380043 0.5378889 0.5377735 0.5376579 0.5375423 0.5374265 0.5373107 [379] 0.5371947 0.5370786 0.5369625 0.5368462 0.5367298 0.5366133 0.5364968 [386] 0.5363801 0.5362633 0.5361464 0.5360294 0.5359124 0.5357952 0.5356779 [393] 0.5355605 0.5354430 0.5353254 0.5352078 0.5350900 0.5349721 0.5348541 [400] 0.5347360 0.5346178 > mx [1] 0.5721444 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/15c6i1194257368.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/2p5ab1194257368.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/3mbt01194257368.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/4q7r81194257368.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5mg4j1194257368.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > 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/6b3s41194257368.tab") > > system("convert tmp/15c6i1194257368.ps tmp/15c6i1194257368.png") > system("convert tmp/2p5ab1194257368.ps tmp/2p5ab1194257368.png") > system("convert tmp/3mbt01194257368.ps tmp/3mbt01194257368.png") > system("convert tmp/4q7r81194257368.ps tmp/4q7r81194257368.png") > system("convert tmp/5mg4j1194257368.ps tmp/5mg4j1194257368.png") > > > proc.time() user system elapsed 1.360 0.831 1.628