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. > y <- c(100.00,98.86,96.87,103.18,104.66,103.74,103.87,98.10,98.91,109.43,104.89,88.63,97.03,93.79,97.61,98.17,96.31,97.82,87.52,85.71,89.15,90.65,92.74,80.00,84.33,93.26,115.89,105.21,94.23,106.12,94.41,101.30,98.43,107.94,102.82,92.33,97.48,88.37,92.50,81.48,92.55,98.96,77.28,91.01,81.21,88.41,96.02,91.59,86.30,86.37,105.41,76.73,93.26,95.02,84.32,93.24,89.81,111.66,103.23,103.21) > x <- c(100.00,127.27,109.09,136.36,100.00,118.18,136.36,100.00,127.27,118.18,136.36,145.45,154.55,100.00,145.45,118.18,154.55,145.45,154.55,172.73,163.64,172.73,145.45,136.36,145.45,145.45,154.55,181.82,181.82,172.73,154.55,163.64,172.73,154.55,181.82,190.91,218.18,227.27,227.27,236.36,200.00,227.27,254.55,254.55,263.64,272.73,281.82,263.64,245.45,200.00,227.27,209.09,236.36,209.09,200.00,163.64,163.64,181.82,145.45,163.64) > #'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.3547625 -0.3550944 -0.3554258 -0.3557569 -0.3560876 -0.3564179 [7] -0.3567479 -0.3570774 -0.3574065 -0.3577352 -0.3580635 -0.3583913 [13] -0.3587188 -0.3590458 -0.3593723 -0.3596984 -0.3600241 -0.3603493 [19] -0.3606740 -0.3609983 -0.3613221 -0.3616455 -0.3619683 -0.3622907 [25] -0.3626125 -0.3629339 -0.3632548 -0.3635751 -0.3638950 -0.3642143 [31] -0.3645331 -0.3648513 -0.3651691 -0.3654862 -0.3658029 -0.3661190 [37] -0.3664345 -0.3667494 -0.3670638 -0.3673776 -0.3676909 -0.3680035 [43] -0.3683156 -0.3686271 -0.3689379 -0.3692482 -0.3695578 -0.3698668 [49] -0.3701753 -0.3704830 -0.3707902 -0.3710967 -0.3714026 -0.3717078 [55] -0.3720123 -0.3723162 -0.3726195 -0.3729220 -0.3732239 -0.3735252 [61] -0.3738257 -0.3741255 -0.3744247 -0.3747231 -0.3750209 -0.3753179 [67] -0.3756142 -0.3759098 -0.3762047 -0.3764989 -0.3767923 -0.3770850 [73] -0.3773769 -0.3776681 -0.3779585 -0.3782482 -0.3785371 -0.3788252 [79] -0.3791125 -0.3793991 -0.3796849 -0.3799699 -0.3802542 -0.3805376 [85] -0.3808202 -0.3811020 -0.3813830 -0.3816632 -0.3819426 -0.3822211 [91] -0.3824988 -0.3827757 -0.3830517 -0.3833269 -0.3836013 -0.3838748 [97] -0.3841474 -0.3844192 -0.3846901 -0.3849601 -0.3852293 -0.3854976 [103] -0.3857650 -0.3860315 -0.3862972 -0.3865619 -0.3868258 -0.3870887 [109] -0.3873507 -0.3876118 -0.3878721 -0.3881313 -0.3883897 -0.3886471 [115] -0.3889037 -0.3891592 -0.3894139 -0.3896676 -0.3899203 -0.3901721 [121] -0.3904229 -0.3906728 -0.3909218 -0.3911697 -0.3914167 -0.3916627 [127] -0.3919078 -0.3921519 -0.3923949 -0.3926370 -0.3928782 -0.3931183 [133] -0.3933574 -0.3935955 -0.3938327 -0.3940688 -0.3943039 -0.3945380 [139] -0.3947711 -0.3950031 -0.3952342 -0.3954642 -0.3956932 -0.3959212 [145] -0.3961481 -0.3963740 -0.3965989 -0.3968227 -0.3970455 -0.3972672 [151] -0.3974879 -0.3977075 -0.3979261 -0.3981436 -0.3983600 -0.3985754 [157] -0.3987897 -0.3990030 -0.3992152 -0.3994263 -0.3996363 -0.3998453 [163] -0.4000532 -0.4002600 -0.4004657 -0.4006703 -0.4008739 -0.4010763 [169] -0.4012777 -0.4014780 -0.4016771 -0.4018752 -0.4020722 -0.4022680 [175] -0.4024628 -0.4026565 -0.4028490 -0.4030405 -0.4032308 -0.4034200 [181] -0.4036081 -0.4037951 -0.4039810 -0.4041657 -0.4043494 -0.4045319 [187] -0.4047133 -0.4048935 -0.4050727 -0.4052507 -0.4054275 -0.4056033 [193] -0.4057779 -0.4059514 -0.4061238 -0.4062950 -0.4064651 -0.4066340 [199] -0.4068018 -0.4069685 -0.4071340 -0.4072984 -0.4074617 -0.4076238 [205] -0.4077848 -0.4079446 -0.4081033 -0.4082608 -0.4084172 -0.4085724 [211] -0.4087265 -0.4088795 -0.4090313 -0.4091820 -0.4093315 -0.4094798 [217] -0.4096271 -0.4097731 -0.4099180 -0.4100618 -0.4102044 -0.4103459 [223] -0.4104862 -0.4106254 -0.4107634 -0.4109003 -0.4110360 -0.4111706 [229] -0.4113040 -0.4114363 -0.4115674 -0.4116974 -0.4118262 -0.4119539 [235] -0.4120804 -0.4122058 -0.4123300 -0.4124531 -0.4125750 -0.4126958 [241] -0.4128154 -0.4129339 -0.4130513 -0.4131675 -0.4132825 -0.4133965 [247] -0.4135092 -0.4136209 -0.4137314 -0.4138407 -0.4139489 -0.4140560 [253] -0.4141619 -0.4142667 -0.4143704 -0.4144729 -0.4145743 -0.4146745 [259] -0.4147737 -0.4148716 -0.4149685 -0.4150642 -0.4151588 -0.4152523 [265] -0.4153447 -0.4154359 -0.4155260 -0.4156150 -0.4157028 -0.4157895 [271] -0.4158752 -0.4159597 -0.4160430 -0.4161253 -0.4162065 -0.4162865 [277] -0.4163655 -0.4164433 -0.4165200 -0.4165956 -0.4166701 -0.4167435 [283] -0.4168158 -0.4168870 -0.4169571 -0.4170262 -0.4170941 -0.4171609 [289] -0.4172266 -0.4172913 -0.4173548 -0.4174173 -0.4174787 -0.4175390 [295] -0.4175983 -0.4176564 -0.4177135 -0.4177695 -0.4178244 -0.4178783 [301] -0.4179311 -0.4179828 -0.4180335 -0.4180831 -0.4181316 -0.4181791 [307] -0.4182255 -0.4182709 -0.4183152 -0.4183585 -0.4184007 -0.4184419 [313] -0.4184820 -0.4185211 -0.4185592 -0.4185962 -0.4186322 -0.4186671 [319] -0.4187011 -0.4187340 -0.4187658 -0.4187967 -0.4188265 -0.4188554 [325] -0.4188832 -0.4189099 -0.4189357 -0.4189605 -0.4189843 -0.4190070 [331] -0.4190288 -0.4190496 -0.4190693 -0.4190881 -0.4191059 -0.4191227 [337] -0.4191385 -0.4191533 -0.4191672 -0.4191801 -0.4191920 -0.4192029 [343] -0.4192129 -0.4192218 -0.4192299 -0.4192369 -0.4192430 -0.4192482 [349] -0.4192524 -0.4192556 -0.4192579 -0.4192592 -0.4192596 -0.4192591 [355] -0.4192576 -0.4192552 -0.4192519 -0.4192476 -0.4192424 -0.4192363 [361] -0.4192292 -0.4192213 -0.4192124 -0.4192026 -0.4191919 -0.4191803 [367] -0.4191678 -0.4191544 -0.4191400 -0.4191248 -0.4191087 -0.4190917 [373] -0.4190738 -0.4190551 -0.4190354 -0.4190149 -0.4189935 -0.4189712 [379] -0.4189480 -0.4189240 -0.4188991 -0.4188734 -0.4188468 -0.4188193 [385] -0.4187910 -0.4187618 -0.4187318 -0.4187009 -0.4186692 -0.4186367 [391] -0.4186033 -0.4185691 -0.4185341 -0.4184982 -0.4184615 -0.4184240 [397] -0.4183856 -0.4183465 -0.4183065 -0.4182657 -0.4182241 > mx [1] 0.4192596 > mxli [1] 1.52 > 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/1urhk1257939744.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/2bc8i1257939744.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/3ht7h1257939744.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/4eehl1257939744.tab") > > system("convert tmp/1urhk1257939744.ps tmp/1urhk1257939744.png") > system("convert tmp/2bc8i1257939744.ps tmp/2bc8i1257939744.png") > system("convert tmp/3ht7h1257939744.ps tmp/3ht7h1257939744.png") > > > proc.time() user system elapsed 0.769 0.491 6.898