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(20.7,21.2,20.7,19.6,18.6,18.7,23.8,24.9,24.8,23.8,22.3,21.7,20.7,19.7,18.4,17.4,17,18,23.8,25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3) > #'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.4363498 -0.4363425 -0.4363346 -0.4363262 -0.4363172 -0.4363077 [7] -0.4362976 -0.4362870 -0.4362758 -0.4362640 -0.4362517 -0.4362388 [13] -0.4362254 -0.4362114 -0.4361968 -0.4361817 -0.4361661 -0.4361499 [19] -0.4361331 -0.4361158 -0.4360979 -0.4360795 -0.4360605 -0.4360410 [25] -0.4360209 -0.4360003 -0.4359791 -0.4359574 -0.4359352 -0.4359123 [31] -0.4358890 -0.4358651 -0.4358406 -0.4358156 -0.4357901 -0.4357640 [37] -0.4357374 -0.4357102 -0.4356825 -0.4356543 -0.4356255 -0.4355962 [43] -0.4355663 -0.4355359 -0.4355050 -0.4354735 -0.4354415 -0.4354090 [49] -0.4353759 -0.4353423 -0.4353082 -0.4352735 -0.4352383 -0.4352026 [55] -0.4351663 -0.4351295 -0.4350922 -0.4350544 -0.4350160 -0.4349771 [61] -0.4349377 -0.4348978 -0.4348573 -0.4348163 -0.4347748 -0.4347328 [67] -0.4346902 -0.4346472 -0.4346036 -0.4345595 -0.4345149 -0.4344698 [73] -0.4344241 -0.4343780 -0.4343313 -0.4342841 -0.4342364 -0.4341883 [79] -0.4341395 -0.4340903 -0.4340406 -0.4339904 -0.4339397 -0.4338884 [85] -0.4338367 -0.4337845 -0.4337317 -0.4336785 -0.4336248 -0.4335705 [91] -0.4335158 -0.4334606 -0.4334048 -0.4333486 -0.4332919 -0.4332347 [97] -0.4331770 -0.4331188 -0.4330602 -0.4330010 -0.4329414 -0.4328812 [103] -0.4328206 -0.4327595 -0.4326979 -0.4326359 -0.4325733 -0.4325103 [109] -0.4324468 -0.4323828 -0.4323184 -0.4322535 -0.4321880 -0.4321222 [115] -0.4320558 -0.4319890 -0.4319217 -0.4318540 -0.4317857 -0.4317170 [121] -0.4316479 -0.4315783 -0.4315082 -0.4314376 -0.4313666 -0.4312952 [127] -0.4312232 -0.4311509 -0.4310780 -0.4310047 -0.4309310 -0.4308568 [133] -0.4307821 -0.4307070 -0.4306315 -0.4305555 -0.4304790 -0.4304021 [139] -0.4303248 -0.4302470 -0.4301688 -0.4300901 -0.4300110 -0.4299315 [145] -0.4298515 -0.4297711 -0.4296903 -0.4296090 -0.4295273 -0.4294451 [151] -0.4293625 -0.4292795 -0.4291961 -0.4291123 -0.4290280 -0.4289433 [157] -0.4288581 -0.4287726 -0.4286866 -0.4286002 -0.4285134 -0.4284262 [163] -0.4283386 -0.4282505 -0.4281620 -0.4280732 -0.4279839 -0.4278942 [169] -0.4278041 -0.4277136 -0.4276226 -0.4275313 -0.4274396 -0.4273475 [175] -0.4272550 -0.4271620 -0.4270687 -0.4269750 -0.4268809 -0.4267864 [181] -0.4266915 -0.4265962 -0.4265005 -0.4264045 -0.4263080 -0.4262112 [187] -0.4261140 -0.4260164 -0.4259184 -0.4258200 -0.4257213 -0.4256222 [193] -0.4255227 -0.4254228 -0.4253225 -0.4252219 -0.4251209 -0.4250196 [199] -0.4249178 -0.4248157 -0.4247133 -0.4246104 -0.4245073 -0.4244037 [205] -0.4242998 -0.4241955 -0.4240909 -0.4239859 -0.4238805 -0.4237749 [211] -0.4236688 -0.4235624 -0.4234556 -0.4233485 -0.4232411 -0.4231333 [217] -0.4230252 -0.4229167 -0.4228079 -0.4226987 -0.4225892 -0.4224794 [223] -0.4223692 -0.4222587 -0.4221478 -0.4220366 -0.4219251 -0.4218133 [229] -0.4217011 -0.4215886 -0.4214758 -0.4213627 -0.4212492 -0.4211354 [235] -0.4210213 -0.4209068 -0.4207921 -0.4206770 -0.4205617 -0.4204460 [241] -0.4203300 -0.4202136 -0.4200970 -0.4199801 -0.4198628 -0.4197453 [247] -0.4196274 -0.4195093 -0.4193908 -0.4192721 -0.4191530 -0.4190337 [253] -0.4189140 -0.4187941 -0.4186738 -0.4185533 -0.4184325 -0.4183114 [259] -0.4181900 -0.4180683 -0.4179463 -0.4178241 -0.4177015 -0.4175787 [265] -0.4174556 -0.4173322 -0.4172086 -0.4170847 -0.4169605 -0.4168360 [271] -0.4167112 -0.4165862 -0.4164609 -0.4163354 -0.4162095 -0.4160835 [277] -0.4159571 -0.4158305 -0.4157036 -0.4155765 -0.4154491 -0.4153214 [283] -0.4151935 -0.4150653 -0.4149369 -0.4148083 -0.4146793 -0.4145502 [289] -0.4144208 -0.4142911 -0.4141612 -0.4140310 -0.4139006 -0.4137700 [295] -0.4136391 -0.4135080 -0.4133767 -0.4132451 -0.4131132 -0.4129812 [301] -0.4128489 -0.4127164 -0.4125836 -0.4124506 -0.4123174 -0.4121840 [307] -0.4120504 -0.4119165 -0.4117824 -0.4116481 -0.4115135 -0.4113788 [313] -0.4112438 -0.4111086 -0.4109732 -0.4108376 -0.4107017 -0.4105657 [319] -0.4104294 -0.4102930 -0.4101563 -0.4100195 -0.4098824 -0.4097451 [325] -0.4096076 -0.4094700 -0.4093321 -0.4091940 -0.4090557 -0.4089173 [331] -0.4087786 -0.4086398 -0.4085007 -0.4083615 -0.4082221 -0.4080825 [337] -0.4079427 -0.4078027 -0.4076625 -0.4075222 -0.4073817 -0.4072410 [343] -0.4071001 -0.4069590 -0.4068178 -0.4066764 -0.4065348 -0.4063930 [349] -0.4062511 -0.4061090 -0.4059667 -0.4058243 -0.4056817 -0.4055389 [355] -0.4053959 -0.4052528 -0.4051096 -0.4049662 -0.4048226 -0.4046788 [361] -0.4045349 -0.4043909 -0.4042467 -0.4041023 -0.4039578 -0.4038132 [367] -0.4036683 -0.4035234 -0.4033783 -0.4032330 -0.4030876 -0.4029421 [373] -0.4027964 -0.4026505 -0.4025046 -0.4023585 -0.4022122 -0.4020658 [379] -0.4019193 -0.4017726 -0.4016259 -0.4014789 -0.4013319 -0.4011847 [385] -0.4010374 -0.4008899 -0.4007424 -0.4005947 -0.4004469 -0.4002989 [391] -0.4001509 -0.4000027 -0.3998544 -0.3997059 -0.3995574 -0.3994087 [397] -0.3992600 -0.3991111 -0.3989621 -0.3988129 -0.3986637 > 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/1f0sn1258133105.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/2sb6h1258133105.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/31jvc1258133105.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/4e6ye1258133105.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/5i5km1258133105.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/665c91258133105.tab") > > system("convert tmp/1f0sn1258133105.ps tmp/1f0sn1258133105.png") > system("convert tmp/2sb6h1258133105.ps tmp/2sb6h1258133105.png") > system("convert tmp/31jvc1258133105.ps tmp/31jvc1258133105.png") > system("convert tmp/4e6ye1258133105.ps tmp/4e6ye1258133105.png") > system("convert tmp/5i5km1258133105.ps tmp/5i5km1258133105.png") > > > proc.time() user system elapsed 1.127 0.813 1.421