R version 2.7.2 (2008-08-25) 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(2341,2540,2371,2122,2301,2512,3145,2741,2548,1987,2281,2016,2434,2637,1831,1851,1839,2609,2417,2394,2372,2717,2998,2538,3007,2475,2175,2465,2279,2323,2746,2601,2486,2718,2646,2551,2712,2606,2365,3533,3509,2912,3599,2719,2869,4085,2686,2545,3071,3388,2652,3190,2884,3295,3818,3226,3953,3810,2877,3515,3708,3450,3360,4110,4384,3729,4263,3505,3674,3911,2951,3317,3417,3498,2768,2899,3171,3004,3481,3016,2595,3509,2833,3125,2556,3628,2876,2575,2903,3438,2926,3068,3015) > x <- c(3353,3480,3098,2944,3389,3497,4404,3849,3734,3060,3507,3287,3215,3764,2734,2837,2766,3851,3289,3848,3348,3682,4058,3655,3811,3341,3032,3475,3353,3186,3902,4164,3499,4145,3796,3711,3949,3740,3243,4407,4814,3908,5250,3937,4004,5560,3922,3759,4138,4634,3996,4308,4142,4429,5219,4929,5754,5592,4163,4962,5208,4755,4491,5732,5730,5024,6056,4901,5353,5578,4618,4724,5011,5298,4143,4617,4727,4207,5112,4190,4098,5071,4177,4598,3757,5591,4218,3780,4336,4870,4422,4727,4459) > #'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.9123396 0.9126583 0.9129761 0.9132930 0.9136092 0.9139244 0.9142388 [8] 0.9145524 0.9148651 0.9151770 0.9154880 0.9157981 0.9161074 0.9164159 [15] 0.9167234 0.9170301 0.9173359 0.9176408 0.9179449 0.9182481 0.9185504 [22] 0.9188518 0.9191524 0.9194520 0.9197508 0.9200487 0.9203457 0.9206418 [29] 0.9209370 0.9212312 0.9215246 0.9218171 0.9221087 0.9223994 0.9226892 [36] 0.9229780 0.9232660 0.9235530 0.9238391 0.9241243 0.9244086 0.9246919 [43] 0.9249744 0.9252559 0.9255364 0.9258161 0.9260948 0.9263725 0.9266494 [50] 0.9269253 0.9272002 0.9274742 0.9277473 0.9280194 0.9282906 0.9285608 [57] 0.9288301 0.9290984 0.9293658 0.9296322 0.9298976 0.9301621 0.9304256 [64] 0.9306882 0.9309498 0.9312104 0.9314701 0.9317288 0.9319865 0.9322432 [71] 0.9324990 0.9327538 0.9330076 0.9332604 0.9335123 0.9337632 0.9340130 [78] 0.9342619 0.9345098 0.9347568 0.9350027 0.9352476 0.9354916 0.9357345 [85] 0.9359764 0.9362174 0.9364573 0.9366963 0.9369342 0.9371712 0.9374071 [92] 0.9376420 0.9378759 0.9381088 0.9383407 0.9385716 0.9388015 0.9390303 [99] 0.9392582 0.9394850 0.9397108 0.9399355 0.9401593 0.9403820 0.9406037 [106] 0.9408244 0.9410441 0.9412627 0.9414803 0.9416969 0.9419124 0.9421269 [113] 0.9423404 0.9425528 0.9427642 0.9429746 0.9431839 0.9433922 0.9435995 [120] 0.9438057 0.9440109 0.9442150 0.9444181 0.9446201 0.9448211 0.9450210 [127] 0.9452199 0.9454178 0.9456146 0.9458103 0.9460050 0.9461987 0.9463913 [134] 0.9465828 0.9467733 0.9469627 0.9471511 0.9473384 0.9475247 0.9477099 [141] 0.9478940 0.9480771 0.9482591 0.9484401 0.9486200 0.9487988 0.9489766 [148] 0.9491533 0.9493289 0.9495035 0.9496770 0.9498495 0.9500209 0.9501912 [155] 0.9503604 0.9505286 0.9506957 0.9508617 0.9510267 0.9511906 0.9513534 [162] 0.9515152 0.9516758 0.9518355 0.9519940 0.9521515 0.9523078 0.9524632 [169] 0.9526174 0.9527706 0.9529227 0.9530737 0.9532236 0.9533725 0.9535203 [176] 0.9536670 0.9538126 0.9539572 0.9541007 0.9542431 0.9543844 0.9545247 [183] 0.9546638 0.9548019 0.9549389 0.9550749 0.9552097 0.9553435 0.9554762 [190] 0.9556078 0.9557384 0.9558678 0.9559962 0.9561235 0.9562498 0.9563749 [197] 0.9564990 0.9566220 0.9567439 0.9568647 0.9569845 0.9571032 0.9572208 [204] 0.9573373 0.9574527 0.9575671 0.9576804 0.9577926 0.9579037 0.9580138 [211] 0.9581228 0.9582307 0.9583375 0.9584433 0.9585479 0.9586515 0.9587540 [218] 0.9588555 0.9589559 0.9590551 0.9591534 0.9592505 0.9593466 0.9594416 [225] 0.9595355 0.9596284 0.9597202 0.9598109 0.9599005 0.9599891 0.9600766 [232] 0.9601630 0.9602484 0.9603326 0.9604159 0.9604980 0.9605791 0.9606591 [239] 0.9607381 0.9608160 0.9608928 0.9609685 0.9610432 0.9611169 0.9611894 [246] 0.9612609 0.9613314 0.9614007 0.9614691 0.9615363 0.9616025 0.9616677 [253] 0.9617318 0.9617948 0.9618568 0.9619177 0.9619776 0.9620364 0.9620941 [260] 0.9621508 0.9622065 0.9622611 0.9623146 0.9623672 0.9624186 0.9624690 [267] 0.9625184 0.9625667 0.9626140 0.9626602 0.9627054 0.9627496 0.9627927 [274] 0.9628347 0.9628758 0.9629158 0.9629547 0.9629926 0.9630295 0.9630654 [281] 0.9631002 0.9631340 0.9631667 0.9631985 0.9632292 0.9632588 0.9632875 [288] 0.9633151 0.9633417 0.9633673 0.9633918 0.9634153 0.9634378 0.9634593 [295] 0.9634798 0.9634993 0.9635177 0.9635351 0.9635515 0.9635669 0.9635813 [302] 0.9635947 0.9636071 0.9636185 0.9636288 0.9636382 0.9636466 0.9636539 [309] 0.9636603 0.9636656 0.9636700 0.9636734 0.9636757 0.9636771 0.9636775 [316] 0.9636769 0.9636753 0.9636727 0.9636692 0.9636646 0.9636591 0.9636525 [323] 0.9636450 0.9636366 0.9636271 0.9636167 0.9636053 0.9635929 0.9635795 [330] 0.9635652 0.9635499 0.9635336 0.9635164 0.9634982 0.9634791 0.9634589 [337] 0.9634379 0.9634158 0.9633928 0.9633689 0.9633440 0.9633181 0.9632913 [344] 0.9632636 0.9632348 0.9632052 0.9631746 0.9631431 0.9631106 0.9630772 [351] 0.9630428 0.9630075 0.9629713 0.9629341 0.9628960 0.9628570 0.9628170 [358] 0.9627762 0.9627344 0.9626916 0.9626480 0.9626034 0.9625579 0.9625115 [365] 0.9624642 0.9624160 0.9623669 0.9623168 0.9622659 0.9622140 0.9621612 [372] 0.9621076 0.9620530 0.9619975 0.9619412 0.9618839 0.9618257 0.9617667 [379] 0.9617068 0.9616459 0.9615842 0.9615216 0.9614582 0.9613938 0.9613286 [386] 0.9612625 0.9611955 0.9611276 0.9610589 0.9609893 0.9609188 0.9608475 [393] 0.9607753 0.9607022 0.9606283 0.9605535 0.9604778 0.9604014 0.9603240 [400] 0.9602458 0.9601668 > mx [1] 0.9636775 > mxli [1] 1.14 > 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/13elc1226404672.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/21fde1226404672.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/34xdp1226404672.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/4n2pp1226404672.tab") > > system("convert tmp/13elc1226404672.ps tmp/13elc1226404672.png") > system("convert tmp/21fde1226404672.ps tmp/21fde1226404672.png") > system("convert tmp/34xdp1226404672.ps tmp/34xdp1226404672.png") > > > proc.time() user system elapsed 0.998 0.504 1.209