R version 2.7.0 (2008-04-22) 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(565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590,517945) > #'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.5525571 -0.5524957 -0.5523854 -0.5523161 -0.5522214 -0.5521281 [7] -0.5520446 -0.5519641 -0.5518634 -0.5517871 -0.5516972 -0.5516079 [13] -0.5515168 -0.5514288 -0.5513390 -0.5512559 -0.5511659 -0.5510764 [19] -0.5509851 -0.5508979 -0.5508106 -0.5507215 -0.5506321 -0.5505423 [25] -0.5504537 -0.5503615 -0.5502725 -0.5501824 -0.5500921 -0.5500009 [31] -0.5499108 -0.5498203 -0.5497288 -0.5496381 -0.5495472 -0.5494553 [37] -0.5493643 -0.5492726 -0.5491809 -0.5490888 -0.5489970 -0.5489048 [43] -0.5488125 -0.5487202 -0.5486277 -0.5485350 -0.5484421 -0.5483491 [49] -0.5482561 -0.5481627 -0.5480694 -0.5479759 -0.5478822 -0.5477884 [55] -0.5476945 -0.5476004 -0.5475062 -0.5474119 -0.5473174 -0.5472228 [61] -0.5471280 -0.5470331 -0.5469381 -0.5468429 -0.5467476 -0.5466522 [67] -0.5465566 -0.5464609 -0.5463650 -0.5462690 -0.5461729 -0.5460766 [73] -0.5459802 -0.5458837 -0.5457870 -0.5456902 -0.5455933 -0.5454962 [79] -0.5453990 -0.5453017 -0.5452042 -0.5451066 -0.5450088 -0.5449109 [85] -0.5448129 -0.5447148 -0.5446165 -0.5445181 -0.5444195 -0.5443209 [91] -0.5442220 -0.5441231 -0.5440240 -0.5439248 -0.5438254 -0.5437260 [97] -0.5436263 -0.5435266 -0.5434267 -0.5433267 -0.5432266 -0.5431263 [103] -0.5430259 -0.5429253 -0.5428247 -0.5427239 -0.5426229 -0.5425219 [109] -0.5424207 -0.5423193 -0.5422179 -0.5421163 -0.5420146 -0.5419127 [115] -0.5418107 -0.5417086 -0.5416064 -0.5415040 -0.5414015 -0.5412989 [121] -0.5411961 -0.5410933 -0.5409902 -0.5408871 -0.5407838 -0.5406804 [127] -0.5405769 -0.5404732 -0.5403694 -0.5402655 -0.5401615 -0.5400573 [133] -0.5399530 -0.5398486 -0.5397440 -0.5396394 -0.5395345 -0.5394296 [139] -0.5393245 -0.5392194 -0.5391140 -0.5390086 -0.5389030 -0.5387973 [145] -0.5386915 -0.5385856 -0.5384795 -0.5383733 -0.5382670 -0.5381605 [151] -0.5380540 -0.5379473 -0.5378404 -0.5377335 -0.5376264 -0.5375192 [157] -0.5374119 -0.5373044 -0.5371969 -0.5370892 -0.5369814 -0.5368734 [163] -0.5367654 -0.5366572 -0.5365489 -0.5364404 -0.5363319 -0.5362232 [169] -0.5361144 -0.5360055 -0.5358964 -0.5357872 -0.5356780 -0.5355685 [175] -0.5354590 -0.5353494 -0.5352396 -0.5351297 -0.5350197 -0.5349095 [181] -0.5347993 -0.5346889 -0.5345784 -0.5344677 -0.5343570 -0.5342461 [187] -0.5341352 -0.5340241 -0.5339128 -0.5338015 -0.5336900 -0.5335784 [193] -0.5334668 -0.5333549 -0.5332430 -0.5331309 -0.5330188 -0.5329065 [199] -0.5327941 -0.5326815 -0.5325689 -0.5324561 -0.5323432 -0.5322303 [205] -0.5321171 -0.5320039 -0.5318906 -0.5317771 -0.5316635 -0.5315498 [211] -0.5314360 -0.5313221 -0.5312080 -0.5310939 -0.5309796 -0.5308652 [217] -0.5307507 -0.5306360 -0.5305213 -0.5304065 -0.5302915 -0.5301764 [223] -0.5300612 -0.5299459 -0.5298305 -0.5297149 -0.5295993 -0.5294835 [229] -0.5293676 -0.5292516 -0.5291355 -0.5290193 -0.5289030 -0.5287865 [235] -0.5286700 -0.5285533 -0.5284365 -0.5283196 -0.5282026 -0.5280855 [241] -0.5279683 -0.5278509 -0.5277335 -0.5276159 -0.5274982 -0.5273805 [247] -0.5272626 -0.5271446 -0.5270264 -0.5269082 -0.5267899 -0.5266714 [253] -0.5265529 -0.5264342 -0.5263154 -0.5261966 -0.5260776 -0.5259585 [259] -0.5258392 -0.5257199 -0.5256005 -0.5254810 -0.5253613 -0.5252416 [265] -0.5251217 -0.5250018 -0.5248817 -0.5247615 -0.5246412 -0.5245208 [271] -0.5244003 -0.5242797 -0.5241590 -0.5240382 -0.5239172 -0.5237962 [277] -0.5236751 -0.5235538 -0.5234325 -0.5233110 -0.5231895 -0.5230678 [283] -0.5229460 -0.5228242 -0.5227022 -0.5225801 -0.5224579 -0.5223356 [289] -0.5222132 -0.5220907 -0.5219681 -0.5218454 -0.5217226 -0.5215997 [295] -0.5214767 -0.5213536 -0.5212304 -0.5211070 -0.5209836 -0.5208601 [301] -0.5207365 -0.5206127 -0.5204889 -0.5203650 -0.5202409 -0.5201168 [307] -0.5199926 -0.5198682 -0.5197438 -0.5196193 -0.5194946 -0.5193699 [313] -0.5192451 -0.5191201 -0.5189951 -0.5188700 -0.5187447 -0.5186194 [319] -0.5184940 -0.5183684 -0.5182428 -0.5181171 -0.5179912 -0.5178653 [325] -0.5177393 -0.5176132 -0.5174870 -0.5173607 -0.5172343 -0.5171077 [331] -0.5169811 -0.5168544 -0.5167276 -0.5166008 -0.5164738 -0.5163467 [337] -0.5162195 -0.5160922 -0.5159649 -0.5158374 -0.5157098 -0.5155822 [343] -0.5154544 -0.5153266 -0.5151986 -0.5150706 -0.5149425 -0.5148142 [349] -0.5146859 -0.5145575 -0.5144290 -0.5143004 -0.5141717 -0.5140430 [355] -0.5139141 -0.5137851 -0.5136561 -0.5135269 -0.5133977 -0.5132683 [361] -0.5131389 -0.5130094 -0.5128798 -0.5127501 -0.5126203 -0.5124904 [367] -0.5123604 -0.5122303 -0.5121002 -0.5119699 -0.5118396 -0.5117092 [373] -0.5115787 -0.5114481 -0.5113174 -0.5111866 -0.5110557 -0.5109248 [379] -0.5107937 -0.5106626 -0.5105314 -0.5104000 -0.5102686 -0.5101372 [385] -0.5100056 -0.5098739 -0.5097422 -0.5096103 -0.5094784 -0.5093464 [391] -0.5092143 -0.5090821 -0.5089498 -0.5088175 -0.5086850 -0.5085525 [397] -0.5084199 -0.5082872 -0.5081544 -0.5080215 -0.5078886 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ybj11229271417.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/2hdte1229271417.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/3imsj1229271417.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/47w4h1229271417.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/5a7021229271417.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/6kyub1229271417.tab") > > system("convert tmp/1ybj11229271417.ps tmp/1ybj11229271417.png") > system("convert tmp/2hdte1229271417.ps tmp/2hdte1229271417.png") > system("convert tmp/3imsj1229271417.ps tmp/3imsj1229271417.png") > system("convert tmp/47w4h1229271417.ps tmp/47w4h1229271417.png") > system("convert tmp/5a7021229271417.ps tmp/5a7021229271417.png") > > > proc.time() user system elapsed 2.396 1.316 2.569