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.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.21,2.25,2.25,2.45,2.50,2.50,2.64,2.75,2.93,3.00,3.17,3.25,3.39,3.50,3.50,3.65,3.75,3.75,3.90,4.00,4.00,4.00,4.00,4.00,4.00,4.00,4.00,4.00,4.00,4.00,4.00,4.18,4.25,4.25,3.97,3.42,2.75,2.31,2.00,1.66,1.31) > x <- c(2.6,2.3,2.3,2.6,3.1,2.8,2.5,2.9,3.1,3.1,3.2,2.5,2.6,2.9,2.6,2.4,1.7,2.0,2.2,1.9,1.6,1.6,1.2,1.2,1.5,1.6,1.7,1.8,1.8,1.8,1.3,1.3,1.4,1.1,1.5,2.2,2.9,3.1,3.5,3.6,4.4,4.2,5.2,5.8,5.9,5.4,5.5,4.7,3.1,2.6,2.3,1.9,0.6,0.6) > #'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.2662697 0.2660277 0.2657869 0.2655471 0.2653086 0.2650713 0.2648353 [8] 0.2646006 0.2643672 0.2641352 0.2639046 0.2636755 0.2634479 0.2632218 [15] 0.2629973 0.2627744 0.2625532 0.2623337 0.2621160 0.2619000 0.2616858 [22] 0.2614735 0.2612632 0.2610548 0.2608484 0.2606440 0.2604418 0.2602417 [29] 0.2600437 0.2598480 0.2596546 0.2594635 0.2592747 0.2590884 0.2589045 [36] 0.2587231 0.2585443 0.2583681 0.2581945 0.2580236 0.2578555 0.2576901 [43] 0.2575276 0.2573680 0.2572113 0.2570576 0.2569069 0.2567594 0.2566149 [50] 0.2564736 0.2563356 0.2562008 0.2560694 0.2559413 0.2558167 0.2556955 [57] 0.2555779 0.2554638 0.2553534 0.2552467 0.2551437 0.2550444 0.2549490 [64] 0.2548574 0.2547698 0.2546861 0.2546065 0.2545309 0.2544595 0.2543922 [71] 0.2543292 0.2542704 0.2542159 0.2541657 0.2541200 0.2540788 0.2540420 [78] 0.2540098 0.2539822 0.2539592 0.2539409 0.2539273 0.2539185 0.2539146 [85] 0.2539155 0.2539213 0.2539321 0.2539478 0.2539686 0.2539945 0.2540255 [92] 0.2540617 0.2541031 0.2541497 0.2542016 0.2542588 0.2543214 0.2543894 [99] 0.2544628 0.2545416 0.2546260 0.2547160 0.2548115 0.2549126 0.2550193 [106] 0.2551318 0.2552499 0.2553737 0.2555034 0.2556388 0.2557800 0.2559271 [113] 0.2560801 0.2562389 0.2564037 0.2565745 0.2567512 0.2569339 0.2571226 [120] 0.2573173 0.2575181 0.2577250 0.2579379 0.2581570 0.2583821 0.2586134 [127] 0.2588509 0.2590945 0.2593443 0.2596002 0.2598624 0.2601307 0.2604053 [134] 0.2606860 0.2609730 0.2612661 0.2615655 0.2618712 0.2621830 0.2625011 [141] 0.2628253 0.2631558 0.2634925 0.2638354 0.2641845 0.2645398 0.2649013 [148] 0.2652690 0.2656428 0.2660228 0.2664089 0.2668011 0.2671995 0.2676039 [155] 0.2680144 0.2684310 0.2688536 0.2692823 0.2697169 0.2701575 0.2706041 [162] 0.2710565 0.2715149 0.2719792 0.2724493 0.2729252 0.2734069 0.2738943 [169] 0.2743875 0.2748863 0.2753909 0.2759010 0.2764167 0.2769380 0.2774647 [176] 0.2779970 0.2785347 0.2790777 0.2796261 0.2801798 0.2807388 0.2813030 [183] 0.2818724 0.2824469 0.2830265 0.2836111 0.2842007 0.2847952 0.2853946 [190] 0.2859989 0.2866079 0.2872217 0.2878401 0.2884632 0.2890909 0.2897230 [197] 0.2903597 0.2910007 0.2916461 0.2922958 0.2929497 0.2936078 0.2942700 [204] 0.2949363 0.2956065 0.2962807 0.2969588 0.2976407 0.2983264 0.2990158 [211] 0.2997087 0.3004053 0.3011054 0.3018089 0.3025158 0.3032260 0.3039394 [218] 0.3046561 0.3053758 0.3060987 0.3068245 0.3075532 0.3082848 0.3090192 [225] 0.3097563 0.3104961 0.3112385 0.3119834 0.3127308 0.3134806 0.3142327 [232] 0.3149870 0.3157436 0.3165023 0.3172630 0.3180258 0.3187905 0.3195570 [239] 0.3203254 0.3210955 0.3218672 0.3226405 0.3234154 0.3241918 0.3249695 [246] 0.3257486 0.3265289 0.3273105 0.3280932 0.3288769 0.3296617 0.3304474 [253] 0.3312340 0.3320214 0.3328096 0.3335985 0.3343880 0.3351780 0.3359686 [260] 0.3367596 0.3375509 0.3383426 0.3391346 0.3399267 0.3407190 0.3415113 [267] 0.3423036 0.3430960 0.3438882 0.3446802 0.3454720 0.3462636 0.3470548 [274] 0.3478456 0.3486359 0.3494258 0.3502151 0.3510038 0.3517918 0.3525791 [281] 0.3533656 0.3541513 0.3549361 0.3557199 0.3565028 0.3572846 0.3580654 [288] 0.3588450 0.3596234 0.3604006 0.3611765 0.3619511 0.3627243 0.3634960 [295] 0.3642663 0.3650351 0.3658023 0.3665679 0.3673318 0.3680941 0.3688546 [302] 0.3696133 0.3703702 0.3711252 0.3718783 0.3726295 0.3733787 0.3741258 [309] 0.3748709 0.3756139 0.3763548 0.3770935 0.3778299 0.3785642 0.3792961 [316] 0.3800257 0.3807530 0.3814778 0.3822003 0.3829203 0.3836378 0.3843528 [323] 0.3850653 0.3857752 0.3864825 0.3871871 0.3878891 0.3885884 0.3892850 [330] 0.3899788 0.3906699 0.3913581 0.3920436 0.3927262 0.3934059 0.3940827 [337] 0.3947566 0.3954276 0.3960956 0.3967606 0.3974226 0.3980816 0.3987376 [344] 0.3993904 0.4000402 0.4006869 0.4013305 0.4019709 0.4026082 0.4032423 [351] 0.4038732 0.4045009 0.4051254 0.4057466 0.4063646 0.4069794 0.4075908 [358] 0.4081990 0.4088039 0.4094055 0.4100037 0.4105986 0.4111901 0.4117783 [365] 0.4123632 0.4129446 0.4135227 0.4140974 0.4146687 0.4152365 0.4158010 [372] 0.4163620 0.4169196 0.4174738 0.4180245 0.4185718 0.4191156 0.4196560 [379] 0.4201929 0.4207263 0.4212563 0.4217828 0.4223058 0.4228253 0.4233414 [386] 0.4238540 0.4243631 0.4248687 0.4253708 0.4258695 0.4263647 0.4268563 [393] 0.4273445 0.4278292 0.4283105 0.4287882 0.4292624 0.4297332 0.4302005 [400] 0.4306644 0.4311247 > mx [1] 0.4311247 > 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/1mi9k1258396900.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/2wrci1258396900.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/3syjd1258396900.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/4k7ph1258396900.tab") > system("convert tmp/1mi9k1258396900.ps tmp/1mi9k1258396900.png") > system("convert tmp/2wrci1258396900.ps tmp/2wrci1258396900.png") > system("convert tmp/3syjd1258396900.ps tmp/3syjd1258396900.png") > > > proc.time() user system elapsed 0.757 0.482 0.952