R version 2.8.0 (2008-10-20) 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(13.9,15.9,18.2,19.7,20.1,19.9,20,22.6,20.6,20.1,20.2,21.8,22,19.5,17.5,18.2,18.8,19.7,18.8,18.5,18.7,18.5,19.3,18.9,21.4,22.5,25,22.9,22.9,21.3,22.3,20.9,19.9,20.2,19.8,17.7,18.1,17.6,18.2,16,16.3,17.3,19,18.6,18,17.9,17.8,18.5,17.4,19,17.4,20.6,18.5,20,18.8,18.8,19.7,15.3,10.6,6.1,0.9) > x <- c(562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478,528,534,518,506,502,516,528) > #'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.3824842 0.3825483 0.3826123 0.3826762 0.3827399 0.3828036 0.3828670 [8] 0.3829304 0.3829936 0.3830567 0.3831197 0.3831825 0.3832452 0.3833078 [15] 0.3833702 0.3834325 0.3834947 0.3835568 0.3836187 0.3836805 0.3837422 [22] 0.3838037 0.3838651 0.3839264 0.3839875 0.3840485 0.3841094 0.3841702 [29] 0.3842308 0.3842913 0.3843517 0.3844119 0.3844720 0.3845320 0.3845918 [36] 0.3846515 0.3847111 0.3847706 0.3848299 0.3848891 0.3849481 0.3850071 [43] 0.3850659 0.3851245 0.3851831 0.3852415 0.3852998 0.3853579 0.3854159 [50] 0.3854738 0.3855316 0.3855892 0.3856467 0.3857040 0.3857613 0.3858184 [57] 0.3858753 0.3859322 0.3859889 0.3860455 0.3861019 0.3861582 0.3862144 [64] 0.3862705 0.3863264 0.3863822 0.3864378 0.3864934 0.3865488 0.3866040 [71] 0.3866592 0.3867142 0.3867691 0.3868238 0.3868784 0.3869329 0.3869872 [78] 0.3870415 0.3870955 0.3871495 0.3872033 0.3872570 0.3873106 0.3873640 [85] 0.3874173 0.3874705 0.3875235 0.3875764 0.3876292 0.3876818 0.3877344 [92] 0.3877867 0.3878390 0.3878911 0.3879431 0.3879949 0.3880467 0.3880983 [99] 0.3881497 0.3882011 0.3882522 0.3883033 0.3883542 0.3884051 0.3884557 [106] 0.3885063 0.3885567 0.3886069 0.3886571 0.3887071 0.3887570 0.3888067 [113] 0.3888564 0.3889058 0.3889552 0.3890044 0.3890535 0.3891025 0.3891513 [120] 0.3892000 0.3892486 0.3892970 0.3893453 0.3893935 0.3894415 0.3894894 [127] 0.3895372 0.3895848 0.3896323 0.3896797 0.3897270 0.3897741 0.3898211 [134] 0.3898679 0.3899147 0.3899612 0.3900077 0.3900540 0.3901002 0.3901463 [141] 0.3901922 0.3902380 0.3902837 0.3903292 0.3903746 0.3904199 0.3904650 [148] 0.3905100 0.3905549 0.3905997 0.3906443 0.3906888 0.3907331 0.3907773 [155] 0.3908214 0.3908654 0.3909092 0.3909529 0.3909965 0.3910399 0.3910832 [162] 0.3911263 0.3911694 0.3912123 0.3912551 0.3912977 0.3913402 0.3913826 [169] 0.3914248 0.3914669 0.3915089 0.3915508 0.3915925 0.3916341 0.3916755 [176] 0.3917168 0.3917580 0.3917991 0.3918400 0.3918808 0.3919215 0.3919620 [183] 0.3920024 0.3920427 0.3920828 0.3921228 0.3921627 0.3922024 0.3922420 [190] 0.3922815 0.3923209 0.3923601 0.3923992 0.3924381 0.3924769 0.3925156 [197] 0.3925542 0.3925926 0.3926309 0.3926691 0.3927071 0.3927450 0.3927828 [204] 0.3928204 0.3928579 0.3928953 0.3929326 0.3929697 0.3930066 0.3930435 [211] 0.3930802 0.3931168 0.3931533 0.3931896 0.3932258 0.3932619 0.3932978 [218] 0.3933336 0.3933693 0.3934048 0.3934402 0.3934755 0.3935106 0.3935456 [225] 0.3935805 0.3936153 0.3936499 0.3936844 0.3937188 0.3937530 0.3937871 [232] 0.3938210 0.3938549 0.3938886 0.3939222 0.3939556 0.3939889 0.3940221 [239] 0.3940552 0.3940881 0.3941209 0.3941535 0.3941861 0.3942184 0.3942507 [246] 0.3942829 0.3943149 0.3943467 0.3943785 0.3944101 0.3944416 0.3944729 [253] 0.3945042 0.3945352 0.3945662 0.3945970 0.3946277 0.3946583 0.3946887 [260] 0.3947191 0.3947492 0.3947793 0.3948092 0.3948390 0.3948687 0.3948982 [267] 0.3949276 0.3949569 0.3949860 0.3950150 0.3950439 0.3950726 0.3951012 [274] 0.3951297 0.3951581 0.3951863 0.3952144 0.3952424 0.3952702 0.3952979 [281] 0.3953255 0.3953530 0.3953803 0.3954075 0.3954345 0.3954615 0.3954883 [288] 0.3955149 0.3955415 0.3955679 0.3955942 0.3956203 0.3956464 0.3956723 [295] 0.3956980 0.3957237 0.3957492 0.3957745 0.3957998 0.3958249 0.3958499 [302] 0.3958748 0.3958995 0.3959241 0.3959486 0.3959729 0.3959971 0.3960212 [309] 0.3960452 0.3960690 0.3960927 0.3961163 0.3961397 0.3961631 0.3961862 [316] 0.3962093 0.3962322 0.3962550 0.3962777 0.3963003 0.3963227 0.3963450 [323] 0.3963671 0.3963892 0.3964111 0.3964328 0.3964545 0.3964760 0.3964974 [330] 0.3965186 0.3965398 0.3965608 0.3965817 0.3966024 0.3966230 0.3966435 [337] 0.3966639 0.3966841 0.3967043 0.3967242 0.3967441 0.3967638 0.3967834 [344] 0.3968029 0.3968222 0.3968415 0.3968606 0.3968795 0.3968984 0.3969171 [351] 0.3969356 0.3969541 0.3969724 0.3969906 0.3970087 0.3970266 0.3970445 [358] 0.3970622 0.3970797 0.3970972 0.3971145 0.3971317 0.3971487 0.3971657 [365] 0.3971825 0.3971991 0.3972157 0.3972321 0.3972484 0.3972646 0.3972806 [372] 0.3972966 0.3973124 0.3973280 0.3973436 0.3973590 0.3973743 0.3973894 [379] 0.3974045 0.3974194 0.3974342 0.3974488 0.3974634 0.3974778 0.3974921 [386] 0.3975062 0.3975203 0.3975342 0.3975480 0.3975616 0.3975751 0.3975885 [393] 0.3976018 0.3976150 0.3976280 0.3976409 0.3976537 0.3976664 0.3976789 [400] 0.3976913 0.3977036 > mx [1] 0.3977036 > 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/freestat/rcomp/tmp/1rkko1257955453.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/freestat/rcomp/tmp/2p4dn1257955453.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/freestat/rcomp/tmp/3pb6y1257955453.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4cbl31257955453.tab") > > system("convert tmp/1rkko1257955453.ps tmp/1rkko1257955453.png") > system("convert tmp/2p4dn1257955453.ps tmp/2p4dn1257955453.png") > system("convert tmp/3pb6y1257955453.ps tmp/3pb6y1257955453.png") > > > proc.time() user system elapsed 1.217 0.798 1.369