R version 2.7.2 (2008-08-25) 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(377.2,332.2,364.8,352.4,341.6,298.2,355.3,330.9,314.5,418.9,433.2,367,422.9,352.1,419.8,432.7,414.2,387.7,297.2,357.4,384.2,425.2,385.3,355.4,409.8,421.2,421.8,464.2,494,404.2,411.4,403.4,403.3,520.9,439.8,434.8,476.5,454.3,522,498.4,439.9,450.7,447.1,451.3,466.8,498,533.6,451.9,477.1,410.4,469.5,485.4,406.7,439.7,412.2,440.2,411.1,477.7,463.2,320.5) > #'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.5081424 0.5082976 0.5084523 0.5086066 0.5087603 0.5089136 0.5090664 [8] 0.5092188 0.5093706 0.5095220 0.5096728 0.5098232 0.5099731 0.5101226 [15] 0.5102715 0.5104199 0.5105679 0.5107153 0.5108623 0.5110088 0.5111548 [22] 0.5113003 0.5114453 0.5115898 0.5117338 0.5118773 0.5120203 0.5121628 [29] 0.5123048 0.5124463 0.5125873 0.5127278 0.5128677 0.5130072 0.5131462 [36] 0.5132847 0.5134226 0.5135601 0.5136970 0.5138335 0.5139694 0.5141048 [43] 0.5142397 0.5143740 0.5145079 0.5146413 0.5147741 0.5149064 0.5150382 [50] 0.5151695 0.5153002 0.5154304 0.5155602 0.5156893 0.5158180 0.5159461 [57] 0.5160738 0.5162008 0.5163274 0.5164534 0.5165789 0.5167039 0.5168283 [64] 0.5169523 0.5170756 0.5171985 0.5173208 0.5174426 0.5175638 0.5176845 [71] 0.5178047 0.5179243 0.5180434 0.5181620 0.5182800 0.5183975 0.5185144 [78] 0.5186308 0.5187466 0.5188619 0.5189767 0.5190909 0.5192046 0.5193177 [85] 0.5194303 0.5195423 0.5196538 0.5197647 0.5198751 0.5199849 0.5200942 [92] 0.5202029 0.5203111 0.5204187 0.5205258 0.5206323 0.5207383 0.5208437 [99] 0.5209485 0.5210528 0.5211565 0.5212597 0.5213623 0.5214644 0.5215658 [106] 0.5216668 0.5217671 0.5218669 0.5219662 0.5220648 0.5221630 0.5222605 [113] 0.5223575 0.5224539 0.5225497 0.5226450 0.5227397 0.5228339 0.5229274 [120] 0.5230204 0.5231129 0.5232047 0.5232960 0.5233867 0.5234769 0.5235665 [127] 0.5236555 0.5237439 0.5238317 0.5239190 0.5240057 0.5240918 0.5241774 [134] 0.5242623 0.5243467 0.5244305 0.5245138 0.5245964 0.5246785 0.5247600 [141] 0.5248409 0.5249212 0.5250010 0.5250801 0.5251587 0.5252367 0.5253141 [148] 0.5253909 0.5254672 0.5255429 0.5256179 0.5256924 0.5257663 0.5258396 [155] 0.5259124 0.5259845 0.5260560 0.5261270 0.5261974 0.5262672 0.5263364 [162] 0.5264050 0.5264730 0.5265404 0.5266072 0.5266735 0.5267391 0.5268042 [169] 0.5268687 0.5269325 0.5269958 0.5270585 0.5271206 0.5271821 0.5272430 [176] 0.5273033 0.5273630 0.5274221 0.5274806 0.5275385 0.5275959 0.5276526 [183] 0.5277087 0.5277643 0.5278192 0.5278735 0.5279273 0.5279804 0.5280329 [190] 0.5280849 0.5281362 0.5281870 0.5282371 0.5282867 0.5283356 0.5283839 [197] 0.5284317 0.5284788 0.5285254 0.5285713 0.5286166 0.5286614 0.5287055 [204] 0.5287490 0.5287920 0.5288343 0.5288760 0.5289171 0.5289577 0.5289976 [211] 0.5290369 0.5290756 0.5291137 0.5291512 0.5291881 0.5292244 0.5292601 [218] 0.5292951 0.5293296 0.5293635 0.5293968 0.5294294 0.5294615 0.5294929 [225] 0.5295238 0.5295540 0.5295837 0.5296127 0.5296411 0.5296689 0.5296962 [232] 0.5297228 0.5297488 0.5297742 0.5297990 0.5298231 0.5298467 0.5298697 [239] 0.5298921 0.5299138 0.5299350 0.5299555 0.5299755 0.5299948 0.5300136 [246] 0.5300317 0.5300492 0.5300661 0.5300824 0.5300981 0.5301132 0.5301277 [253] 0.5301416 0.5301549 0.5301676 0.5301796 0.5301911 0.5302020 0.5302122 [260] 0.5302219 0.5302309 0.5302393 0.5302472 0.5302544 0.5302610 0.5302670 [267] 0.5302725 0.5302773 0.5302815 0.5302851 0.5302881 0.5302905 0.5302923 [274] 0.5302934 0.5302940 0.5302940 0.5302934 0.5302921 0.5302903 0.5302879 [281] 0.5302848 0.5302812 0.5302770 0.5302721 0.5302667 0.5302606 0.5302540 [288] 0.5302467 0.5302389 0.5302304 0.5302214 0.5302117 0.5302015 0.5301906 [295] 0.5301792 0.5301671 0.5301545 0.5301412 0.5301274 0.5301129 0.5300979 [302] 0.5300822 0.5300660 0.5300492 0.5300317 0.5300137 0.5299951 0.5299759 [309] 0.5299560 0.5299356 0.5299146 0.5298930 0.5298708 0.5298480 0.5298246 [316] 0.5298006 0.5297761 0.5297509 0.5297251 0.5296988 0.5296719 0.5296443 [323] 0.5296162 0.5295875 0.5295582 0.5295283 0.5294978 0.5294667 0.5294350 [330] 0.5294028 0.5293700 0.5293365 0.5293025 0.5292679 0.5292327 0.5291969 [337] 0.5291606 0.5291236 0.5290861 0.5290480 0.5290093 0.5289700 0.5289302 [344] 0.5288897 0.5288487 0.5288071 0.5287649 0.5287221 0.5286788 0.5286348 [351] 0.5285903 0.5285452 0.5284996 0.5284533 0.5284065 0.5283591 0.5283111 [358] 0.5282626 0.5282135 0.5281638 0.5281135 0.5280626 0.5280112 0.5279592 [365] 0.5279067 0.5278535 0.5277998 0.5277455 0.5276907 0.5276353 0.5275793 [372] 0.5275227 0.5274656 0.5274079 0.5273497 0.5272909 0.5272315 0.5271715 [379] 0.5271110 0.5270499 0.5269883 0.5269261 0.5268633 0.5268000 0.5267361 [386] 0.5266717 0.5266067 0.5265411 0.5264750 0.5264083 0.5263411 0.5262733 [393] 0.5262050 0.5261361 0.5260666 0.5259966 0.5259261 0.5258550 0.5257833 [400] 0.5257111 0.5256383 > mx [1] 0.530294 > mxli [1] 0.74 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ul9i1226522570.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/2k3iq1226522570.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/33ih21226522570.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/4is9n1226522570.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/5niyw1226522570.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/6ffnc1226522570.tab") > > system("convert tmp/1ul9i1226522570.ps tmp/1ul9i1226522570.png") > system("convert tmp/2k3iq1226522570.ps tmp/2k3iq1226522570.png") > system("convert tmp/33ih21226522570.ps tmp/33ih21226522570.png") > system("convert tmp/4is9n1226522570.ps tmp/4is9n1226522570.png") > system("convert tmp/5niyw1226522570.ps tmp/5niyw1226522570.png") > > > proc.time() user system elapsed 1.265 0.788 2.626