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(80.9,113.8,71.2,55.8,61,60.8,74.3,66.5,71,61.6,66.4,74.7,72.4,76.4,86.4,73.9,133.1,83.3,85.8,76.8,92.7,68.8,69.4,97,84.6,84.2,201.8,83.1,69.4,78.8,77.1,90.7,107.5,81.4,83.3,105.7,85.8,87.2,87.5,77.5,78.5,89.7,94.3,104.4,115.9,90,91.1,119.8,101.9,99.2,115.7,94.9,99.8,109.6,109,119.6,119.2,94.6,102.5,105.4) > x <- c(105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.7,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105,109,129.4,148.6,101.4,134.8,143.7,81.6,90.3,141.5,140.7,140.2,100.2,125.7,119.6,134.7,109,116.3,146.9,97.4,89.4,132.1,139.8,129,112.5,121.9,121.7,123.1) > #'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.3051017 0.3052687 0.3054354 0.3056017 0.3057677 0.3059333 0.3060985 [8] 0.3062634 0.3064280 0.3065921 0.3067560 0.3069194 0.3070825 0.3072453 [15] 0.3074076 0.3075696 0.3077313 0.3078925 0.3080534 0.3082140 0.3083741 [22] 0.3085339 0.3086933 0.3088523 0.3090110 0.3091692 0.3093271 0.3094846 [29] 0.3096417 0.3097985 0.3099548 0.3101108 0.3102664 0.3104216 0.3105764 [36] 0.3107308 0.3108848 0.3110384 0.3111917 0.3113445 0.3114970 0.3116490 [43] 0.3118007 0.3119519 0.3121028 0.3122532 0.3124033 0.3125529 0.3127022 [50] 0.3128510 0.3129995 0.3131475 0.3132951 0.3134424 0.3135892 0.3137356 [57] 0.3138816 0.3140272 0.3141724 0.3143171 0.3144615 0.3146054 0.3147490 [64] 0.3148921 0.3150348 0.3151771 0.3153189 0.3154604 0.3156014 0.3157421 [71] 0.3158823 0.3160221 0.3161614 0.3163004 0.3164389 0.3165770 0.3167147 [78] 0.3168520 0.3169889 0.3171253 0.3172613 0.3173969 0.3175321 0.3176668 [85] 0.3178011 0.3179350 0.3180685 0.3182015 0.3183342 0.3184664 0.3185981 [92] 0.3187295 0.3188604 0.3189909 0.3191210 0.3192506 0.3193799 0.3195087 [99] 0.3196370 0.3197650 0.3198925 0.3200196 0.3201463 0.3202725 0.3203983 [106] 0.3205237 0.3206487 0.3207733 0.3208974 0.3210211 0.3211443 0.3212672 [113] 0.3213896 0.3215116 0.3216331 0.3217542 0.3218750 0.3219952 0.3221151 [120] 0.3222345 0.3223535 0.3224721 0.3225903 0.3227080 0.3228253 0.3229422 [127] 0.3230587 0.3231747 0.3232904 0.3234056 0.3235203 0.3236347 0.3237486 [134] 0.3238621 0.3239752 0.3240879 0.3242001 0.3243120 0.3244234 0.3245344 [141] 0.3246449 0.3247551 0.3248648 0.3249741 0.3250830 0.3251915 0.3252996 [148] 0.3254072 0.3255145 0.3256213 0.3257277 0.3258337 0.3259393 0.3260444 [155] 0.3261492 0.3262535 0.3263575 0.3264610 0.3265641 0.3266668 0.3267691 [162] 0.3268710 0.3269724 0.3270735 0.3271742 0.3272744 0.3273743 0.3274737 [169] 0.3275728 0.3276714 0.3277697 0.3278675 0.3279649 0.3280620 0.3281586 [176] 0.3282548 0.3283507 0.3284461 0.3285411 0.3286358 0.3287300 0.3288239 [183] 0.3289173 0.3290104 0.3291031 0.3291953 0.3292872 0.3293787 0.3294698 [190] 0.3295606 0.3296509 0.3297408 0.3298304 0.3299196 0.3300084 0.3300968 [197] 0.3301848 0.3302724 0.3303597 0.3304465 0.3305330 0.3306192 0.3307049 [204] 0.3307903 0.3308752 0.3309598 0.3310441 0.3311279 0.3312114 0.3312945 [211] 0.3313773 0.3314596 0.3315416 0.3316233 0.3317045 0.3317854 0.3318660 [218] 0.3319461 0.3320259 0.3321054 0.3321844 0.3322632 0.3323415 0.3324195 [225] 0.3324971 0.3325744 0.3326513 0.3327279 0.3328041 0.3328800 0.3329555 [232] 0.3330306 0.3331054 0.3331799 0.3332540 0.3333277 0.3334011 0.3334742 [239] 0.3335469 0.3336192 0.3336913 0.3337629 0.3338343 0.3339053 0.3339759 [246] 0.3340462 0.3341162 0.3341858 0.3342551 0.3343241 0.3343927 0.3344610 [253] 0.3345290 0.3345966 0.3346640 0.3347309 0.3347976 0.3348639 0.3349299 [260] 0.3349956 0.3350609 0.3351259 0.3351906 0.3352550 0.3353191 0.3353828 [267] 0.3354462 0.3355093 0.3355721 0.3356346 0.3356967 0.3357585 0.3358201 [274] 0.3358813 0.3359422 0.3360028 0.3360630 0.3361230 0.3361827 0.3362420 [281] 0.3363011 0.3363598 0.3364183 0.3364764 0.3365343 0.3365918 0.3366491 [288] 0.3367060 0.3367626 0.3368190 0.3368751 0.3369308 0.3369863 0.3370414 [295] 0.3370963 0.3371509 0.3372052 0.3372592 0.3373129 0.3373664 0.3374195 [302] 0.3374724 0.3375250 0.3375773 0.3376293 0.3376810 0.3377324 0.3377836 [309] 0.3378345 0.3378851 0.3379354 0.3379855 0.3380353 0.3380848 0.3381340 [316] 0.3381830 0.3382317 0.3382801 0.3383283 0.3383761 0.3384238 0.3384711 [323] 0.3385182 0.3385650 0.3386115 0.3386578 0.3387039 0.3387496 0.3387951 [330] 0.3388404 0.3388853 0.3389301 0.3389745 0.3390187 0.3390627 0.3391064 [337] 0.3391498 0.3391930 0.3392360 0.3392787 0.3393211 0.3393633 0.3394052 [344] 0.3394469 0.3394884 0.3395296 0.3395705 0.3396112 0.3396517 0.3396919 [351] 0.3397319 0.3397716 0.3398111 0.3398504 0.3398894 0.3399282 0.3399667 [358] 0.3400050 0.3400431 0.3400809 0.3401185 0.3401559 0.3401930 0.3402299 [365] 0.3402666 0.3403031 0.3403393 0.3403753 0.3404110 0.3404465 0.3404818 [372] 0.3405169 0.3405518 0.3405864 0.3406208 0.3406550 0.3406890 0.3407227 [379] 0.3407562 0.3407895 0.3408226 0.3408555 0.3408881 0.3409205 0.3409528 [386] 0.3409848 0.3410165 0.3410481 0.3410795 0.3411106 0.3411416 0.3411723 [393] 0.3412028 0.3412331 0.3412632 0.3412931 0.3413228 0.3413522 0.3413815 [400] 0.3414106 0.3414394 > mx [1] 0.3414394 > 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/1qsh31257952414.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/2mm461257952414.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/3lhtt1257952414.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/48iwq1257952414.tab") > > system("convert tmp/1qsh31257952414.ps tmp/1qsh31257952414.png") > system("convert tmp/2mm461257952414.ps tmp/2mm461257952414.png") > system("convert tmp/3lhtt1257952414.ps tmp/3lhtt1257952414.png") > > > proc.time() user system elapsed 0.790 0.501 0.950