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(377.2,332.2,364.8,352.4,341.6,298.2,355.3,330.9,314.5,418.9,433.2,367,422.9,352.1,419.8,432.7,414.2,387.7,297.2,357.4,384.2,425.2,385.3,355.4,409.8,421.2,421.8,464.2,494,404.2,411.4,403.4,403.3,520.9,439.8,434.8,476.5,454.3,522,498.4,439.9,450.7,447.1,451.3,466.8,498,533.6,451.9,477.1,410.4,469.5,485.4,406.7,439.7,412.2,440.2,411.1,477.7,463.2,320.5) > x <- c(156.4,143.1,148.9,134,118,125.3,138,114,109.9,151.5,129.1,121.7,126.1,114.3,124.7,111.9,120,119.5,137.8,105.4,135.4,182.5,129.6,147.5,128.9,119.7,149.4,136.6,118.6,121.4,138.9,109.5,131.7,160.3,138.1,136.7,126.6,138,152,137,134.9,154.4,145.2,133.1,169.6,159.3,124.9,138.1,162.5,136.6,148.1,142,137.9,152.5,182.8,135.3,141.8,151.7,140.6,128) > #'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.3759707 0.3759431 0.3759153 0.3758872 0.3758588 0.3758302 0.3758013 [8] 0.3757721 0.3757427 0.3757129 0.3756830 0.3756527 0.3756222 0.3755914 [15] 0.3755604 0.3755290 0.3754974 0.3754656 0.3754334 0.3754010 0.3753683 [22] 0.3753353 0.3753021 0.3752686 0.3752348 0.3752007 0.3751664 0.3751318 [29] 0.3750969 0.3750617 0.3750263 0.3749905 0.3749545 0.3749183 0.3748817 [36] 0.3748449 0.3748078 0.3747704 0.3747327 0.3746947 0.3746565 0.3746180 [43] 0.3745792 0.3745401 0.3745007 0.3744611 0.3744212 0.3743810 0.3743405 [50] 0.3742997 0.3742586 0.3742173 0.3741756 0.3741337 0.3740915 0.3740490 [57] 0.3740062 0.3739632 0.3739198 0.3738762 0.3738323 0.3737881 0.3737436 [64] 0.3736988 0.3736537 0.3736083 0.3735627 0.3735167 0.3734705 0.3734239 [71] 0.3733771 0.3733300 0.3732826 0.3732349 0.3731869 0.3731386 0.3730900 [78] 0.3730412 0.3729920 0.3729425 0.3728928 0.3728427 0.3727924 0.3727417 [85] 0.3726908 0.3726396 0.3725881 0.3725362 0.3724841 0.3724317 0.3723790 [92] 0.3723260 0.3722726 0.3722190 0.3721651 0.3721109 0.3720564 0.3720016 [99] 0.3719465 0.3718911 0.3718353 0.3717793 0.3717230 0.3716664 0.3716095 [106] 0.3715523 0.3714947 0.3714369 0.3713788 0.3713204 0.3712616 0.3712026 [113] 0.3711432 0.3710836 0.3710236 0.3709634 0.3709028 0.3708419 0.3707808 [120] 0.3707193 0.3706575 0.3705954 0.3705330 0.3704703 0.3704073 0.3703439 [127] 0.3702803 0.3702164 0.3701521 0.3700876 0.3700227 0.3699575 0.3698920 [134] 0.3698262 0.3697601 0.3696937 0.3696270 0.3695600 0.3694926 0.3694249 [141] 0.3693570 0.3692887 0.3692201 0.3691512 0.3690820 0.3690124 0.3689426 [148] 0.3688724 0.3688020 0.3687312 0.3686601 0.3685887 0.3685169 0.3684449 [155] 0.3683725 0.3682999 0.3682269 0.3681536 0.3680800 0.3680060 0.3679318 [162] 0.3678572 0.3677823 0.3677071 0.3676316 0.3675558 0.3674797 0.3674032 [169] 0.3673264 0.3672493 0.3671719 0.3670942 0.3670161 0.3669377 0.3668590 [176] 0.3667800 0.3667007 0.3666211 0.3665411 0.3664608 0.3663802 0.3662993 [183] 0.3662180 0.3661365 0.3660546 0.3659724 0.3658898 0.3658070 0.3657238 [190] 0.3656403 0.3655565 0.3654724 0.3653879 0.3653032 0.3652181 0.3651327 [197] 0.3650469 0.3649609 0.3648745 0.3647878 0.3647008 0.3646134 0.3645257 [204] 0.3644377 0.3643494 0.3642608 0.3641718 0.3640825 0.3639929 0.3639030 [211] 0.3638127 0.3637221 0.3636312 0.3635400 0.3634485 0.3633566 0.3632644 [218] 0.3631719 0.3630790 0.3629858 0.3628923 0.3627985 0.3627044 0.3626099 [225] 0.3625151 0.3624200 0.3623245 0.3622288 0.3621327 0.3620362 0.3619395 [232] 0.3618424 0.3617450 0.3616473 0.3615493 0.3614509 0.3613522 0.3612532 [239] 0.3611538 0.3610541 0.3609541 0.3608538 0.3607532 0.3606522 0.3605509 [246] 0.3604493 0.3603473 0.3602450 0.3601424 0.3600395 0.3599362 0.3598327 [253] 0.3597287 0.3596245 0.3595199 0.3594151 0.3593099 0.3592043 0.3590984 [260] 0.3589923 0.3588857 0.3587789 0.3586717 0.3585642 0.3584564 0.3583483 [267] 0.3582398 0.3581310 0.3580219 0.3579124 0.3578027 0.3576926 0.3575822 [274] 0.3574714 0.3573603 0.3572489 0.3571372 0.3570252 0.3569128 0.3568001 [281] 0.3566871 0.3565737 0.3564600 0.3563460 0.3562317 0.3561171 0.3560021 [288] 0.3558868 0.3557712 0.3556552 0.3555389 0.3554223 0.3553054 0.3551882 [295] 0.3550706 0.3549527 0.3548345 0.3547160 0.3545971 0.3544779 0.3543584 [302] 0.3542386 0.3541184 0.3539979 0.3538771 0.3537560 0.3536345 0.3535128 [309] 0.3533907 0.3532683 0.3531455 0.3530225 0.3528991 0.3527754 0.3526514 [316] 0.3525270 0.3524023 0.3522773 0.3521520 0.3520264 0.3519005 0.3517742 [323] 0.3516476 0.3515207 0.3513934 0.3512659 0.3511380 0.3510098 0.3508813 [330] 0.3507525 0.3506233 0.3504939 0.3503641 0.3502340 0.3501036 0.3499728 [337] 0.3498418 0.3497104 0.3495787 0.3494467 0.3493143 0.3491817 0.3490487 [344] 0.3489155 0.3487819 0.3486480 0.3485137 0.3483792 0.3482443 0.3481092 [351] 0.3479737 0.3478379 0.3477018 0.3475654 0.3474286 0.3472916 0.3471542 [358] 0.3470165 0.3468785 0.3467402 0.3466016 0.3464627 0.3463234 0.3461839 [365] 0.3460440 0.3459038 0.3457633 0.3456225 0.3454814 0.3453400 0.3451983 [372] 0.3450563 0.3449139 0.3447713 0.3446283 0.3444850 0.3443415 0.3441976 [379] 0.3440534 0.3439089 0.3437641 0.3436190 0.3434736 0.3433279 0.3431818 [386] 0.3430355 0.3428889 0.3427419 0.3425947 0.3424471 0.3422993 0.3421511 [393] 0.3420027 0.3418539 0.3417049 0.3415555 0.3414059 0.3412559 0.3411056 [400] 0.3409551 0.3408042 > mx [1] 0.3759707 > mxli [1] -2 > 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/13hzf1226521341.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/2i6211226521341.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/34cwi1226521341.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/4ytv81226521341.tab") > > system("convert tmp/13hzf1226521341.ps tmp/13hzf1226521341.png") > system("convert tmp/2i6211226521341.ps tmp/2i6211226521341.png") > system("convert tmp/34cwi1226521341.ps tmp/34cwi1226521341.png") > > > proc.time() user system elapsed 0.986 0.502 1.187