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(10519.2,10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16093.4,15413.6,14705.7,15972.8,16241.4,16626.4,17136.2,15622.9,18003.9,16136.1,14423.7,16789.4,16782.2,14133.8,12607,12004.5,12175.4,13268,12299.3,11800.6,13873.3,12315) > #'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.4312115 0.4311381 0.4310646 0.4309910 0.4309173 0.4308434 0.4307695 [8] 0.4306954 0.4306212 0.4305470 0.4304726 0.4303981 0.4303235 0.4302488 [15] 0.4301739 0.4300990 0.4300240 0.4299488 0.4298736 0.4297982 0.4297227 [22] 0.4296471 0.4295715 0.4294957 0.4294198 0.4293438 0.4292677 0.4291914 [29] 0.4291151 0.4290387 0.4289621 0.4288855 0.4288087 0.4287319 0.4286549 [36] 0.4285778 0.4285007 0.4284234 0.4283460 0.4282685 0.4281909 0.4281132 [43] 0.4280354 0.4279575 0.4278795 0.4278014 0.4277232 0.4276449 0.4275664 [50] 0.4274879 0.4274093 0.4273305 0.4272517 0.4271728 0.4270937 0.4270146 [57] 0.4269353 0.4268560 0.4267765 0.4266970 0.4266173 0.4265376 0.4264577 [64] 0.4263778 0.4262977 0.4262176 0.4261373 0.4260569 0.4259765 0.4258959 [71] 0.4258153 0.4257345 0.4256537 0.4255727 0.4254916 0.4254105 0.4253292 [78] 0.4252479 0.4251664 0.4250849 0.4250032 0.4249215 0.4248397 0.4247577 [85] 0.4246757 0.4245935 0.4245113 0.4244290 0.4243466 0.4242640 0.4241814 [92] 0.4240987 0.4240159 0.4239330 0.4238500 0.4237669 0.4236837 0.4236004 [99] 0.4235171 0.4234336 0.4233500 0.4232664 0.4231826 0.4230987 0.4230148 [106] 0.4229308 0.4228466 0.4227624 0.4226781 0.4225937 0.4225092 0.4224246 [113] 0.4223399 0.4222551 0.4221702 0.4220853 0.4220002 0.4219151 0.4218298 [120] 0.4217445 0.4216591 0.4215736 0.4214880 0.4214023 0.4213165 0.4212306 [127] 0.4211447 0.4210586 0.4209725 0.4208863 0.4208000 0.4207136 0.4206271 [134] 0.4205405 0.4204538 0.4203671 0.4202802 0.4201933 0.4201063 0.4200192 [141] 0.4199320 0.4198447 0.4197573 0.4196699 0.4195823 0.4194947 0.4194070 [148] 0.4193192 0.4192313 0.4191433 0.4190553 0.4189672 0.4188789 0.4187906 [155] 0.4187022 0.4186138 0.4185252 0.4184366 0.4183479 0.4182590 0.4181702 [162] 0.4180812 0.4179921 0.4179030 0.4178138 0.4177245 0.4176351 0.4175456 [169] 0.4174561 0.4173665 0.4172768 0.4171870 0.4170971 0.4170071 0.4169171 [176] 0.4168270 0.4167368 0.4166466 0.4165562 0.4164658 0.4163753 0.4162847 [183] 0.4161940 0.4161033 0.4160125 0.4159216 0.4158306 0.4157395 0.4156484 [190] 0.4155572 0.4154659 0.4153746 0.4152831 0.4151916 0.4151000 0.4150084 [197] 0.4149166 0.4148248 0.4147329 0.4146409 0.4145489 0.4144568 0.4143646 [204] 0.4142723 0.4141800 0.4140876 0.4139951 0.4139025 0.4138099 0.4137172 [211] 0.4136244 0.4135316 0.4134387 0.4133457 0.4132526 0.4131595 0.4130663 [218] 0.4129730 0.4128796 0.4127862 0.4126927 0.4125991 0.4125055 0.4124118 [225] 0.4123180 0.4122242 0.4121303 0.4120363 0.4119422 0.4118481 0.4117539 [232] 0.4116597 0.4115653 0.4114710 0.4113765 0.4112820 0.4111874 0.4110927 [239] 0.4109980 0.4109032 0.4108083 0.4107134 0.4106184 0.4105233 0.4104282 [246] 0.4103330 0.4102378 0.4101424 0.4100470 0.4099516 0.4098561 0.4097605 [253] 0.4096648 0.4095691 0.4094734 0.4093775 0.4092816 0.4091857 0.4090896 [260] 0.4089935 0.4088974 0.4088012 0.4087049 0.4086086 0.4085122 0.4084157 [267] 0.4083192 0.4082226 0.4081260 0.4080293 0.4079325 0.4078357 0.4077388 [274] 0.4076419 0.4075449 0.4074478 0.4073507 0.4072535 0.4071563 0.4070590 [281] 0.4069616 0.4068642 0.4067667 0.4066692 0.4065716 0.4064740 0.4063763 [288] 0.4062785 0.4061807 0.4060828 0.4059849 0.4058869 0.4057889 0.4056908 [295] 0.4055926 0.4054944 0.4053962 0.4052978 0.4051995 0.4051011 0.4050026 [302] 0.4049040 0.4048055 0.4047068 0.4046081 0.4045094 0.4044106 0.4043117 [309] 0.4042128 0.4041139 0.4040149 0.4039158 0.4038167 0.4037175 0.4036183 [316] 0.4035191 0.4034197 0.4033204 0.4032210 0.4031215 0.4030220 0.4029224 [323] 0.4028228 0.4027231 0.4026234 0.4025236 0.4024238 0.4023239 0.4022240 [330] 0.4021241 0.4020241 0.4019240 0.4018239 0.4017237 0.4016235 0.4015233 [337] 0.4014230 0.4013227 0.4012223 0.4011218 0.4010214 0.4009208 0.4008203 [344] 0.4007196 0.4006190 0.4005183 0.4004175 0.4003167 0.4002159 0.4001150 [351] 0.4000141 0.3999131 0.3998121 0.3997110 0.3996099 0.3995087 0.3994076 [358] 0.3993063 0.3992050 0.3991037 0.3990024 0.3989010 0.3987995 0.3986980 [365] 0.3985965 0.3984949 0.3983933 0.3982916 0.3981899 0.3980882 0.3979864 [372] 0.3978846 0.3977828 0.3976809 0.3975789 0.3974770 0.3973749 0.3972729 [379] 0.3971708 0.3970687 0.3969665 0.3968643 0.3967620 0.3966598 0.3965574 [386] 0.3964551 0.3963527 0.3962502 0.3961478 0.3960453 0.3959427 0.3958401 [393] 0.3957375 0.3956349 0.3955322 0.3954294 0.3953267 0.3952239 0.3951210 [400] 0.3950182 0.3949153 > mx [1] 0.4312115 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1guo81258046217.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/2jne11258046217.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/31v8y1258046217.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/4tblg1258046217.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/580xu1258046217.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/6p9ms1258046217.tab") > > system("convert tmp/1guo81258046217.ps tmp/1guo81258046217.png") > system("convert tmp/2jne11258046217.ps tmp/2jne11258046217.png") > system("convert tmp/31v8y1258046217.ps tmp/31v8y1258046217.png") > system("convert tmp/4tblg1258046217.ps tmp/4tblg1258046217.png") > system("convert tmp/580xu1258046217.ps tmp/580xu1258046217.png") > > > proc.time() user system elapsed 1.094 0.775 1.303