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(3032.93,3045.78,3110.52,3013.24,2987.1,2995.55,2833.18,2848.96,2794.83,2845.26,2915.02,2892.63,2604.42,2641.65,2659.81,2638.53,2720.25,2745.88,2735.7,2811.7,2799.43,2555.28,2304.98,2214.95,2065.81,1940.49,2042,1995.37,1946.81,1765.9,1635.25,1833.42,1910.43,1959.67,1969.6,2061.41,2093.48,2120.88,2174.56,2196.72,2350.44,2440.25,2408.64,2472.81,2407.6,2454.62,2448.05,2497.84,2645.64,2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45) > #'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.3510782 0.3516080 0.3521380 0.3526681 0.3531982 0.3537285 0.3542589 [8] 0.3547894 0.3553200 0.3558506 0.3563814 0.3569122 0.3574430 0.3579740 [15] 0.3585049 0.3590360 0.3595670 0.3600981 0.3606292 0.3611603 0.3616915 [22] 0.3622226 0.3627538 0.3632849 0.3638161 0.3643472 0.3648783 0.3654093 [29] 0.3659404 0.3664713 0.3670023 0.3675331 0.3680639 0.3685947 0.3691253 [36] 0.3696559 0.3701864 0.3707168 0.3712470 0.3717772 0.3723073 0.3728372 [43] 0.3733670 0.3738966 0.3744262 0.3749555 0.3754847 0.3760138 0.3765427 [50] 0.3770714 0.3775999 0.3781282 0.3786563 0.3791843 0.3797120 0.3802395 [57] 0.3807667 0.3812938 0.3818206 0.3823471 0.3828734 0.3833995 0.3839253 [64] 0.3844508 0.3849760 0.3855009 0.3860256 0.3865499 0.3870740 0.3875977 [71] 0.3881211 0.3886442 0.3891670 0.3896894 0.3902114 0.3907331 0.3912545 [78] 0.3917755 0.3922961 0.3928163 0.3933361 0.3938556 0.3943746 0.3948932 [85] 0.3954114 0.3959292 0.3964466 0.3969635 0.3974799 0.3979960 0.3985115 [92] 0.3990266 0.3995412 0.4000554 0.4005691 0.4010822 0.4015949 0.4021071 [99] 0.4026187 0.4031299 0.4036405 0.4041505 0.4046601 0.4051691 0.4056775 [106] 0.4061854 0.4066927 0.4071994 0.4077055 0.4082111 0.4087161 0.4092204 [113] 0.4097242 0.4102273 0.4107299 0.4112318 0.4117330 0.4122336 0.4127336 [120] 0.4132329 0.4137316 0.4142296 0.4147269 0.4152235 0.4157195 0.4162147 [127] 0.4167092 0.4172031 0.4176962 0.4181886 0.4186803 0.4191712 0.4196614 [134] 0.4201509 0.4206396 0.4211275 0.4216147 0.4221011 0.4225867 0.4230716 [141] 0.4235556 0.4240389 0.4245213 0.4250029 0.4254838 0.4259638 0.4264429 [148] 0.4269213 0.4273987 0.4278754 0.4283512 0.4288261 0.4293001 0.4297733 [155] 0.4302456 0.4307171 0.4311876 0.4316572 0.4321260 0.4325938 0.4330607 [162] 0.4335267 0.4339917 0.4344559 0.4349191 0.4353813 0.4358426 0.4363030 [169] 0.4367623 0.4372208 0.4376782 0.4381347 0.4385901 0.4390446 0.4394981 [176] 0.4399506 0.4404021 0.4408526 0.4413020 0.4417505 0.4421979 0.4426443 [183] 0.4430896 0.4435339 0.4439771 0.4444193 0.4448605 0.4453005 0.4457395 [190] 0.4461774 0.4466143 0.4470500 0.4474847 0.4479183 0.4483507 0.4487821 [197] 0.4492123 0.4496415 0.4500695 0.4504964 0.4509221 0.4513468 0.4517702 [204] 0.4521926 0.4526138 0.4530338 0.4534527 0.4538704 0.4542870 0.4547024 [211] 0.4551166 0.4555296 0.4559414 0.4563521 0.4567615 0.4571698 0.4575768 [218] 0.4579827 0.4583873 0.4587908 0.4591930 0.4595940 0.4599937 0.4603922 [225] 0.4607895 0.4611856 0.4615804 0.4619740 0.4623663 0.4627573 0.4631471 [232] 0.4635357 0.4639230 0.4643090 0.4646937 0.4650772 0.4654593 0.4658402 [239] 0.4662199 0.4665982 0.4669752 0.4673509 0.4677254 0.4680985 0.4684703 [246] 0.4688408 0.4692100 0.4695779 0.4699445 0.4703097 0.4706736 0.4710362 [253] 0.4713975 0.4717574 0.4721160 0.4724733 0.4728292 0.4731837 0.4735370 [260] 0.4738888 0.4742393 0.4745885 0.4749363 0.4752827 0.4756278 0.4759715 [267] 0.4763139 0.4766549 0.4769945 0.4773327 0.4776695 0.4780050 0.4783391 [274] 0.4786718 0.4790032 0.4793331 0.4796616 0.4799888 0.4803146 0.4806389 [281] 0.4809619 0.4812835 0.4816037 0.4819224 0.4822398 0.4825558 0.4828703 [288] 0.4831835 0.4834952 0.4838055 0.4841144 0.4844219 0.4847280 0.4850327 [295] 0.4853359 0.4856378 0.4859382 0.4862372 0.4865347 0.4868309 0.4871256 [302] 0.4874188 0.4877107 0.4880011 0.4882901 0.4885777 0.4888638 0.4891485 [309] 0.4894318 0.4897136 0.4899940 0.4902730 0.4905505 0.4908266 0.4911013 [316] 0.4913745 0.4916463 0.4919166 0.4921855 0.4924530 0.4927190 0.4929836 [323] 0.4932468 0.4935085 0.4937687 0.4940276 0.4942849 0.4945409 0.4947954 [330] 0.4950484 0.4953000 0.4955502 0.4957989 0.4960462 0.4962921 0.4965365 [337] 0.4967795 0.4970210 0.4972611 0.4974997 0.4977369 0.4979727 0.4982070 [344] 0.4984399 0.4986713 0.4989014 0.4991299 0.4993571 0.4995828 0.4998070 [351] 0.5000299 0.5002513 0.5004712 0.5006897 0.5009068 0.5011225 0.5013367 [358] 0.5015495 0.5017609 0.5019708 0.5021794 0.5023864 0.5025921 0.5027964 [365] 0.5029992 0.5032006 0.5034005 0.5035991 0.5037962 0.5039919 0.5041862 [372] 0.5043791 0.5045706 0.5047606 0.5049493 0.5051365 0.5053223 0.5055068 [379] 0.5056898 0.5058714 0.5060516 0.5062304 0.5064078 0.5065838 0.5067584 [386] 0.5069316 0.5071034 0.5072738 0.5074429 0.5076105 0.5077768 0.5079416 [393] 0.5081051 0.5082672 0.5084279 0.5085873 0.5087452 0.5089018 0.5090571 [400] 0.5092109 0.5093634 > mx [1] 0.5093634 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/17ixy1229169272.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/2tuzx1229169272.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/3hnli1229169273.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/4qffr1229169273.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/5ec6q1229169273.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/6j66o1229169273.tab") > > system("convert tmp/17ixy1229169272.ps tmp/17ixy1229169272.png") > system("convert tmp/2tuzx1229169272.ps tmp/2tuzx1229169272.png") > system("convert tmp/3hnli1229169273.ps tmp/3hnli1229169273.png") > system("convert tmp/4qffr1229169273.ps tmp/4qffr1229169273.png") > system("convert tmp/5ec6q1229169273.ps tmp/5ec6q1229169273.png") > > > proc.time() user system elapsed 1.058 0.778 1.340