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(2187,1852,1570,1851,1954,1828,2251,2277,2085,2282,2266,1878,2267,2069,1746,2299,2360,2214,2825,2355,2333,3016,2155,2172,2150,2533,2058,2160,2259,2498,2695,2799,2945,2930,2318,2540,2570,2669,2450,2842,3439,2677,2979,2257,2842,2546,2455,2293,2379,2478,2054,2272,2351,2271,2542,2304,2194,2722,2395,2146,1894,2548,2087,2063,2481,2476,2212,2834,2148,2598) > x <- c(88.3,88.6,91,91.5,95.4,98.7,99.9,98.6,100.3,100.2,100.4,101.4,103,109.1,111.4,114.1,121.8,127.6,129.9,128,123.5,124,127.4,127.6,128.4,131.4,135.1,134,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207,206.6,210.6,211.1,215,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221,213.6,243.4,253.8,265.3,268.2,268.5,266.9) > #'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.4306797 0.4302225 0.4297638 0.4293036 0.4288419 0.4283787 0.4279139 [8] 0.4274476 0.4269798 0.4265105 0.4260397 0.4255674 0.4250936 0.4246183 [15] 0.4241415 0.4236632 0.4231834 0.4227021 0.4222193 0.4217351 0.4212494 [22] 0.4207622 0.4202735 0.4197834 0.4192918 0.4187987 0.4183042 0.4178082 [29] 0.4173108 0.4168120 0.4163117 0.4158099 0.4153068 0.4148022 0.4142961 [36] 0.4137887 0.4132798 0.4127696 0.4122579 0.4117448 0.4112303 0.4107145 [43] 0.4101972 0.4096785 0.4091585 0.4086371 0.4081143 0.4075902 0.4070647 [50] 0.4065378 0.4060096 0.4054800 0.4049491 0.4044169 0.4038833 0.4033484 [57] 0.4028122 0.4022747 0.4017358 0.4011957 0.4006543 0.4001115 0.3995675 [64] 0.3990222 0.3984756 0.3979278 0.3973787 0.3968283 0.3962767 0.3957238 [71] 0.3951697 0.3946143 0.3940578 0.3935000 0.3929410 0.3923807 0.3918193 [78] 0.3912567 0.3906929 0.3901279 0.3895618 0.3889944 0.3884259 0.3878563 [85] 0.3872855 0.3867135 0.3861404 0.3855662 0.3849909 0.3844144 0.3838369 [92] 0.3832582 0.3826785 0.3820976 0.3815157 0.3809327 0.3803487 0.3797636 [99] 0.3791774 0.3785902 0.3780020 0.3774127 0.3768225 0.3762312 0.3756389 [106] 0.3750456 0.3744513 0.3738561 0.3732598 0.3726626 0.3720645 0.3714654 [113] 0.3708654 0.3702644 0.3696625 0.3690597 0.3684560 0.3678513 0.3672458 [120] 0.3666394 0.3660322 0.3654240 0.3648150 0.3642052 0.3635945 0.3629830 [127] 0.3623707 0.3617575 0.3611436 0.3605288 0.3599133 0.3592969 0.3586799 [134] 0.3580620 0.3574434 0.3568240 0.3562039 0.3555831 0.3549616 0.3543393 [141] 0.3537164 0.3530928 0.3524684 0.3518434 0.3512178 0.3505915 0.3499645 [148] 0.3493369 0.3487087 0.3480799 0.3474504 0.3468204 0.3461897 0.3455585 [155] 0.3449267 0.3442944 0.3436615 0.3430280 0.3423941 0.3417596 0.3411245 [162] 0.3404890 0.3398530 0.3392165 0.3385795 0.3379421 0.3373042 0.3366658 [169] 0.3360270 0.3353878 0.3347481 0.3341081 0.3334676 0.3328268 0.3321856 [176] 0.3315440 0.3309020 0.3302597 0.3296170 0.3289741 0.3283308 0.3276871 [183] 0.3270432 0.3263990 0.3257545 0.3251097 0.3244647 0.3238194 0.3231739 [190] 0.3225281 0.3218821 0.3212359 0.3205894 0.3199428 0.3192960 0.3186490 [197] 0.3180019 0.3173546 0.3167071 0.3160595 0.3154118 0.3147640 0.3141160 [204] 0.3134680 0.3128199 0.3121716 0.3115234 0.3108750 0.3102266 0.3095782 [211] 0.3089297 0.3082812 0.3076327 0.3069842 0.3063357 0.3056872 0.3050388 [218] 0.3043904 0.3037420 0.3030937 0.3024454 0.3017973 0.3011492 0.3005012 [225] 0.2998533 0.2992055 0.2985578 0.2979103 0.2972629 0.2966157 0.2959686 [232] 0.2953217 0.2946749 0.2940284 0.2933820 0.2927359 0.2920899 0.2914442 [239] 0.2907988 0.2901535 0.2895086 0.2888638 0.2882194 0.2875752 0.2869313 [246] 0.2862877 0.2856445 0.2850015 0.2843589 0.2837166 0.2830746 0.2824330 [253] 0.2817917 0.2811508 0.2805103 0.2798702 0.2792305 0.2785912 0.2779523 [260] 0.2773138 0.2766757 0.2760381 0.2754009 0.2747642 0.2741279 0.2734922 [267] 0.2728569 0.2722220 0.2715877 0.2709539 0.2703206 0.2696878 0.2690556 [274] 0.2684239 0.2677927 0.2671621 0.2665321 0.2659026 0.2652737 0.2646454 [281] 0.2640177 0.2633906 0.2627641 0.2621382 0.2615129 0.2608883 0.2602643 [288] 0.2596410 0.2590183 0.2583963 0.2577749 0.2571543 0.2565343 0.2559150 [295] 0.2552964 0.2546786 0.2540614 0.2534450 0.2528293 0.2522143 0.2516001 [302] 0.2509866 0.2503739 0.2497619 0.2491508 0.2485404 0.2479308 0.2473219 [309] 0.2467139 0.2461067 0.2455003 0.2448948 0.2442900 0.2436861 0.2430830 [316] 0.2424808 0.2418794 0.2412789 0.2406792 0.2400804 0.2394825 0.2388855 [323] 0.2382894 0.2376941 0.2370998 0.2365064 0.2359139 0.2353223 0.2347316 [330] 0.2341418 0.2335530 0.2329652 0.2323783 0.2317923 0.2312073 0.2306233 [337] 0.2300402 0.2294582 0.2288771 0.2282969 0.2277178 0.2271397 0.2265626 [344] 0.2259865 0.2254114 0.2248373 0.2242642 0.2236922 0.2231212 0.2225512 [351] 0.2219823 0.2214144 0.2208476 0.2202818 0.2197171 0.2191535 0.2185909 [358] 0.2180295 0.2174690 0.2169097 0.2163515 0.2157943 0.2152383 0.2146833 [365] 0.2141295 0.2135768 0.2130251 0.2124746 0.2119253 0.2113770 0.2108299 [372] 0.2102839 0.2097390 0.2091953 0.2086527 0.2081113 0.2075711 0.2070319 [379] 0.2064940 0.2059572 0.2054216 0.2048871 0.2043538 0.2038217 0.2032908 [386] 0.2027610 0.2022324 0.2017051 0.2011789 0.2006539 0.2001301 0.1996075 [393] 0.1990861 0.1985659 0.1980469 0.1975292 0.1970126 0.1964973 0.1959832 [400] 0.1954703 0.1949586 > mx [1] 0.4306797 > 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/1pnyq1228486188.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/2ycx91228486188.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/3r3x41228486188.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/43ssr1228486188.tab") > > system("convert tmp/1pnyq1228486188.ps tmp/1pnyq1228486188.png") > system("convert tmp/2ycx91228486188.ps tmp/2ycx91228486188.png") > system("convert tmp/3r3x41228486188.ps tmp/3r3x41228486188.png") > > > proc.time() user system elapsed 0.783 0.502 0.939