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.0,9.1,8.7,8.2,7.9,7.9,9.1,9.4,9.5,9.1,9.0,9.3,9.9,9.8,9.4,8.3,8.0,8.5,10.4,11.1,10.9,9.9,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9.0,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9.0,9.0,9.0,9.8,10.0,9.9,9.3,9.0,9.0,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.8,7.9,7.9,8.0,7.9,7.5,7.2,6.9,6.6,6.7,7.3,7.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.5342529 -0.5341357 -0.5340181 -0.5339002 -0.5337819 -0.5336633 [7] -0.5335443 -0.5334250 -0.5333053 -0.5331853 -0.5330649 -0.5329442 [13] -0.5328231 -0.5327017 -0.5325799 -0.5324577 -0.5323352 -0.5322124 [19] -0.5320892 -0.5319657 -0.5318418 -0.5317175 -0.5315929 -0.5314680 [25] -0.5313427 -0.5312170 -0.5310910 -0.5309647 -0.5308380 -0.5307109 [31] -0.5305836 -0.5304558 -0.5303277 -0.5301993 -0.5300705 -0.5299414 [37] -0.5298119 -0.5296821 -0.5295519 -0.5294214 -0.5292905 -0.5291593 [43] -0.5290278 -0.5288959 -0.5287636 -0.5286310 -0.5284981 -0.5283648 [49] -0.5282312 -0.5280972 -0.5279629 -0.5278282 -0.5276933 -0.5275579 [55] -0.5274222 -0.5272862 -0.5271498 -0.5270131 -0.5268761 -0.5267387 [61] -0.5266009 -0.5264629 -0.5263245 -0.5261857 -0.5260466 -0.5259072 [67] -0.5257674 -0.5256273 -0.5254868 -0.5253460 -0.5252049 -0.5250634 [73] -0.5249216 -0.5247795 -0.5246370 -0.5244942 -0.5243510 -0.5242075 [79] -0.5240637 -0.5239196 -0.5237751 -0.5236302 -0.5234851 -0.5233396 [85] -0.5231937 -0.5230476 -0.5229011 -0.5227542 -0.5226071 -0.5224596 [91] -0.5223117 -0.5221636 -0.5220151 -0.5218662 -0.5217171 -0.5215676 [97] -0.5214178 -0.5212676 -0.5211171 -0.5209663 -0.5208152 -0.5206637 [103] -0.5205119 -0.5203598 -0.5202073 -0.5200546 -0.5199014 -0.5197480 [109] -0.5195943 -0.5194402 -0.5192858 -0.5191310 -0.5189760 -0.5188206 [115] -0.5186649 -0.5185088 -0.5183525 -0.5181958 -0.5180388 -0.5178815 [121] -0.5177238 -0.5175658 -0.5174076 -0.5172489 -0.5170900 -0.5169308 [127] -0.5167712 -0.5166113 -0.5164511 -0.5162905 -0.5161297 -0.5159685 [133] -0.5158070 -0.5156452 -0.5154831 -0.5153207 -0.5151579 -0.5149949 [139] -0.5148315 -0.5146678 -0.5145038 -0.5143394 -0.5141748 -0.5140098 [145] -0.5138446 -0.5136790 -0.5135131 -0.5133469 -0.5131804 -0.5130135 [151] -0.5128464 -0.5126790 -0.5125112 -0.5123431 -0.5121747 -0.5120061 [157] -0.5118371 -0.5116678 -0.5114982 -0.5113282 -0.5111580 -0.5109875 [163] -0.5108167 -0.5106455 -0.5104741 -0.5103023 -0.5101303 -0.5099579 [169] -0.5097852 -0.5096123 -0.5094390 -0.5092654 -0.5090916 -0.5089174 [175] -0.5087429 -0.5085682 -0.5083931 -0.5082177 -0.5080420 -0.5078661 [181] -0.5076898 -0.5075132 -0.5073364 -0.5071592 -0.5069818 -0.5068040 [187] -0.5066260 -0.5064476 -0.5062690 -0.5060901 -0.5059108 -0.5057313 [193] -0.5055515 -0.5053714 -0.5051910 -0.5050103 -0.5048294 -0.5046481 [199] -0.5044665 -0.5042847 -0.5041025 -0.5039201 -0.5037374 -0.5035544 [205] -0.5033711 -0.5031876 -0.5030037 -0.5028196 -0.5026351 -0.5024504 [211] -0.5022654 -0.5020801 -0.5018946 -0.5017087 -0.5015226 -0.5013362 [217] -0.5011495 -0.5009625 -0.5007752 -0.5005877 -0.5003999 -0.5002118 [223] -0.5000234 -0.4998348 -0.4996458 -0.4994566 -0.4992672 -0.4990774 [229] -0.4988874 -0.4986970 -0.4985065 -0.4983156 -0.4981245 -0.4979331 [235] -0.4977414 -0.4975494 -0.4973572 -0.4971647 -0.4969720 -0.4967789 [241] -0.4965856 -0.4963921 -0.4961982 -0.4960041 -0.4958097 -0.4956151 [247] -0.4954202 -0.4952250 -0.4950296 -0.4948339 -0.4946379 -0.4944417 [253] -0.4942452 -0.4940484 -0.4938514 -0.4936541 -0.4934566 -0.4932588 [259] -0.4930607 -0.4928624 -0.4926638 -0.4924649 -0.4922658 -0.4920665 [265] -0.4918669 -0.4916670 -0.4914669 -0.4912665 -0.4910659 -0.4908650 [271] -0.4906638 -0.4904624 -0.4902608 -0.4900589 -0.4898567 -0.4896543 [277] -0.4894516 -0.4892487 -0.4890456 -0.4888422 -0.4886385 -0.4884346 [283] -0.4882305 -0.4880261 -0.4878214 -0.4876165 -0.4874114 -0.4872060 [289] -0.4870004 -0.4867945 -0.4865884 -0.4863821 -0.4861755 -0.4859686 [295] -0.4857616 -0.4855543 -0.4853467 -0.4851389 -0.4849309 -0.4847226 [301] -0.4845141 -0.4843054 -0.4840964 -0.4838872 -0.4836777 -0.4834680 [307] -0.4832581 -0.4830480 -0.4828376 -0.4826270 -0.4824161 -0.4822050 [313] -0.4819937 -0.4817822 -0.4815704 -0.4813584 -0.4811462 -0.4809337 [319] -0.4807211 -0.4805082 -0.4802950 -0.4800817 -0.4798681 -0.4796543 [325] -0.4794402 -0.4792260 -0.4790115 -0.4787968 -0.4785819 -0.4783668 [331] -0.4781514 -0.4779358 -0.4777200 -0.4775040 -0.4772878 -0.4770713 [337] -0.4768547 -0.4766378 -0.4764207 -0.4762034 -0.4759858 -0.4757681 [343] -0.4755501 -0.4753320 -0.4751136 -0.4748950 -0.4746762 -0.4744572 [349] -0.4742380 -0.4740186 -0.4737989 -0.4735791 -0.4733590 -0.4731388 [355] -0.4729183 -0.4726977 -0.4724768 -0.4722557 -0.4720344 -0.4718129 [361] -0.4715913 -0.4713694 -0.4711473 -0.4709250 -0.4707025 -0.4704798 [367] -0.4702570 -0.4700339 -0.4698106 -0.4695871 -0.4693634 -0.4691396 [373] -0.4689155 -0.4686913 -0.4684668 -0.4682422 -0.4680173 -0.4677923 [379] -0.4675671 -0.4673417 -0.4671161 -0.4668903 -0.4666643 -0.4664382 [385] -0.4662118 -0.4659853 -0.4657585 -0.4655316 -0.4653045 -0.4650772 [391] -0.4648498 -0.4646221 -0.4643943 -0.4641663 -0.4639381 -0.4637097 [397] -0.4634812 -0.4632524 -0.4630235 -0.4627944 -0.4625652 > 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/19tfa1227518864.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/2g1961227518864.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/3wbik1227518864.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/4a9971227518864.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/58cys1227518864.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/6tvi81227518864.tab") > > system("convert tmp/19tfa1227518864.ps tmp/19tfa1227518864.png") > system("convert tmp/2g1961227518864.ps tmp/2g1961227518864.png") > system("convert tmp/3wbik1227518864.ps tmp/3wbik1227518864.png") > system("convert tmp/4a9971227518864.ps tmp/4a9971227518864.png") > system("convert tmp/58cys1227518864.ps tmp/58cys1227518864.png") > > > proc.time() user system elapsed 1.036 0.788 1.745