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(9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3,8.2) > #'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.5214806 -0.5216845 -0.5218883 -0.5220920 -0.5222956 -0.5224991 [7] -0.5227025 -0.5229059 -0.5231091 -0.5233122 -0.5235152 -0.5237180 [13] -0.5239208 -0.5241235 -0.5243261 -0.5245286 -0.5247310 -0.5249332 [19] -0.5251354 -0.5253375 -0.5255394 -0.5257413 -0.5259430 -0.5261447 [25] -0.5263462 -0.5265476 -0.5267490 -0.5269502 -0.5271513 -0.5273523 [31] -0.5275532 -0.5277540 -0.5279547 -0.5281553 -0.5283557 -0.5285561 [37] -0.5287564 -0.5289565 -0.5291565 -0.5293565 -0.5295563 -0.5297560 [43] -0.5299556 -0.5301551 -0.5303545 -0.5305537 -0.5307529 -0.5309520 [49] -0.5311509 -0.5313497 -0.5315484 -0.5317471 -0.5319456 -0.5321439 [55] -0.5323422 -0.5325404 -0.5327384 -0.5329363 -0.5331342 -0.5333319 [61] -0.5335295 -0.5337270 -0.5339243 -0.5341216 -0.5343187 -0.5345158 [67] -0.5347127 -0.5349095 -0.5351062 -0.5353027 -0.5354992 -0.5356955 [73] -0.5358917 -0.5360878 -0.5362838 -0.5364797 -0.5366755 -0.5368711 [79] -0.5370666 -0.5372620 -0.5374573 -0.5376525 -0.5378476 -0.5380425 [85] -0.5382373 -0.5384320 -0.5386266 -0.5388211 -0.5390154 -0.5392097 [91] -0.5394038 -0.5395978 -0.5397916 -0.5399854 -0.5401790 -0.5403725 [97] -0.5405659 -0.5407592 -0.5409523 -0.5411454 -0.5413383 -0.5415311 [103] -0.5417237 -0.5419163 -0.5421087 -0.5423010 -0.5424932 -0.5426852 [109] -0.5428771 -0.5430689 -0.5432606 -0.5434522 -0.5436436 -0.5438349 [115] -0.5440261 -0.5442172 -0.5444082 -0.5445990 -0.5447897 -0.5449802 [121] -0.5451707 -0.5453610 -0.5455512 -0.5457413 -0.5459312 -0.5461210 [127] -0.5463107 -0.5465003 -0.5466897 -0.5468790 -0.5470682 -0.5472573 [133] -0.5474462 -0.5476350 -0.5478237 -0.5480122 -0.5482006 -0.5483889 [139] -0.5485771 -0.5487651 -0.5489530 -0.5491408 -0.5493285 -0.5495160 [145] -0.5497034 -0.5498906 -0.5500778 -0.5502648 -0.5504516 -0.5506384 [151] -0.5508250 -0.5510115 -0.5511978 -0.5513840 -0.5515701 -0.5517561 [157] -0.5519419 -0.5521276 -0.5523132 -0.5524986 -0.5526839 -0.5528690 [163] -0.5530541 -0.5532390 -0.5534237 -0.5536084 -0.5537929 -0.5539772 [169] -0.5541614 -0.5543455 -0.5545295 -0.5547133 -0.5548970 -0.5550806 [175] -0.5552640 -0.5554473 -0.5556304 -0.5558135 -0.5559963 -0.5561791 [181] -0.5563617 -0.5565442 -0.5567265 -0.5569087 -0.5570908 -0.5572727 [187] -0.5574545 -0.5576362 -0.5578177 -0.5579991 -0.5581803 -0.5583614 [193] -0.5585424 -0.5587232 -0.5589039 -0.5590844 -0.5592649 -0.5594451 [199] -0.5596253 -0.5598053 -0.5599851 -0.5601648 -0.5603444 -0.5605239 [205] -0.5607032 -0.5608823 -0.5610613 -0.5612402 -0.5614190 -0.5615976 [211] -0.5617760 -0.5619543 -0.5621325 -0.5623105 -0.5624884 -0.5626662 [217] -0.5628438 -0.5630212 -0.5631986 -0.5633757 -0.5635528 -0.5637297 [223] -0.5639064 -0.5640830 -0.5642595 -0.5644358 -0.5646120 -0.5647880 [229] -0.5649639 -0.5651397 -0.5653153 -0.5654907 -0.5656660 -0.5658412 [235] -0.5660162 -0.5661911 -0.5663658 -0.5665404 -0.5667149 -0.5668892 [241] -0.5670633 -0.5672373 -0.5674112 -0.5675849 -0.5677584 -0.5679319 [247] -0.5681051 -0.5682783 -0.5684512 -0.5686241 -0.5687968 -0.5689693 [253] -0.5691417 -0.5693139 -0.5694860 -0.5696580 -0.5698297 -0.5700014 [259] -0.5701729 -0.5703442 -0.5705154 -0.5706865 -0.5708574 -0.5710281 [265] -0.5711987 -0.5713692 -0.5715395 -0.5717097 -0.5718797 -0.5720495 [271] -0.5722192 -0.5723888 -0.5725582 -0.5727274 -0.5728965 -0.5730655 [277] -0.5732343 -0.5734029 -0.5735714 -0.5737397 -0.5739079 -0.5740760 [283] -0.5742438 -0.5744116 -0.5745792 -0.5747466 -0.5749139 -0.5750810 [289] -0.5752479 -0.5754148 -0.5755814 -0.5757479 -0.5759143 -0.5760805 [295] -0.5762465 -0.5764124 -0.5765781 -0.5767437 -0.5769092 -0.5770744 [301] -0.5772395 -0.5774045 -0.5775693 -0.5777340 -0.5778985 -0.5780628 [307] -0.5782270 -0.5783910 -0.5785549 -0.5787186 -0.5788822 -0.5790456 [313] -0.5792088 -0.5793719 -0.5795348 -0.5796976 -0.5798602 -0.5800227 [319] -0.5801850 -0.5803472 -0.5805091 -0.5806710 -0.5808326 -0.5809942 [325] -0.5811555 -0.5813167 -0.5814778 -0.5816386 -0.5817994 -0.5819599 [331] -0.5821203 -0.5822806 -0.5824407 -0.5826006 -0.5827603 -0.5829200 [337] -0.5830794 -0.5832387 -0.5833978 -0.5835568 -0.5837156 -0.5838742 [343] -0.5840327 -0.5841910 -0.5843492 -0.5845072 -0.5846650 -0.5848227 [349] -0.5849802 -0.5851376 -0.5852948 -0.5854518 -0.5856087 -0.5857654 [355] -0.5859219 -0.5860783 -0.5862345 -0.5863906 -0.5865465 -0.5867022 [361] -0.5868578 -0.5870132 -0.5871684 -0.5873235 -0.5874784 -0.5876332 [367] -0.5877877 -0.5879422 -0.5880964 -0.5882505 -0.5884045 -0.5885582 [373] -0.5887118 -0.5888653 -0.5890185 -0.5891716 -0.5893246 -0.5894773 [379] -0.5896300 -0.5897824 -0.5899347 -0.5900868 -0.5902387 -0.5903905 [385] -0.5905421 -0.5906936 -0.5908449 -0.5909960 -0.5911469 -0.5912977 [391] -0.5914483 -0.5915988 -0.5917491 -0.5918992 -0.5920491 -0.5921989 [397] -0.5923485 -0.5924980 -0.5926472 -0.5927963 -0.5929453 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1duaq1258019103.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/freestat/rcomp/tmp/2j9gq1258019103.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/freestat/rcomp/tmp/36ph71258019103.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/freestat/rcomp/tmp/4y2gf1258019103.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/freestat/rcomp/tmp/5end11258019103.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6mkqi1258019103.tab") > > system("convert tmp/1duaq1258019103.ps tmp/1duaq1258019103.png") > system("convert tmp/2j9gq1258019103.ps tmp/2j9gq1258019103.png") > system("convert tmp/36ph71258019103.ps tmp/36ph71258019103.png") > system("convert tmp/4y2gf1258019103.ps tmp/4y2gf1258019103.png") > system("convert tmp/5end11258019103.ps tmp/5end11258019103.png") > > > proc.time() user system elapsed 1.777 1.311 2.047