R version 2.8.1 (2008-12-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(8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,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.4916993 -0.4918413 -0.4919831 -0.4921248 -0.4922663 -0.4924077 [7] -0.4925490 -0.4926901 -0.4928311 -0.4929719 -0.4931126 -0.4932531 [13] -0.4933935 -0.4935337 -0.4936738 -0.4938138 -0.4939536 -0.4940932 [19] -0.4942327 -0.4943721 -0.4945113 -0.4946504 -0.4947893 -0.4949280 [25] -0.4950667 -0.4952051 -0.4953434 -0.4954816 -0.4956196 -0.4957575 [31] -0.4958953 -0.4960328 -0.4961703 -0.4963075 -0.4964447 -0.4965817 [37] -0.4967185 -0.4968552 -0.4969917 -0.4971281 -0.4972643 -0.4974004 [43] -0.4975363 -0.4976721 -0.4978077 -0.4979432 -0.4980785 -0.4982137 [49] -0.4983487 -0.4984836 -0.4986183 -0.4987529 -0.4988873 -0.4990215 [55] -0.4991557 -0.4992896 -0.4994234 -0.4995571 -0.4996906 -0.4998239 [61] -0.4999571 -0.5000901 -0.5002230 -0.5003557 -0.5004883 -0.5006207 [67] -0.5007530 -0.5008851 -0.5010171 -0.5011489 -0.5012805 -0.5014120 [73] -0.5015433 -0.5016745 -0.5018055 -0.5019364 -0.5020671 -0.5021977 [79] -0.5023281 -0.5024583 -0.5025884 -0.5027184 -0.5028481 -0.5029777 [85] -0.5031072 -0.5032365 -0.5033657 -0.5034946 -0.5036235 -0.5037522 [91] -0.5038807 -0.5040090 -0.5041372 -0.5042653 -0.5043932 -0.5045209 [97] -0.5046484 -0.5047759 -0.5049031 -0.5050302 -0.5051571 -0.5052839 [103] -0.5054105 -0.5055370 -0.5056633 -0.5057894 -0.5059154 -0.5060412 [109] -0.5061668 -0.5062923 -0.5064177 -0.5065428 -0.5066678 -0.5067927 [115] -0.5069174 -0.5070419 -0.5071663 -0.5072905 -0.5074145 -0.5075384 [121] -0.5076621 -0.5077857 -0.5079091 -0.5080323 -0.5081554 -0.5082783 [127] -0.5084010 -0.5085236 -0.5086460 -0.5087683 -0.5088904 -0.5090123 [133] -0.5091341 -0.5092557 -0.5093771 -0.5094984 -0.5096195 -0.5097405 [139] -0.5098612 -0.5099819 -0.5101023 -0.5102226 -0.5103427 -0.5104627 [145] -0.5105825 -0.5107021 -0.5108216 -0.5109409 -0.5110600 -0.5111790 [151] -0.5112978 -0.5114165 -0.5115349 -0.5116532 -0.5117714 -0.5118894 [157] -0.5120072 -0.5121248 -0.5122423 -0.5123596 -0.5124768 -0.5125937 [163] -0.5127105 -0.5128272 -0.5129437 -0.5130600 -0.5131761 -0.5132921 [169] -0.5134079 -0.5135235 -0.5136390 -0.5137543 -0.5138694 -0.5139844 [175] -0.5140992 -0.5142138 -0.5143283 -0.5144426 -0.5145567 -0.5146707 [181] -0.5147845 -0.5148981 -0.5150115 -0.5151248 -0.5152379 -0.5153509 [187] -0.5154636 -0.5155762 -0.5156887 -0.5158009 -0.5159130 -0.5160249 [193] -0.5161367 -0.5162483 -0.5163597 -0.5164709 -0.5165820 -0.5166929 [199] -0.5168036 -0.5169142 -0.5170246 -0.5171348 -0.5172448 -0.5173547 [205] -0.5174644 -0.5175739 -0.5176833 -0.5177925 -0.5179015 -0.5180103 [211] -0.5181190 -0.5182275 -0.5183358 -0.5184440 -0.5185519 -0.5186597 [217] -0.5187674 -0.5188748 -0.5189821 -0.5190893 -0.5191962 -0.5193030 [223] -0.5194096 -0.5195160 -0.5196222 -0.5197283 -0.5198342 -0.5199400 [229] -0.5200455 -0.5201509 -0.5202561 -0.5203611 -0.5204660 -0.5205707 [235] -0.5206752 -0.5207795 -0.5208837 -0.5209877 -0.5210915 -0.5211951 [241] -0.5212986 -0.5214019 -0.5215050 -0.5216079 -0.5217107 -0.5218133 [247] -0.5219157 -0.5220179 -0.5221200 -0.5222219 -0.5223236 -0.5224251 [253] -0.5225265 -0.5226277 -0.5227287 -0.5228295 -0.5229301 -0.5230306 [259] -0.5231309 -0.5232310 -0.5233310 -0.5234308 -0.5235304 -0.5236298 [265] -0.5237290 -0.5238281 -0.5239270 -0.5240257 -0.5241242 -0.5242226 [271] -0.5243207 -0.5244187 -0.5245165 -0.5246142 -0.5247117 -0.5248089 [277] -0.5249061 -0.5250030 -0.5250997 -0.5251963 -0.5252927 -0.5253889 [283] -0.5254850 -0.5255808 -0.5256765 -0.5257720 -0.5258674 -0.5259625 [289] -0.5260575 -0.5261523 -0.5262469 -0.5263413 -0.5264356 -0.5265296 [295] -0.5266235 -0.5267172 -0.5268108 -0.5269041 -0.5269973 -0.5270903 [301] -0.5271831 -0.5272758 -0.5273682 -0.5274605 -0.5275526 -0.5276445 [307] -0.5277362 -0.5278278 -0.5279192 -0.5280104 -0.5281014 -0.5281922 [313] -0.5282829 -0.5283734 -0.5284636 -0.5285538 -0.5286437 -0.5287334 [319] -0.5288230 -0.5289124 -0.5290016 -0.5290906 -0.5291795 -0.5292682 [325] -0.5293566 -0.5294449 -0.5295331 -0.5296210 -0.5297088 -0.5297963 [331] -0.5298837 -0.5299709 -0.5300580 -0.5301448 -0.5302315 -0.5303180 [337] -0.5304043 -0.5304904 -0.5305763 -0.5306621 -0.5307477 -0.5308330 [343] -0.5309183 -0.5310033 -0.5310881 -0.5311728 -0.5312573 -0.5313416 [349] -0.5314257 -0.5315096 -0.5315933 -0.5316769 -0.5317603 -0.5318435 [355] -0.5319265 -0.5320093 -0.5320920 -0.5321744 -0.5322567 -0.5323388 [361] -0.5324207 -0.5325025 -0.5325840 -0.5326654 -0.5327466 -0.5328276 [367] -0.5329084 -0.5329890 -0.5330694 -0.5331497 -0.5332298 -0.5333097 [373] -0.5333894 -0.5334689 -0.5335482 -0.5336274 -0.5337064 -0.5337852 [379] -0.5338638 -0.5339422 -0.5340204 -0.5340985 -0.5341763 -0.5342540 [385] -0.5343315 -0.5344088 -0.5344860 -0.5345629 -0.5346396 -0.5347162 [391] -0.5347926 -0.5348688 -0.5349448 -0.5350207 -0.5350963 -0.5351718 [397] -0.5352470 -0.5353221 -0.5353970 -0.5354718 -0.5355463 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1ygqg1257692319.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/rcomp/tmp/29lm01257692319.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/rcomp/tmp/3i7e31257692319.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/rcomp/tmp/45shg1257692319.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/rcomp/tmp/5jisz1257692319.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6hl4z1257692319.tab") > > system("convert tmp/1ygqg1257692319.ps tmp/1ygqg1257692319.png") > system("convert tmp/29lm01257692319.ps tmp/29lm01257692319.png") > system("convert tmp/3i7e31257692319.ps tmp/3i7e31257692319.png") > system("convert tmp/45shg1257692319.ps tmp/45shg1257692319.png") > system("convert tmp/5jisz1257692319.ps tmp/5jisz1257692319.png") > > > proc.time() user system elapsed 1.350 1.180 2.258