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(34.97,34.97,34.93,34.92,34.97,34.97,34.97,35.38,35.64,35.9,36.01,36.03,36.04,36.06,36.09,36.15,36.15,36.15,36.1,36.38,36.89,37,37.09,37.13,37.24,37.29,37.34,37.49,37.49,37.54,37.67,38.13,38.68,38.77,39,39.03,39.03,39.04,39.16,39.23,39.26,39.25,39.41,39.56,39.69,39.87,39.83,39.84,39.85,39.91,40.62,40.73,40.86,40.89,40.9,41.15,41.24,41.24,41.33,41.36) > x <- c(433,344,357,385,392,308,294,302,400,392,373,379,303,324,353,392,327,376,329,359,413,338,422,390,370,367,406,418,346,350,329,318,381,337,372,422,427,426,396,458,314,336,385,351,381,438,397,451,362,363,468,371,407,391,364,366,424,364,366,423) > #'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.3655142 0.3654790 0.3654436 0.3654083 0.3653728 0.3653373 0.3653017 [8] 0.3652660 0.3652303 0.3651945 0.3651586 0.3651227 0.3650867 0.3650506 [15] 0.3650144 0.3649782 0.3649419 0.3649056 0.3648692 0.3648327 0.3647961 [22] 0.3647595 0.3647228 0.3646860 0.3646492 0.3646123 0.3645753 0.3645383 [29] 0.3645012 0.3644640 0.3644268 0.3643895 0.3643521 0.3643146 0.3642771 [36] 0.3642396 0.3642019 0.3641642 0.3641264 0.3640886 0.3640507 0.3640127 [43] 0.3639746 0.3639365 0.3638984 0.3638601 0.3638218 0.3637834 0.3637450 [50] 0.3637065 0.3636679 0.3636292 0.3635905 0.3635517 0.3635129 0.3634740 [57] 0.3634350 0.3633960 0.3633569 0.3633177 0.3632784 0.3632391 0.3631998 [64] 0.3631603 0.3631208 0.3630813 0.3630416 0.3630019 0.3629622 0.3629223 [71] 0.3628825 0.3628425 0.3628025 0.3627624 0.3627222 0.3626820 0.3626418 [78] 0.3626014 0.3625610 0.3625205 0.3624800 0.3624394 0.3623987 0.3623580 [85] 0.3623172 0.3622764 0.3622354 0.3621945 0.3621534 0.3621123 0.3620711 [92] 0.3620299 0.3619886 0.3619472 0.3619058 0.3618643 0.3618228 0.3617812 [99] 0.3617395 0.3616978 0.3616560 0.3616141 0.3615722 0.3615302 0.3614881 [106] 0.3614460 0.3614039 0.3613616 0.3613193 0.3612770 0.3612346 0.3611921 [113] 0.3611495 0.3611069 0.3610643 0.3610216 0.3609788 0.3609359 0.3608930 [120] 0.3608501 0.3608070 0.3607639 0.3607208 0.3606776 0.3606343 0.3605910 [127] 0.3605476 0.3605041 0.3604606 0.3604171 0.3603734 0.3603298 0.3602860 [134] 0.3602422 0.3601983 0.3601544 0.3601104 0.3600664 0.3600223 0.3599781 [141] 0.3599339 0.3598896 0.3598453 0.3598009 0.3597564 0.3597119 0.3596674 [148] 0.3596227 0.3595781 0.3595333 0.3594885 0.3594437 0.3593987 0.3593538 [155] 0.3593087 0.3592637 0.3592185 0.3591733 0.3591281 0.3590827 0.3590374 [162] 0.3589919 0.3589465 0.3589009 0.3588553 0.3588097 0.3587640 0.3587182 [169] 0.3586724 0.3586265 0.3585806 0.3585346 0.3584885 0.3584424 0.3583963 [176] 0.3583501 0.3583038 0.3582575 0.3582111 0.3581647 0.3581182 0.3580717 [183] 0.3580251 0.3579785 0.3579318 0.3578850 0.3578382 0.3577913 0.3577444 [190] 0.3576975 0.3576504 0.3576034 0.3575562 0.3575091 0.3574618 0.3574145 [197] 0.3573672 0.3573198 0.3572724 0.3572249 0.3571773 0.3571297 0.3570821 [204] 0.3570344 0.3569866 0.3569388 0.3568910 0.3568430 0.3567951 0.3567471 [211] 0.3566990 0.3566509 0.3566027 0.3565545 0.3565062 0.3564579 0.3564095 [218] 0.3563611 0.3563127 0.3562641 0.3562156 0.3561669 0.3561183 0.3560696 [225] 0.3560208 0.3559720 0.3559231 0.3558742 0.3558252 0.3557762 0.3557271 [232] 0.3556780 0.3556289 0.3555797 0.3555304 0.3554811 0.3554317 0.3553823 [239] 0.3553329 0.3552834 0.3552338 0.3551843 0.3551346 0.3550849 0.3550352 [246] 0.3549854 0.3549356 0.3548857 0.3548358 0.3547858 0.3547358 0.3546857 [253] 0.3546356 0.3545855 0.3545353 0.3544850 0.3544347 0.3543844 0.3543340 [260] 0.3542836 0.3542331 0.3541826 0.3541320 0.3540814 0.3540308 0.3539801 [267] 0.3539293 0.3538786 0.3538277 0.3537769 0.3537259 0.3536750 0.3536240 [274] 0.3535729 0.3535218 0.3534707 0.3534195 0.3533683 0.3533170 0.3532657 [281] 0.3532144 0.3531630 0.3531115 0.3530601 0.3530085 0.3529570 0.3529054 [288] 0.3528537 0.3528020 0.3527503 0.3526985 0.3526467 0.3525949 0.3525430 [295] 0.3524910 0.3524391 0.3523870 0.3523350 0.3522829 0.3522307 0.3521786 [302] 0.3521263 0.3520741 0.3520218 0.3519694 0.3519171 0.3518646 0.3518122 [309] 0.3517597 0.3517072 0.3516546 0.3516020 0.3515493 0.3514966 0.3514439 [316] 0.3513911 0.3513383 0.3512855 0.3512326 0.3511797 0.3511267 0.3510737 [323] 0.3510207 0.3509676 0.3509145 0.3508614 0.3508082 0.3507550 0.3507017 [330] 0.3506484 0.3505951 0.3505418 0.3504884 0.3504349 0.3503815 0.3503280 [337] 0.3502744 0.3502208 0.3501672 0.3501136 0.3500599 0.3500062 0.3499524 [344] 0.3498986 0.3498448 0.3497910 0.3497371 0.3496831 0.3496292 0.3495752 [351] 0.3495212 0.3494671 0.3494130 0.3493589 0.3493047 0.3492505 0.3491963 [358] 0.3491421 0.3490878 0.3490334 0.3489791 0.3489247 0.3488703 0.3488158 [365] 0.3487613 0.3487068 0.3486523 0.3485977 0.3485431 0.3484884 0.3484338 [372] 0.3483791 0.3483243 0.3482696 0.3482148 0.3481599 0.3481051 0.3480502 [379] 0.3479953 0.3479403 0.3478854 0.3478303 0.3477753 0.3477202 0.3476651 [386] 0.3476100 0.3475549 0.3474997 0.3474445 0.3473892 0.3473340 0.3472787 [393] 0.3472233 0.3471680 0.3471126 0.3470572 0.3470018 0.3469463 0.3468908 [400] 0.3468353 0.3467797 > mx [1] 0.3655142 > 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/1n1lt1257697069.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/2px8b1257697069.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/32zac1257697069.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/4ilyp1257697069.tab") > > system("convert tmp/1n1lt1257697069.ps tmp/1n1lt1257697069.png") > system("convert tmp/2px8b1257697069.ps tmp/2px8b1257697069.png") > system("convert tmp/32zac1257697069.ps tmp/32zac1257697069.png") > > > proc.time() user system elapsed 0.786 0.517 0.976