R version 2.7.0 (2008-04-22) 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(13429.9,13470.1,14785.8,14292,14308.8,14013,13240.9,12153.4,14289.7,15669.2,14169.5,14569.8,14469.1,14264.9,15320.9,14433.5,13691.5,14194.1,13519.2,11857.9,14616,15643.4,14077.2,14887.5,14159.9,14643,17192.5,15386.1,14287.1,17526.6,14497,14398.3,16629.6,16670.7,16614.8,16869.2,15663.9,16359.9,18447.7,16889,16505,18320.9,15052.1,15699.8,18135.3,16768.7,18883,19021,18101.9,17776.1,21489.9,17065.3,18690,18953.1,16398.9,16895.7,18553,19270,19422.1,17579.4,18637.3,18076.7,20438.6,18075.2,19563,19899.2,19227.5,17789.6,19220.8,21968.9,21131.5,19484.6) > x <- c(14291.1,14205.3,15859.4,15258.9,15498.6,15106.5,15023.6,12083,15761.3,16943,15070.3,13659.6,14768.9,14725.1,15998.1,15370.6,14956.9,15469.7,15101.8,11703.7,16283.6,16726.5,14968.9,14861,14583.3,15305.8,17903.9,16379.4,15420.3,17870.5,15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22160,20664.3,17877.4) > #'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.9022069 0.9025275 0.9028471 0.9031657 0.9034834 0.9038002 0.9041160 [8] 0.9044308 0.9047447 0.9050577 0.9053696 0.9056807 0.9059908 0.9062999 [15] 0.9066081 0.9069153 0.9072216 0.9075269 0.9078312 0.9081346 0.9084371 [22] 0.9087386 0.9090391 0.9093387 0.9096373 0.9099350 0.9102317 0.9105275 [29] 0.9108223 0.9111161 0.9114090 0.9117009 0.9119919 0.9122819 0.9125709 [36] 0.9128590 0.9131461 0.9134323 0.9137175 0.9140018 0.9142851 0.9145674 [43] 0.9148488 0.9151292 0.9154087 0.9156872 0.9159647 0.9162413 0.9165169 [50] 0.9167916 0.9170653 0.9173380 0.9176098 0.9178806 0.9181505 0.9184194 [57] 0.9186874 0.9189544 0.9192204 0.9194855 0.9197496 0.9200128 0.9202750 [64] 0.9205362 0.9207965 0.9210558 0.9213142 0.9215716 0.9218281 0.9220836 [71] 0.9223382 0.9225917 0.9228444 0.9230961 0.9233468 0.9235966 0.9238454 [78] 0.9240932 0.9243401 0.9245861 0.9248311 0.9250752 0.9253183 0.9255604 [85] 0.9258016 0.9260418 0.9262811 0.9265195 0.9267568 0.9269933 0.9272288 [92] 0.9274633 0.9276969 0.9279295 0.9281612 0.9283920 0.9286218 0.9288506 [99] 0.9290785 0.9293055 0.9295315 0.9297566 0.9299807 0.9302039 0.9304261 [106] 0.9306474 0.9308678 0.9310872 0.9313056 0.9315232 0.9317398 0.9319554 [113] 0.9321701 0.9323839 0.9325967 0.9328086 0.9330196 0.9332296 0.9334387 [120] 0.9336469 0.9338541 0.9340604 0.9342657 0.9344702 0.9346736 0.9348762 [127] 0.9350778 0.9352785 0.9354783 0.9356772 0.9358751 0.9360721 0.9362681 [134] 0.9364633 0.9366575 0.9368508 0.9370432 0.9372346 0.9374251 0.9376147 [141] 0.9378034 0.9379912 0.9381781 0.9383640 0.9385490 0.9387331 0.9389163 [148] 0.9390985 0.9392799 0.9394603 0.9396399 0.9398185 0.9399962 0.9401730 [155] 0.9403489 0.9405239 0.9406980 0.9408711 0.9410434 0.9412148 0.9413852 [162] 0.9415548 0.9417234 0.9418912 0.9420580 0.9422240 0.9423890 0.9425532 [169] 0.9427165 0.9428788 0.9430403 0.9432009 0.9433606 0.9435194 0.9436773 [176] 0.9438343 0.9439904 0.9441456 0.9443000 0.9444535 0.9446060 0.9447577 [183] 0.9449085 0.9450585 0.9452075 0.9453557 0.9455030 0.9456494 0.9457949 [190] 0.9459396 0.9460834 0.9462263 0.9463683 0.9465095 0.9466498 0.9467892 [197] 0.9469278 0.9470655 0.9472023 0.9473382 0.9474733 0.9476076 0.9477409 [204] 0.9478734 0.9480051 0.9481359 0.9482658 0.9483949 0.9485231 0.9486504 [211] 0.9487769 0.9489026 0.9490274 0.9491513 0.9492744 0.9493967 0.9495181 [218] 0.9496386 0.9497583 0.9498772 0.9499952 0.9501124 0.9502287 0.9503442 [225] 0.9504589 0.9505727 0.9506857 0.9507979 0.9509092 0.9510197 0.9511293 [232] 0.9512382 0.9513461 0.9514533 0.9515596 0.9516652 0.9517698 0.9518737 [239] 0.9519768 0.9520790 0.9521804 0.9522809 0.9523807 0.9524797 0.9525778 [246] 0.9526751 0.9527716 0.9528673 0.9529622 0.9530562 0.9531495 0.9532419 [253] 0.9533336 0.9534244 0.9535145 0.9536037 0.9536921 0.9537798 0.9538666 [260] 0.9539526 0.9540379 0.9541223 0.9542060 0.9542888 0.9543709 0.9544521 [267] 0.9545326 0.9546123 0.9546912 0.9547694 0.9548467 0.9549232 0.9549990 [274] 0.9550740 0.9551482 0.9552216 0.9552943 0.9553662 0.9554373 0.9555076 [281] 0.9555771 0.9556459 0.9557139 0.9557812 0.9558477 0.9559134 0.9559783 [288] 0.9560425 0.9561059 0.9561686 0.9562305 0.9562916 0.9563520 0.9564116 [295] 0.9564704 0.9565286 0.9565859 0.9566425 0.9566984 0.9567535 0.9568078 [302] 0.9568614 0.9569143 0.9569664 0.9570178 0.9570684 0.9571183 0.9571675 [309] 0.9572159 0.9572636 0.9573105 0.9573567 0.9574022 0.9574469 0.9574909 [316] 0.9575342 0.9575768 0.9576186 0.9576597 0.9577001 0.9577397 0.9577787 [323] 0.9578169 0.9578543 0.9578911 0.9579272 0.9579625 0.9579971 0.9580310 [330] 0.9580642 0.9580967 0.9581285 0.9581595 0.9581899 0.9582195 0.9582485 [337] 0.9582767 0.9583042 0.9583311 0.9583572 0.9583826 0.9584074 0.9584314 [344] 0.9584548 0.9584774 0.9584994 0.9585206 0.9585412 0.9585611 0.9585803 [351] 0.9585988 0.9586166 0.9586338 0.9586503 0.9586660 0.9586811 0.9586955 [358] 0.9587093 0.9587223 0.9587347 0.9587464 0.9587575 0.9587678 0.9587775 [365] 0.9587866 0.9587949 0.9588026 0.9588096 0.9588160 0.9588217 0.9588267 [372] 0.9588311 0.9588348 0.9588378 0.9588402 0.9588420 0.9588431 0.9588435 [379] 0.9588433 0.9588424 0.9588409 0.9588387 0.9588359 0.9588324 0.9588283 [386] 0.9588235 0.9588181 0.9588121 0.9588054 0.9587980 0.9587901 0.9587815 [393] 0.9587722 0.9587624 0.9587518 0.9587407 0.9587289 0.9587165 0.9587035 [400] 0.9586898 0.9586756 > mx [1] 0.9588435 > mxli [1] 1.77 > 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/1i5gl1228678826.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/2ol051228678826.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/3ctts1228678826.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/4cmpl1228678826.tab") > > system("convert tmp/1i5gl1228678826.ps tmp/1i5gl1228678826.png") > system("convert tmp/2ol051228678826.ps tmp/2ol051228678826.png") > system("convert tmp/3ctts1228678826.ps tmp/3ctts1228678826.png") > > > proc.time() user system elapsed 2.744 1.405 2.916