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(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) > x <- 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) > #'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.9017414 0.9021719 0.9026012 0.9030291 0.9034556 0.9038809 0.9043049 [8] 0.9047275 0.9051488 0.9055687 0.9059873 0.9064046 0.9068205 0.9072351 [15] 0.9076483 0.9080601 0.9084706 0.9088798 0.9092875 0.9096939 0.9100989 [22] 0.9105026 0.9109048 0.9113057 0.9117051 0.9121032 0.9124999 0.9128952 [29] 0.9132891 0.9136816 0.9140726 0.9144623 0.9148505 0.9152374 0.9156228 [36] 0.9160068 0.9163893 0.9167704 0.9171501 0.9175284 0.9179052 0.9182806 [43] 0.9186545 0.9190270 0.9193980 0.9197676 0.9201357 0.9205023 0.9208675 [50] 0.9212313 0.9215935 0.9219543 0.9223136 0.9226715 0.9230279 0.9233827 [57] 0.9237362 0.9240881 0.9244385 0.9247875 0.9251349 0.9254809 0.9258253 [64] 0.9261683 0.9265097 0.9268497 0.9271881 0.9275251 0.9278605 0.9281944 [71] 0.9285268 0.9288577 0.9291871 0.9295149 0.9298413 0.9301661 0.9304893 [78] 0.9308111 0.9311313 0.9314500 0.9317671 0.9320827 0.9323968 0.9327094 [85] 0.9330203 0.9333298 0.9336377 0.9339441 0.9342489 0.9345521 0.9348539 [92] 0.9351540 0.9354526 0.9357497 0.9360452 0.9363391 0.9366315 0.9369223 [99] 0.9372116 0.9374993 0.9377854 0.9380700 0.9383530 0.9386344 0.9389142 [106] 0.9391925 0.9394692 0.9397444 0.9400180 0.9402900 0.9405604 0.9408292 [113] 0.9410965 0.9413622 0.9416263 0.9418888 0.9421498 0.9424091 0.9426669 [120] 0.9429231 0.9431777 0.9434308 0.9436822 0.9439321 0.9441803 0.9444270 [127] 0.9446721 0.9449156 0.9451576 0.9453979 0.9456367 0.9458738 0.9461094 [134] 0.9463433 0.9465757 0.9468065 0.9470357 0.9472633 0.9474893 0.9477138 [141] 0.9479366 0.9481578 0.9483775 0.9485955 0.9488120 0.9490269 0.9492401 [148] 0.9494518 0.9496619 0.9498704 0.9500773 0.9502826 0.9504863 0.9506885 [155] 0.9508890 0.9510879 0.9512853 0.9514810 0.9516752 0.9518678 0.9520587 [162] 0.9522481 0.9524359 0.9526221 0.9528068 0.9529898 0.9531712 0.9533511 [169] 0.9535294 0.9537060 0.9538811 0.9540546 0.9542266 0.9543969 0.9545657 [176] 0.9547328 0.9548984 0.9550624 0.9552248 0.9553857 0.9555449 0.9557026 [183] 0.9558587 0.9560133 0.9561662 0.9563176 0.9564674 0.9566156 0.9567623 [190] 0.9569073 0.9570509 0.9571928 0.9573332 0.9574720 0.9576092 0.9577449 [197] 0.9578790 0.9580115 0.9581425 0.9582719 0.9583998 0.9585261 0.9586508 [204] 0.9587740 0.9588956 0.9590157 0.9591342 0.9592512 0.9593666 0.9594804 [211] 0.9595928 0.9597035 0.9598128 0.9599204 0.9600266 0.9601312 0.9602343 [218] 0.9603358 0.9604358 0.9605342 0.9606311 0.9607265 0.9608204 0.9609127 [225] 0.9610035 0.9610928 0.9611806 0.9612668 0.9613515 0.9614347 0.9615164 [232] 0.9615966 0.9616752 0.9617524 0.9618280 0.9619021 0.9619747 0.9620458 [239] 0.9621154 0.9621836 0.9622502 0.9623153 0.9623789 0.9624410 0.9625016 [246] 0.9625608 0.9626184 0.9626746 0.9627293 0.9627825 0.9628342 0.9628845 [253] 0.9629332 0.9629805 0.9630264 0.9630707 0.9631136 0.9631550 0.9631950 [260] 0.9632335 0.9632705 0.9633061 0.9633402 0.9633729 0.9634041 0.9634339 [267] 0.9634623 0.9634891 0.9635146 0.9635386 0.9635612 0.9635823 0.9636020 [274] 0.9636203 0.9636371 0.9636525 0.9636665 0.9636791 0.9636902 0.9637000 [281] 0.9637083 0.9637152 0.9637207 0.9637248 0.9637275 0.9637287 0.9637286 [288] 0.9637271 0.9637242 0.9637199 0.9637142 0.9637071 0.9636987 0.9636888 [295] 0.9636776 0.9636650 0.9636510 0.9636356 0.9636189 0.9636008 0.9635813 [302] 0.9635605 0.9635383 0.9635148 0.9634899 0.9634636 0.9634360 0.9634071 [309] 0.9633768 0.9633451 0.9633122 0.9632778 0.9632422 0.9632052 0.9631669 [316] 0.9631272 0.9630863 0.9630440 0.9630004 0.9629555 0.9629092 0.9628617 [323] 0.9628128 0.9627626 0.9627112 0.9626584 0.9626043 0.9625490 0.9624923 [330] 0.9624344 0.9623752 0.9623146 0.9622528 0.9621898 0.9621254 0.9620598 [337] 0.9619929 0.9619247 0.9618553 0.9617846 0.9617126 0.9616394 0.9615650 [344] 0.9614892 0.9614123 0.9613341 0.9612546 0.9611739 0.9610920 0.9610088 [351] 0.9609244 0.9608388 0.9607519 0.9606638 0.9605745 0.9604840 0.9603923 [358] 0.9602993 0.9602052 0.9601098 0.9600132 0.9599154 0.9598165 0.9597163 [365] 0.9596149 0.9595124 0.9594086 0.9593037 0.9591976 0.9590903 0.9589819 [372] 0.9588722 0.9587614 0.9586495 0.9585363 0.9584220 0.9583066 0.9581900 [379] 0.9580722 0.9579533 0.9578332 0.9577120 0.9575896 0.9574662 0.9573415 [386] 0.9572158 0.9570889 0.9569609 0.9568317 0.9567014 0.9565701 0.9564376 [393] 0.9563039 0.9561692 0.9560334 0.9558964 0.9557584 0.9556193 0.9554790 [400] 0.9553377 0.9551953 > mx [1] 0.9637287 > mxli [1] 0.85 > 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/1ince1226405458.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/2xbcl1226405458.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/3o02e1226405458.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/4g0j51226405458.tab") > > system("convert tmp/1ince1226405458.ps tmp/1ince1226405458.png") > system("convert tmp/2xbcl1226405458.ps tmp/2xbcl1226405458.png") > system("convert tmp/3o02e1226405458.ps tmp/3o02e1226405458.png") > > > proc.time() user system elapsed 1.059 0.555 3.099