R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(120.9,119.6,125.9,116.1,107.5,116.7,112.5,113,126.4,114.1,112.5,112.4,113.1,116.3,111.7,118.8,116.5,125.1,113.1,119.6,114.4,114,117.8,117,120.9,115,117.3,119.4,114.9,125.8,117.6,117.6,114.9,121.9,117,106.4,110.5,113.6,114.2,125.4,124.6,120.2,120.8,111.4,124.1,120.2,125.5,116,117,105.7,102,106.4,96.9,107.6,98.8,101.1,105.7,104.6,103.2,101.6) > #'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.5211846 -0.5210895 -0.5209943 -0.5208989 -0.5208035 -0.5207079 [7] -0.5206123 -0.5205165 -0.5204206 -0.5203245 -0.5202284 -0.5201321 [13] -0.5200358 -0.5199393 -0.5198427 -0.5197459 -0.5196491 -0.5195521 [19] -0.5194551 -0.5193579 -0.5192606 -0.5191631 -0.5190656 -0.5189680 [25] -0.5188702 -0.5187723 -0.5186743 -0.5185762 -0.5184780 -0.5183796 [31] -0.5182812 -0.5181826 -0.5180839 -0.5179851 -0.5178862 -0.5177872 [37] -0.5176880 -0.5175888 -0.5174894 -0.5173899 -0.5172903 -0.5171906 [43] -0.5170908 -0.5169908 -0.5168908 -0.5167906 -0.5166903 -0.5165899 [49] -0.5164894 -0.5163888 -0.5162881 -0.5161872 -0.5160863 -0.5159852 [55] -0.5158840 -0.5157827 -0.5156813 -0.5155798 -0.5154782 -0.5153764 [61] -0.5152746 -0.5151726 -0.5150705 -0.5149683 -0.5148660 -0.5147636 [67] -0.5146611 -0.5145585 -0.5144557 -0.5143529 -0.5142499 -0.5141468 [73] -0.5140436 -0.5139403 -0.5138369 -0.5137334 -0.5136298 -0.5135260 [79] -0.5134222 -0.5133182 -0.5132141 -0.5131099 -0.5130056 -0.5129012 [85] -0.5127967 -0.5126921 -0.5125874 -0.5124825 -0.5123776 -0.5122725 [91] -0.5121674 -0.5120621 -0.5119567 -0.5118512 -0.5117456 -0.5116399 [97] -0.5115341 -0.5114282 -0.5113221 -0.5112160 -0.5111098 -0.5110034 [103] -0.5108969 -0.5107904 -0.5106837 -0.5105769 -0.5104700 -0.5103630 [109] -0.5102559 -0.5101487 -0.5100414 -0.5099339 -0.5098264 -0.5097188 [115] -0.5096110 -0.5095032 -0.5093952 -0.5092872 -0.5091790 -0.5090707 [121] -0.5089623 -0.5088538 -0.5087452 -0.5086366 -0.5085277 -0.5084188 [127] -0.5083098 -0.5082007 -0.5080915 -0.5079822 -0.5078727 -0.5077632 [133] -0.5076536 -0.5075438 -0.5074340 -0.5073240 -0.5072140 -0.5071038 [139] -0.5069935 -0.5068832 -0.5067727 -0.5066621 -0.5065514 -0.5064407 [145] -0.5063298 -0.5062188 -0.5061077 -0.5059965 -0.5058852 -0.5057738 [151] -0.5056623 -0.5055507 -0.5054390 -0.5053272 -0.5052153 -0.5051033 [157] -0.5049912 -0.5048790 -0.5047667 -0.5046543 -0.5045418 -0.5044291 [163] -0.5043164 -0.5042036 -0.5040907 -0.5039777 -0.5038646 -0.5037513 [169] -0.5036380 -0.5035246 -0.5034111 -0.5032975 -0.5031838 -0.5030699 [175] -0.5029560 -0.5028420 -0.5027279 -0.5026137 -0.5024994 -0.5023850 [181] -0.5022705 -0.5021558 -0.5020411 -0.5019263 -0.5018114 -0.5016964 [187] -0.5015813 -0.5014661 -0.5013508 -0.5012354 -0.5011200 -0.5010044 [193] -0.5008887 -0.5007729 -0.5006570 -0.5005410 -0.5004250 -0.5003088 [199] -0.5001925 -0.5000762 -0.4999597 -0.4998432 -0.4997265 -0.4996098 [205] -0.4994929 -0.4993760 -0.4992590 -0.4991418 -0.4990246 -0.4989073 [211] -0.4987899 -0.4986724 -0.4985548 -0.4984371 -0.4983193 -0.4982014 [217] -0.4980834 -0.4979653 -0.4978472 -0.4977289 -0.4976105 -0.4974921 [223] -0.4973735 -0.4972549 -0.4971362 -0.4970173 -0.4968984 -0.4967794 [229] -0.4966603 -0.4965411 -0.4964218 -0.4963025 -0.4961830 -0.4960634 [235] -0.4959438 -0.4958240 -0.4957042 -0.4955842 -0.4954642 -0.4953441 [241] -0.4952239 -0.4951036 -0.4949832 -0.4948627 -0.4947422 -0.4946215 [247] -0.4945008 -0.4943799 -0.4942590 -0.4941380 -0.4940169 -0.4938957 [253] -0.4937744 -0.4936530 -0.4935315 -0.4934100 -0.4932883 -0.4931666 [259] -0.4930448 -0.4929228 -0.4928008 -0.4926787 -0.4925566 -0.4924343 [265] -0.4923119 -0.4921895 -0.4920670 -0.4919444 -0.4918216 -0.4916989 [271] -0.4915760 -0.4914530 -0.4913300 -0.4912068 -0.4910836 -0.4909603 [277] -0.4908369 -0.4907134 -0.4905898 -0.4904661 -0.4903424 -0.4902186 [283] -0.4900947 -0.4899706 -0.4898466 -0.4897224 -0.4895981 -0.4894738 [289] -0.4893494 -0.4892248 -0.4891002 -0.4889756 -0.4888508 -0.4887259 [295] -0.4886010 -0.4884760 -0.4883509 -0.4882257 -0.4881004 -0.4879751 [301] -0.4878496 -0.4877241 -0.4875985 -0.4874728 -0.4873471 -0.4872212 [307] -0.4870953 -0.4869693 -0.4868432 -0.4867170 -0.4865907 -0.4864644 [313] -0.4863380 -0.4862115 -0.4860849 -0.4859582 -0.4858315 -0.4857046 [319] -0.4855777 -0.4854507 -0.4853237 -0.4851965 -0.4850693 -0.4849420 [325] -0.4848146 -0.4846871 -0.4845596 -0.4844319 -0.4843042 -0.4841764 [331] -0.4840486 -0.4839206 -0.4837926 -0.4836645 -0.4835363 -0.4834080 [337] -0.4832797 -0.4831513 -0.4830228 -0.4828942 -0.4827656 -0.4826368 [343] -0.4825080 -0.4823791 -0.4822502 -0.4821211 -0.4819920 -0.4818628 [349] -0.4817336 -0.4816042 -0.4814748 -0.4813453 -0.4812157 -0.4810861 [355] -0.4809564 -0.4808266 -0.4806967 -0.4805667 -0.4804367 -0.4803066 [361] -0.4801764 -0.4800462 -0.4799159 -0.4797855 -0.4796550 -0.4795244 [367] -0.4793938 -0.4792631 -0.4791324 -0.4790015 -0.4788706 -0.4787396 [373] -0.4786086 -0.4784774 -0.4783462 -0.4782149 -0.4780836 -0.4779522 [379] -0.4778207 -0.4776891 -0.4775574 -0.4774257 -0.4772939 -0.4771621 [385] -0.4770302 -0.4768982 -0.4767661 -0.4766340 -0.4765017 -0.4763695 [391] -0.4762371 -0.4761047 -0.4759722 -0.4758396 -0.4757070 -0.4755743 [397] -0.4754415 -0.4753087 -0.4751758 -0.4750428 -0.4749097 > 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/1gl2p1293388514.ps",horizontal=F,onefile=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/2gl2p1293388514.ps",horizontal=F,onefile=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/3gl2p1293388514.ps",horizontal=F,onefile=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/48c1s1293388514.ps",horizontal=F,onefile=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/58c1s1293388514.ps",horizontal=F,onefile=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/6cdzg1293388514.tab") > try(system("convert tmp/1gl2p1293388514.ps tmp/1gl2p1293388514.png",intern=TRUE)) character(0) > try(system("convert tmp/2gl2p1293388514.ps tmp/2gl2p1293388514.png",intern=TRUE)) character(0) > try(system("convert tmp/3gl2p1293388514.ps tmp/3gl2p1293388514.png",intern=TRUE)) character(0) > try(system("convert tmp/48c1s1293388514.ps tmp/48c1s1293388514.png",intern=TRUE)) character(0) > try(system("convert tmp/58c1s1293388514.ps tmp/58c1s1293388514.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.101 0.821 3.176