R version 2.7.2 (2008-08-25) 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. > y <- c(5014,6153,6441,5584,6427,6062,5589,6216,5809,4989,6706,7174,6122,8075,6292,6337,8576,6077,5931,6288,7167,6054,6468,6401,6927,7914,7728,8699,8522,6481,7502,7778,7424,6941,8574,9169,7701,9035,7158,8195,8124,7073,7017,7390,7776,6197,6889,7087,6485,7654,6501,6313,7826,6589,6729,5684,8105,6391,5901,6758) > x <- c(2400,4700,3700,2900,2800,3000,3100,3700,3000,2000,1900,1900,1800,3400,3800,2800,3100,2100,2000,2500,2400,2500,3300,3100,3700,5600,3700,2900,4000,2900,2400,3300,3800,4400,4000,3100,2700,5200,4600,3700,3200,2400,2200,3200,3100,2300,2500,2900,2700,5000,3500,3000,3800,2800,2400,2700,2800,2700,2600,3100) > #'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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] 0.4101674 0.4103965 0.4106249 0.4108525 0.4110795 0.4113056 0.4115311 [8] 0.4117558 0.4119797 0.4122029 0.4124254 0.4126471 0.4128680 0.4130881 [15] 0.4133075 0.4135260 0.4137438 0.4139608 0.4141770 0.4143925 0.4146071 [22] 0.4148208 0.4150338 0.4152460 0.4154573 0.4156678 0.4158775 0.4160863 [29] 0.4162943 0.4165014 0.4167077 0.4169131 0.4171177 0.4173214 0.4175242 [36] 0.4177261 0.4179272 0.4181273 0.4183266 0.4185250 0.4187225 0.4189191 [43] 0.4191148 0.4193095 0.4195034 0.4196963 0.4198883 0.4200793 0.4202695 [50] 0.4204586 0.4206469 0.4208342 0.4210205 0.4212058 0.4213902 0.4215737 [57] 0.4217561 0.4219376 0.4221181 0.4222976 0.4224762 0.4226537 0.4228302 [64] 0.4230057 0.4231803 0.4233538 0.4235263 0.4236977 0.4238682 0.4240376 [71] 0.4242059 0.4243733 0.4245396 0.4247048 0.4248690 0.4250321 0.4251942 [78] 0.4253552 0.4255152 0.4256741 0.4258319 0.4259886 0.4261442 0.4262988 [85] 0.4264522 0.4266046 0.4267558 0.4269060 0.4270550 0.4272030 0.4273498 [92] 0.4274955 0.4276401 0.4277835 0.4279258 0.4280670 0.4282070 0.4283459 [99] 0.4284837 0.4286203 0.4287558 0.4288900 0.4290232 0.4291551 0.4292859 [106] 0.4294156 0.4295440 0.4296713 0.4297974 0.4299223 0.4300460 0.4301686 [113] 0.4302899 0.4304100 0.4305290 0.4306467 0.4307632 0.4308786 0.4309927 [120] 0.4311055 0.4312172 0.4313276 0.4314368 0.4315448 0.4316516 0.4317571 [127] 0.4318614 0.4319644 0.4320662 0.4321667 0.4322660 0.4323641 0.4324608 [134] 0.4325564 0.4326506 0.4327436 0.4328354 0.4329258 0.4330150 0.4331030 [141] 0.4331896 0.4332750 0.4333591 0.4334419 0.4335234 0.4336037 0.4336826 [148] 0.4337603 0.4338366 0.4339117 0.4339855 0.4340579 0.4341291 0.4341990 [155] 0.4342675 0.4343348 0.4344007 0.4344653 0.4345287 0.4345907 0.4346513 [162] 0.4347107 0.4347688 0.4348255 0.4348809 0.4349350 0.4349877 0.4350391 [169] 0.4350892 0.4351380 0.4351854 0.4352315 0.4352763 0.4353197 0.4353618 [176] 0.4354026 0.4354420 0.4354801 0.4355168 0.4355522 0.4355863 0.4356190 [183] 0.4356504 0.4356804 0.4357091 0.4357364 0.4357624 0.4357870 0.4358103 [190] 0.4358323 0.4358529 0.4358721 0.4358900 0.4359065 0.4359217 0.4359356 [197] 0.4359481 0.4359592 0.4359690 0.4359775 0.4359845 0.4359903 0.4359947 [204] 0.4359977 0.4359994 0.4359997 0.4359987 0.4359963 0.4359926 0.4359875 [211] 0.4359811 0.4359734 0.4359642 0.4359538 0.4359420 0.4359288 0.4359143 [218] 0.4358985 0.4358813 0.4358627 0.4358428 0.4358216 0.4357991 0.4357752 [225] 0.4357499 0.4357233 0.4356954 0.4356661 0.4356355 0.4356036 0.4355704 [232] 0.4355358 0.4354998 0.4354626 0.4354240 0.4353841 0.4353429 0.4353003 [239] 0.4352564 0.4352112 0.4351647 0.4351169 0.4350678 0.4350173 0.4349655 [246] 0.4349125 0.4348581 0.4348024 0.4347454 0.4346871 0.4346275 0.4345666 [253] 0.4345044 0.4344409 0.4343762 0.4343101 0.4342428 0.4341741 0.4341042 [260] 0.4340330 0.4339606 0.4338868 0.4338118 0.4337355 0.4336580 0.4335792 [267] 0.4334991 0.4334178 0.4333352 0.4332513 0.4331662 0.4330799 0.4329923 [274] 0.4329035 0.4328134 0.4327221 0.4326296 0.4325359 0.4324409 0.4323447 [281] 0.4322473 0.4321486 0.4320488 0.4319477 0.4318454 0.4317420 0.4316373 [288] 0.4315314 0.4314244 0.4313161 0.4312067 0.4310961 0.4309843 0.4308713 [295] 0.4307572 0.4306419 0.4305254 0.4304078 0.4302890 0.4301691 0.4300480 [302] 0.4299257 0.4298024 0.4296779 0.4295522 0.4294255 0.4292976 0.4291686 [309] 0.4290384 0.4289072 0.4287748 0.4286414 0.4285068 0.4283712 0.4282344 [316] 0.4280966 0.4279577 0.4278177 0.4276767 0.4275345 0.4273913 0.4272471 [323] 0.4271018 0.4269554 0.4268080 0.4266595 0.4265100 0.4263595 0.4262080 [330] 0.4260554 0.4259018 0.4257472 0.4255916 0.4254349 0.4252773 0.4251187 [337] 0.4249590 0.4247984 0.4246369 0.4244743 0.4243108 0.4241463 0.4239808 [344] 0.4238144 0.4236470 0.4234787 0.4233094 0.4231392 0.4229681 0.4227960 [351] 0.4226230 0.4224491 0.4222743 0.4220986 0.4219219 0.4217444 0.4215660 [358] 0.4213867 0.4212065 0.4210254 0.4208435 0.4206607 0.4204770 0.4202925 [365] 0.4201071 0.4199209 0.4197339 0.4195460 0.4193572 0.4191677 0.4189773 [372] 0.4187861 0.4185942 0.4184014 0.4182078 0.4180134 0.4178182 0.4176222 [379] 0.4174255 0.4172280 0.4170297 0.4168307 0.4166309 0.4164303 0.4162290 [386] 0.4160270 0.4158242 0.4156208 0.4154165 0.4152116 0.4150059 0.4147996 [393] 0.4145925 0.4143848 0.4141763 0.4139672 0.4137574 0.4135469 0.4133357 [400] 0.4131239 0.4129114 > mx [1] 0.4359997 > mxli [1] 0.05 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > r<-lm(y~x) > se <- sqrt(var(r$residuals)) > r1 <- lm(y~x1) > se1 <- sqrt(var(r1$residuals)) > postscript(file="/var/www/html/rcomp/tmp/17y411226431860.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2wezp1226431860.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') > abline(r) > grid() > mtext(paste('Residual Standard Deviation = ',se)) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3pzym1226431860.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') > abline(r1) > grid() > mtext(paste('Residual Standard Deviation = ',se1)) > 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 Linearity 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(x)',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (orginial)',header=TRUE) > a<-table.element(a,se) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (transformed)',header=TRUE) > a<-table.element(a,se1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/4mmz41226431860.tab") > > system("convert tmp/17y411226431860.ps tmp/17y411226431860.png") > system("convert tmp/2wezp1226431860.ps tmp/2wezp1226431860.png") > system("convert tmp/3pzym1226431860.ps tmp/3pzym1226431860.png") > > > proc.time() user system elapsed 1.045 0.522 3.884