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(2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5,3.6,4.4,4.1,5.1,5.8,5.9,5.4,5.5,4.8,3.2,2.7,2.1,1.9,0.6,0.7,-0.2,-1,-1.7,-0.7) > x <- c(25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.3,19.8,21.2,21.5,20.6,19.1,19.6,23.5,24) > #'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.3780661 -0.3778513 -0.3776360 -0.3774203 -0.3772040 -0.3769873 [7] -0.3767702 -0.3765525 -0.3763344 -0.3761159 -0.3758969 -0.3756774 [13] -0.3754575 -0.3752371 -0.3750162 -0.3747949 -0.3745731 -0.3743509 [19] -0.3741282 -0.3739051 -0.3736816 -0.3734575 -0.3732331 -0.3730082 [25] -0.3727828 -0.3725570 -0.3723308 -0.3721041 -0.3718770 -0.3716495 [31] -0.3714215 -0.3711931 -0.3709643 -0.3707350 -0.3705053 -0.3702752 [37] -0.3700446 -0.3698136 -0.3695822 -0.3693504 -0.3691182 -0.3688855 [43] -0.3686524 -0.3684190 -0.3681850 -0.3679507 -0.3677160 -0.3674809 [49] -0.3672453 -0.3670094 -0.3667730 -0.3665362 -0.3662991 -0.3660615 [55] -0.3658235 -0.3655852 -0.3653464 -0.3651073 -0.3648677 -0.3646278 [61] -0.3643875 -0.3641468 -0.3639057 -0.3636642 -0.3634223 -0.3631801 [67] -0.3629375 -0.3626945 -0.3624511 -0.3622073 -0.3619632 -0.3617187 [73] -0.3614738 -0.3612286 -0.3609830 -0.3607370 -0.3604907 -0.3602440 [79] -0.3599969 -0.3597495 -0.3595017 -0.3592536 -0.3590051 -0.3587563 [85] -0.3585071 -0.3582576 -0.3580077 -0.3577575 -0.3575069 -0.3572560 [91] -0.3570048 -0.3567532 -0.3565013 -0.3562490 -0.3559964 -0.3557435 [97] -0.3554902 -0.3552366 -0.3549827 -0.3547285 -0.3544739 -0.3542191 [103] -0.3539639 -0.3537083 -0.3534525 -0.3531964 -0.3529399 -0.3526831 [109] -0.3524260 -0.3521686 -0.3519109 -0.3516529 -0.3513946 -0.3511360 [115] -0.3508771 -0.3506179 -0.3503584 -0.3500987 -0.3498386 -0.3495782 [121] -0.3493175 -0.3490566 -0.3487954 -0.3485339 -0.3482721 -0.3480100 [127] -0.3477476 -0.3474850 -0.3472221 -0.3469589 -0.3466955 -0.3464318 [133] -0.3461678 -0.3459035 -0.3456390 -0.3453743 -0.3451092 -0.3448439 [139] -0.3445784 -0.3443126 -0.3440465 -0.3437802 -0.3435137 -0.3432469 [145] -0.3429798 -0.3427125 -0.3424450 -0.3421772 -0.3419092 -0.3416410 [151] -0.3413725 -0.3411038 -0.3408348 -0.3405656 -0.3402962 -0.3400266 [157] -0.3397568 -0.3394867 -0.3392164 -0.3389459 -0.3386751 -0.3384042 [163] -0.3381330 -0.3378617 -0.3375901 -0.3373183 -0.3370463 -0.3367741 [169] -0.3365017 -0.3362291 -0.3359563 -0.3356833 -0.3354101 -0.3351367 [175] -0.3348632 -0.3345894 -0.3343154 -0.3340413 -0.3337670 -0.3334925 [181] -0.3332178 -0.3329429 -0.3326679 -0.3323927 -0.3321173 -0.3318417 [187] -0.3315660 -0.3312901 -0.3310140 -0.3307378 -0.3304614 -0.3301849 [193] -0.3299081 -0.3296313 -0.3293543 -0.3290771 -0.3287998 -0.3285223 [199] -0.3282447 -0.3279669 -0.3276890 -0.3274109 -0.3271327 -0.3268544 [205] -0.3265759 -0.3262973 -0.3260185 -0.3257397 -0.3254607 -0.3251815 [211] -0.3249023 -0.3246229 -0.3243434 -0.3240637 -0.3237840 -0.3235041 [217] -0.3232242 -0.3229441 -0.3226638 -0.3223835 -0.3221031 -0.3218226 [223] -0.3215419 -0.3212612 -0.3209803 -0.3206994 -0.3204184 -0.3201372 [229] -0.3198560 -0.3195747 -0.3192932 -0.3190117 -0.3187301 -0.3184484 [235] -0.3181667 -0.3178848 -0.3176029 -0.3173209 -0.3170388 -0.3167567 [241] -0.3164744 -0.3161921 -0.3159097 -0.3156273 -0.3153448 -0.3150622 [247] -0.3147796 -0.3144969 -0.3142141 -0.3139313 -0.3136484 -0.3133655 [253] -0.3130825 -0.3127995 -0.3125164 -0.3122332 -0.3119501 -0.3116668 [259] -0.3113836 -0.3111003 -0.3108169 -0.3105335 -0.3102501 -0.3099666 [265] -0.3096832 -0.3093996 -0.3091161 -0.3088325 -0.3085489 -0.3082653 [271] -0.3079816 -0.3076979 -0.3074142 -0.3071305 -0.3068468 -0.3065630 [277] -0.3062793 -0.3059955 -0.3057117 -0.3054279 -0.3051442 -0.3048603 [283] -0.3045765 -0.3042927 -0.3040089 -0.3037251 -0.3034413 -0.3031575 [289] -0.3028737 -0.3025900 -0.3023062 -0.3020224 -0.3017387 -0.3014549 [295] -0.3011712 -0.3008875 -0.3006038 -0.3003201 -0.3000365 -0.2997529 [301] -0.2994693 -0.2991857 -0.2989022 -0.2986186 -0.2983352 -0.2980517 [307] -0.2977683 -0.2974849 -0.2972016 -0.2969183 -0.2966350 -0.2963518 [313] -0.2960686 -0.2957855 -0.2955024 -0.2952193 -0.2949363 -0.2946534 [319] -0.2943705 -0.2940877 -0.2938049 -0.2935222 -0.2932395 -0.2929569 [325] -0.2926743 -0.2923918 -0.2921094 -0.2918271 -0.2915448 -0.2912625 [331] -0.2909804 -0.2906983 -0.2904163 -0.2901344 -0.2898525 -0.2895707 [337] -0.2892890 -0.2890074 -0.2887258 -0.2884444 -0.2881630 -0.2878817 [343] -0.2876005 -0.2873193 -0.2870383 -0.2867573 -0.2864765 -0.2861957 [349] -0.2859151 -0.2856345 -0.2853540 -0.2850736 -0.2847934 -0.2845132 [355] -0.2842331 -0.2839531 -0.2836733 -0.2833935 -0.2831139 -0.2828343 [361] -0.2825549 -0.2822756 -0.2819964 -0.2817173 -0.2814383 -0.2811594 [367] -0.2808807 -0.2806020 -0.2803235 -0.2800452 -0.2797669 -0.2794888 [373] -0.2792107 -0.2789329 -0.2786551 -0.2783775 -0.2781000 -0.2778226 [379] -0.2775454 -0.2772683 -0.2769913 -0.2767145 -0.2764378 -0.2761612 [385] -0.2758848 -0.2756085 -0.2753324 -0.2750564 -0.2747806 -0.2745049 [391] -0.2742293 -0.2739539 -0.2736787 -0.2734035 -0.2731286 -0.2728538 [397] -0.2725791 -0.2723047 -0.2720303 -0.2717561 -0.2714821 > mx [1] 0.3780661 > 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/1rf631261042039.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/25jd41261042039.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/3vijt1261042039.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/4t8jz1261042039.tab") > > try(system("convert tmp/1rf631261042039.ps tmp/1rf631261042039.png",intern=TRUE)) character(0) > try(system("convert tmp/25jd41261042039.ps tmp/25jd41261042039.png",intern=TRUE)) character(0) > try(system("convert tmp/3vijt1261042039.ps tmp/3vijt1261042039.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.777 0.493 0.997