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(89.1,83.3,97.7,100.9,108.3,113.2,105,104,109.8,98.6,93.5,98.2,88,85.3,96.8,98.8,110.3,111.6,111.2,106.9,117.6,97,97.3,98.4,87.6,87.4,94.7,101.5,110.4,108.4,109.7,105.2,111.1,96.2,97.3,98.9,91.7,90.9,98.8,111.5,119,115.3,116.3,113.6,115.1,109.7,97.6,100.8,94,87.2,102.9,111.3,106.6,108.9,108.3,100.5,104,89.9,86.8,91.2) > x <- c(96.96,93.11,95.62,98.30,96.38,100.82,99.06,94.03,102.07,99.31,98.64,101.82,99.14,97.63,100.06,101.32,101.49,105.43,105.09,99.48,108.53,104.34,106.10,107.35,103.00,104.50,105.17,104.84,106.18,108.86,107.77,102.74,112.63,106.26,108.86,111.38,106.85,107.86,107.94,111.38,111.29,113.72,111.88,109.87,113.72,111.71,114.81,112.05,111.54,110.87,110.87,115.48,111.63,116.24,113.56,106.01,110.45,107.77,108.61,108.19) > #'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.3555136 0.3555412 0.3555687 0.3555961 0.3556236 0.3556511 0.3556785 [8] 0.3557060 0.3557334 0.3557608 0.3557882 0.3558156 0.3558430 0.3558704 [15] 0.3558978 0.3559251 0.3559525 0.3559798 0.3560071 0.3560345 0.3560618 [22] 0.3560891 0.3561163 0.3561436 0.3561709 0.3561981 0.3562254 0.3562526 [29] 0.3562798 0.3563070 0.3563342 0.3563614 0.3563885 0.3564157 0.3564429 [36] 0.3564700 0.3564971 0.3565242 0.3565513 0.3565784 0.3566055 0.3566326 [43] 0.3566596 0.3566867 0.3567137 0.3567408 0.3567678 0.3567948 0.3568218 [50] 0.3568488 0.3568757 0.3569027 0.3569296 0.3569566 0.3569835 0.3570104 [57] 0.3570373 0.3570642 0.3570911 0.3571179 0.3571448 0.3571716 0.3571985 [64] 0.3572253 0.3572521 0.3572789 0.3573057 0.3573325 0.3573592 0.3573860 [71] 0.3574127 0.3574395 0.3574662 0.3574929 0.3575196 0.3575463 0.3575729 [78] 0.3575996 0.3576263 0.3576529 0.3576795 0.3577061 0.3577327 0.3577593 [85] 0.3577859 0.3578125 0.3578390 0.3578656 0.3578921 0.3579186 0.3579451 [92] 0.3579716 0.3579981 0.3580246 0.3580511 0.3580775 0.3581039 0.3581304 [99] 0.3581568 0.3581832 0.3582096 0.3582360 0.3582623 0.3582887 0.3583150 [106] 0.3583413 0.3583677 0.3583940 0.3584203 0.3584465 0.3584728 0.3584991 [113] 0.3585253 0.3585516 0.3585778 0.3586040 0.3586302 0.3586564 0.3586825 [120] 0.3587087 0.3587349 0.3587610 0.3587871 0.3588132 0.3588393 0.3588654 [127] 0.3588915 0.3589176 0.3589436 0.3589696 0.3589957 0.3590217 0.3590477 [134] 0.3590737 0.3590997 0.3591256 0.3591516 0.3591775 0.3592034 0.3592294 [141] 0.3592553 0.3592812 0.3593070 0.3593329 0.3593588 0.3593846 0.3594104 [148] 0.3594362 0.3594620 0.3594878 0.3595136 0.3595394 0.3595651 0.3595909 [155] 0.3596166 0.3596423 0.3596680 0.3596937 0.3597194 0.3597451 0.3597707 [162] 0.3597964 0.3598220 0.3598476 0.3598732 0.3598988 0.3599244 0.3599499 [169] 0.3599755 0.3600010 0.3600265 0.3600521 0.3600776 0.3601030 0.3601285 [176] 0.3601540 0.3601794 0.3602049 0.3602303 0.3602557 0.3602811 0.3603065 [183] 0.3603318 0.3603572 0.3603826 0.3604079 0.3604332 0.3604585 0.3604838 [190] 0.3605091 0.3605344 0.3605596 0.3605848 0.3606101 0.3606353 0.3606605 [197] 0.3606857 0.3607109 0.3607360 0.3607612 0.3607863 0.3608114 0.3608365 [204] 0.3608616 0.3608867 0.3609118 0.3609368 0.3609619 0.3609869 0.3610119 [211] 0.3610369 0.3610619 0.3610869 0.3611119 0.3611368 0.3611618 0.3611867 [218] 0.3612116 0.3612365 0.3612614 0.3612863 0.3613111 0.3613360 0.3613608 [225] 0.3613856 0.3614104 0.3614352 0.3614600 0.3614847 0.3615095 0.3615342 [232] 0.3615590 0.3615837 0.3616084 0.3616330 0.3616577 0.3616824 0.3617070 [239] 0.3617316 0.3617563 0.3617809 0.3618054 0.3618300 0.3618546 0.3618791 [246] 0.3619037 0.3619282 0.3619527 0.3619772 0.3620016 0.3620261 0.3620506 [253] 0.3620750 0.3620994 0.3621238 0.3621482 0.3621726 0.3621970 0.3622213 [260] 0.3622457 0.3622700 0.3622943 0.3623186 0.3623429 0.3623672 0.3623914 [267] 0.3624157 0.3624399 0.3624641 0.3624883 0.3625125 0.3625367 0.3625608 [274] 0.3625850 0.3626091 0.3626332 0.3626573 0.3626814 0.3627055 0.3627295 [281] 0.3627536 0.3627776 0.3628016 0.3628256 0.3628496 0.3628736 0.3628976 [288] 0.3629215 0.3629455 0.3629694 0.3629933 0.3630172 0.3630410 0.3630649 [295] 0.3630888 0.3631126 0.3631364 0.3631602 0.3631840 0.3632078 0.3632315 [302] 0.3632553 0.3632790 0.3633027 0.3633265 0.3633501 0.3633738 0.3633975 [309] 0.3634211 0.3634448 0.3634684 0.3634920 0.3635156 0.3635391 0.3635627 [316] 0.3635863 0.3636098 0.3636333 0.3636568 0.3636803 0.3637038 0.3637272 [323] 0.3637507 0.3637741 0.3637975 0.3638209 0.3638443 0.3638677 0.3638910 [330] 0.3639144 0.3639377 0.3639610 0.3639843 0.3640076 0.3640309 0.3640541 [337] 0.3640774 0.3641006 0.3641238 0.3641470 0.3641702 0.3641933 0.3642165 [344] 0.3642396 0.3642627 0.3642858 0.3643089 0.3643320 0.3643551 0.3643781 [351] 0.3644012 0.3644242 0.3644472 0.3644702 0.3644931 0.3645161 0.3645390 [358] 0.3645620 0.3645849 0.3646078 0.3646307 0.3646535 0.3646764 0.3646992 [365] 0.3647220 0.3647448 0.3647676 0.3647904 0.3648132 0.3648359 0.3648587 [372] 0.3648814 0.3649041 0.3649268 0.3649494 0.3649721 0.3649947 0.3650174 [379] 0.3650400 0.3650626 0.3650851 0.3651077 0.3651303 0.3651528 0.3651753 [386] 0.3651978 0.3652203 0.3652428 0.3652652 0.3652877 0.3653101 0.3653325 [393] 0.3653549 0.3653773 0.3653997 0.3654220 0.3654443 0.3654667 0.3654890 [400] 0.3655113 0.3655335 > mx [1] 0.3655335 > 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/14ed01258042249.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/23w3n1258042249.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/3ca6r1258042249.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/4orsi1258042249.tab") > system("convert tmp/14ed01258042249.ps tmp/14ed01258042249.png") > system("convert tmp/23w3n1258042249.ps tmp/23w3n1258042249.png") > system("convert tmp/3ca6r1258042249.ps tmp/3ca6r1258042249.png") > > > proc.time() user system elapsed 0.799 0.516 0.982