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(85.0,95.9,108.9,96.2,100.1,105.7,64.5,66.8,110.3,96.1,102.5,97.6,83.6,86.5,96.0,91.1,87.2,84.5,59.2,61.5,98.8,97.9,92.7,84.2,74.5,79.7,86.8,79.8,87.0,91.4,58.7,62.8,87.9,90.4,80.6,73.5,71.4,70.6,78.3,76.0,77.4,80.9,63.4,58.1,88.2,81.2,84.9,76.4,71.5,76.1,82.9,78.0,82.0,84.7,55.7,59.5,83.2,87.6,76.2,76.4,68.3,70.0,76.3,70.9,72.4,80.1,57.4,62.7,82.6,88.9,80.4,72.0,69.4,69.2,77.3,79.4,78.6,76.1,61.8,59.4,78.1) > #'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.4045092 -0.4048847 -0.4052601 -0.4056357 -0.4060112 -0.4063868 [7] -0.4067624 -0.4071380 -0.4075136 -0.4078892 -0.4082649 -0.4086405 [13] -0.4090162 -0.4093919 -0.4097676 -0.4101432 -0.4105189 -0.4108946 [19] -0.4112703 -0.4116459 -0.4120216 -0.4123972 -0.4127729 -0.4131485 [25] -0.4135241 -0.4138997 -0.4142753 -0.4146508 -0.4150263 -0.4154018 [31] -0.4157773 -0.4161527 -0.4165281 -0.4169034 -0.4172788 -0.4176540 [37] -0.4180293 -0.4184045 -0.4187796 -0.4191547 -0.4195297 -0.4199047 [43] -0.4202797 -0.4206545 -0.4210294 -0.4214041 -0.4217788 -0.4221534 [49] -0.4225280 -0.4229025 -0.4232769 -0.4236512 -0.4240255 -0.4243997 [55] -0.4247738 -0.4251478 -0.4255217 -0.4258955 -0.4262693 -0.4266429 [61] -0.4270165 -0.4273900 -0.4277633 -0.4281366 -0.4285097 -0.4288828 [67] -0.4292557 -0.4296286 -0.4300013 -0.4303739 -0.4307464 -0.4311187 [73] -0.4314910 -0.4318631 -0.4322351 -0.4326069 -0.4329787 -0.4333503 [79] -0.4337217 -0.4340931 -0.4344642 -0.4348353 -0.4352062 -0.4355769 [85] -0.4359475 -0.4363180 -0.4366883 -0.4370584 -0.4374284 -0.4377982 [91] -0.4381678 -0.4385373 -0.4389066 -0.4392758 -0.4396448 -0.4400136 [97] -0.4403822 -0.4407506 -0.4411189 -0.4414870 -0.4418549 -0.4422226 [103] -0.4425901 -0.4429574 -0.4433245 -0.4436915 -0.4440582 -0.4444247 [109] -0.4447910 -0.4451572 -0.4455231 -0.4458888 -0.4462542 -0.4466195 [115] -0.4469845 -0.4473494 -0.4477140 -0.4480783 -0.4484425 -0.4488064 [121] -0.4491701 -0.4495335 -0.4498968 -0.4502597 -0.4506225 -0.4509849 [127] -0.4513472 -0.4517092 -0.4520709 -0.4524324 -0.4527936 -0.4531546 [133] -0.4535153 -0.4538758 -0.4542360 -0.4545959 -0.4549555 -0.4553149 [139] -0.4556740 -0.4560329 -0.4563914 -0.4567497 -0.4571077 -0.4574654 [145] -0.4578228 -0.4581799 -0.4585367 -0.4588933 -0.4592495 -0.4596054 [151] -0.4599611 -0.4603164 -0.4606714 -0.4610262 -0.4613806 -0.4617347 [157] -0.4620884 -0.4624419 -0.4627950 -0.4631479 -0.4635003 -0.4638525 [163] -0.4642044 -0.4645559 -0.4649070 -0.4652579 -0.4656084 -0.4659585 [169] -0.4663083 -0.4666578 -0.4670069 -0.4673557 -0.4677041 -0.4680522 [175] -0.4683999 -0.4687473 -0.4690943 -0.4694409 -0.4697872 -0.4701331 [181] -0.4704786 -0.4708238 -0.4711685 -0.4715129 -0.4718570 -0.4722006 [187] -0.4725439 -0.4728868 -0.4732292 -0.4735714 -0.4739131 -0.4742544 [193] -0.4745953 -0.4749358 -0.4752759 -0.4756157 -0.4759550 -0.4762939 [199] -0.4766324 -0.4769705 -0.4773081 -0.4776454 -0.4779822 -0.4783186 [205] -0.4786546 -0.4789902 -0.4793254 -0.4796601 -0.4799944 -0.4803282 [211] -0.4806616 -0.4809946 -0.4813271 -0.4816592 -0.4819909 -0.4823221 [217] -0.4826529 -0.4829832 -0.4833130 -0.4836425 -0.4839714 -0.4842999 [223] -0.4846279 -0.4849555 -0.4852826 -0.4856092 -0.4859354 -0.4862611 [229] -0.4865863 -0.4869111 -0.4872354 -0.4875592 -0.4878825 -0.4882053 [235] -0.4885277 -0.4888495 -0.4891709 -0.4894918 -0.4898122 -0.4901321 [241] -0.4904515 -0.4907704 -0.4910888 -0.4914067 -0.4917240 -0.4920409 [247] -0.4923573 -0.4926732 -0.4929885 -0.4933034 -0.4936177 -0.4939315 [253] -0.4942448 -0.4945575 -0.4948698 -0.4951815 -0.4954927 -0.4958033 [259] -0.4961134 -0.4964230 -0.4967321 -0.4970406 -0.4973486 -0.4976560 [265] -0.4979629 -0.4982693 -0.4985751 -0.4988803 -0.4991850 -0.4994892 [271] -0.4997928 -0.5000958 -0.5003983 -0.5007003 -0.5010016 -0.5013024 [277] -0.5016027 -0.5019024 -0.5022015 -0.5025000 -0.5027980 -0.5030954 [283] -0.5033922 -0.5036884 -0.5039841 -0.5042792 -0.5045737 -0.5048676 [289] -0.5051610 -0.5054537 -0.5057459 -0.5060374 -0.5063284 -0.5066188 [295] -0.5069086 -0.5071978 -0.5074864 -0.5077744 -0.5080618 -0.5083486 [301] -0.5086348 -0.5089204 -0.5092054 -0.5094897 -0.5097735 -0.5100566 [307] -0.5103392 -0.5106211 -0.5109024 -0.5111831 -0.5114631 -0.5117426 [313] -0.5120214 -0.5122996 -0.5125771 -0.5128541 -0.5131304 -0.5134061 [319] -0.5136811 -0.5139556 -0.5142293 -0.5145025 -0.5147750 -0.5150469 [325] -0.5153181 -0.5155887 -0.5158586 -0.5161279 -0.5163966 -0.5166646 [331] -0.5169320 -0.5171987 -0.5174647 -0.5177301 -0.5179949 -0.5182590 [337] -0.5185224 -0.5187852 -0.5190473 -0.5193088 -0.5195696 -0.5198298 [343] -0.5200892 -0.5203481 -0.5206062 -0.5208637 -0.5211205 -0.5213766 [349] -0.5216321 -0.5218869 -0.5221410 -0.5223945 -0.5226472 -0.5228993 [355] -0.5231507 -0.5234015 -0.5236515 -0.5239009 -0.5241496 -0.5243976 [361] -0.5246449 -0.5248916 -0.5251375 -0.5253828 -0.5256274 -0.5258712 [367] -0.5261144 -0.5263569 -0.5265987 -0.5268398 -0.5270803 -0.5273200 [373] -0.5275590 -0.5277973 -0.5280349 -0.5282719 -0.5285081 -0.5287436 [379] -0.5289784 -0.5292125 -0.5294459 -0.5296786 -0.5299106 -0.5301419 [385] -0.5303725 -0.5306024 -0.5308315 -0.5310600 -0.5312877 -0.5315147 [391] -0.5317410 -0.5319666 -0.5321915 -0.5324157 -0.5326391 -0.5328618 [397] -0.5330838 -0.5333051 -0.5335257 -0.5337455 -0.5339647 > 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/134b51229011425.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/26qm91229011425.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/3wdbr1229011425.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/4x0oa1229011425.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/5wan51229011425.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/68afr1229011425.tab") > > system("convert tmp/134b51229011425.ps tmp/134b51229011425.png") > system("convert tmp/26qm91229011425.ps tmp/26qm91229011425.png") > system("convert tmp/3wdbr1229011425.ps tmp/3wdbr1229011425.png") > system("convert tmp/4x0oa1229011425.ps tmp/4x0oa1229011425.png") > system("convert tmp/5wan51229011425.ps tmp/5wan51229011425.png") > > > proc.time() user system elapsed 1.079 0.776 5.697