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(102.0,104.7,86.0,92.1,106.9,112.6,101.7,92.0,97.4,97.0,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97.0,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99.0,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102.0,106.0,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100.0,110.7,112.8,109.8,117.3,109.1,115.9,96.0,99.8,116.8,115.7,99.4,94.3,91.0,93.2,103.1,94.1,91.8,102.7,82.6,89.1) > x <- c(70.5,77.7,56.0,56.8,69.2,71.3,79.4,80.8,72.2,69.8,73.0,82.0,76.3,65.3,51.4,60.5,83.0,89.8,78.6,85.8,69.7,69.4,76.6,76.4,77.1,79.0,67.5,60.0,71.7,79.3,66.0,78.1,57.1,49.6,64.0,57.8,61.6,82.4,61.8,62.1,79.5,65.4,72.5,84.6,62.5,65.1,79.0,65.9,66.1,83.3,40.6,58.6,67.3,68.2,59.5,65.7,53.4,39.5,51.7,42.3,45.9,54.7,41.8,48.6,57.1,76.5,62.7,53.9,53.5,47.5,49.3,59.9,49.9,54.5,54.2,46.7,61.2,51.8,37.4,41.1,30.0,34.8,45.9,45.1,42.6,49.0,29.6,46.0) > #'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.3721463 0.3720756 0.3720040 0.3719313 0.3718577 0.3717831 0.3717076 [8] 0.3716310 0.3715535 0.3714751 0.3713956 0.3713152 0.3712338 0.3711515 [15] 0.3710682 0.3709839 0.3708986 0.3708124 0.3707253 0.3706372 0.3705481 [22] 0.3704580 0.3703671 0.3702751 0.3701822 0.3700884 0.3699936 0.3698979 [29] 0.3698012 0.3697036 0.3696051 0.3695056 0.3694052 0.3693038 0.3692016 [36] 0.3690984 0.3689942 0.3688892 0.3687832 0.3686763 0.3685685 0.3684598 [43] 0.3683502 0.3682396 0.3681282 0.3680158 0.3679025 0.3677884 0.3676733 [50] 0.3675574 0.3674406 0.3673228 0.3672042 0.3670847 0.3669644 0.3668431 [57] 0.3667210 0.3665980 0.3664741 0.3663494 0.3662238 0.3660974 0.3659701 [64] 0.3658419 0.3657129 0.3655831 0.3654524 0.3653208 0.3651885 0.3650553 [71] 0.3649212 0.3647864 0.3646507 0.3645142 0.3643768 0.3642387 0.3640998 [78] 0.3639600 0.3638195 0.3636781 0.3635360 0.3633930 0.3632493 0.3631048 [85] 0.3629595 0.3628134 0.3626666 0.3625190 0.3623706 0.3622215 0.3620716 [92] 0.3619210 0.3617696 0.3616174 0.3614645 0.3613109 0.3611565 0.3610015 [99] 0.3608456 0.3606891 0.3605319 0.3603739 0.3602152 0.3600558 0.3598957 [106] 0.3597350 0.3595735 0.3594113 0.3592485 0.3590849 0.3589207 0.3587558 [113] 0.3585903 0.3584241 0.3582572 0.3580897 0.3579215 0.3577527 0.3575832 [120] 0.3574131 0.3572423 0.3570710 0.3568990 0.3567264 0.3565531 0.3563793 [127] 0.3562048 0.3560298 0.3558541 0.3556779 0.3555010 0.3553236 0.3551456 [134] 0.3549670 0.3547879 0.3546082 0.3544279 0.3542470 0.3540657 0.3538837 [141] 0.3537012 0.3535182 0.3533346 0.3531505 0.3529659 0.3527808 0.3525951 [148] 0.3524089 0.3522223 0.3520351 0.3518474 0.3516592 0.3514705 0.3512814 [155] 0.3510917 0.3509016 0.3507110 0.3505200 0.3503285 0.3501365 0.3499441 [162] 0.3497512 0.3495579 0.3493641 0.3491699 0.3489753 0.3487802 0.3485847 [169] 0.3483888 0.3481925 0.3479958 0.3477987 0.3476012 0.3474033 0.3472050 [176] 0.3470063 0.3468072 0.3466077 0.3464079 0.3462077 0.3460072 0.3458063 [183] 0.3456050 0.3454034 0.3452014 0.3449991 0.3447965 0.3445935 0.3443902 [190] 0.3441866 0.3439826 0.3437784 0.3435738 0.3433689 0.3431638 0.3429583 [197] 0.3427525 0.3425465 0.3423401 0.3421335 0.3419266 0.3417195 0.3415120 [204] 0.3413043 0.3410964 0.3408882 0.3406797 0.3404710 0.3402621 0.3400529 [211] 0.3398434 0.3396338 0.3394239 0.3392138 0.3390035 0.3387930 0.3385823 [218] 0.3383713 0.3381602 0.3379488 0.3377373 0.3375256 0.3373137 0.3371016 [225] 0.3368894 0.3366769 0.3364643 0.3362516 0.3360386 0.3358255 0.3356123 [232] 0.3353989 0.3351854 0.3349717 0.3347579 0.3345440 0.3343299 0.3341157 [239] 0.3339013 0.3336869 0.3334723 0.3332577 0.3330429 0.3328280 0.3326130 [246] 0.3323979 0.3321827 0.3319675 0.3317521 0.3315367 0.3313212 0.3311056 [253] 0.3308899 0.3306742 0.3304583 0.3302425 0.3300266 0.3298106 0.3295945 [260] 0.3293785 0.3291623 0.3289462 0.3287300 0.3285137 0.3282974 0.3280811 [267] 0.3278648 0.3276485 0.3274321 0.3272157 0.3269993 0.3267829 0.3265665 [274] 0.3263500 0.3261336 0.3259172 0.3257008 0.3254844 0.3252680 0.3250516 [281] 0.3248352 0.3246189 0.3244025 0.3241862 0.3239700 0.3237537 0.3235375 [288] 0.3233214 0.3231052 0.3228892 0.3226731 0.3224571 0.3222412 0.3220253 [295] 0.3218095 0.3215937 0.3213780 0.3211623 0.3209468 0.3207312 0.3205158 [302] 0.3203004 0.3200852 0.3198699 0.3196548 0.3194398 0.3192248 0.3190099 [309] 0.3187952 0.3185805 0.3183659 0.3181514 0.3179370 0.3177227 0.3175086 [316] 0.3172945 0.3170805 0.3168667 0.3166529 0.3164393 0.3162258 0.3160124 [323] 0.3157992 0.3155860 0.3153730 0.3151602 0.3149474 0.3147348 0.3145223 [330] 0.3143100 0.3140978 0.3138857 0.3136738 0.3134620 0.3132504 0.3130389 [337] 0.3128276 0.3126164 0.3124054 0.3121945 0.3119838 0.3117733 0.3115629 [344] 0.3113527 0.3111426 0.3109327 0.3107230 0.3105134 0.3103040 0.3100948 [351] 0.3098858 0.3096769 0.3094682 0.3092597 0.3090514 0.3088433 0.3086353 [358] 0.3084276 0.3082200 0.3080126 0.3078054 0.3075983 0.3073915 0.3071849 [365] 0.3069785 0.3067722 0.3065662 0.3063603 0.3061547 0.3059493 0.3057440 [372] 0.3055390 0.3053342 0.3051296 0.3049252 0.3047210 0.3045170 0.3043132 [379] 0.3041096 0.3039063 0.3037031 0.3035002 0.3032975 0.3030950 0.3028928 [386] 0.3026907 0.3024889 0.3022873 0.3020859 0.3018848 0.3016838 0.3014831 [393] 0.3012827 0.3010824 0.3008824 0.3006826 0.3004831 0.3002837 0.3000847 [400] 0.2998858 0.2996872 > mx [1] 0.3721463 > 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/1jvra1257776166.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/2ed0a1257776166.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/3rglk1257776166.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/40rdo1257776166.tab") > > system("convert tmp/1jvra1257776166.ps tmp/1jvra1257776166.png") > system("convert tmp/2ed0a1257776166.ps tmp/2ed0a1257776166.png") > system("convert tmp/3rglk1257776166.ps tmp/3rglk1257776166.png") > > > proc.time() user system elapsed 0.770 0.493 0.937