R version 2.8.1 (2008-12-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(10284.5,12792,12823.61538,13845.66667,15335.63636,11188.5,13633.25,12298.46667,15353.63636,12696.15385,12213.93333,13683.72727,11214.14286,13950.23077,11179.13333,11801.875,11188.82353,16456.27273,11110.0625,16530.69231,10038.41176,11681.25,11148.88235,8631,9386.444444,9764.736842,12043.75,12948.06667,10987.125,11648.3125,10633.35294,10219.3,9037.6,10296.31579,11705.41176,10681.94444,9362.947368,11306.35294,10984.45,10062.61905,8118.583333,8867.48,8346.72,8529.307692,10697.18182,8591.84,8695.607143,8125.571429,7009.758621,7883.466667,7527.645161,6763.758621,6682.333333,7855.681818,6738.88,7895.434783,6361.884615,6935.956522,8344.454545,9107.944444) > x <- c(9904.642857,13710.15385,13747.69231,14517,15185.81818,11422.28571,13819.66667,12749,16217,13238,12391,14780.09091,10815.42857,14770.84615,11831,11931.3125,10611.94118,15923.18182,11094.875,16209.53846,10100,12149.6875,11644.35294,9249.947368,8980.777778,10244.52632,12457.5625,13307.46667,10839.625,11827.625,10925.94118,10675.3,9297.3,10433.21053,12261.41176,10911.22222,9334.421053,11655.05882,11080,9840.142857,7448.916667,8362.6,8465.64,8220.923077,10432.86364,8537.4,8535.464286,7997.464286,6301.413793,7595.566667,7200.483871,6152.482759,6064.259259,7269.909091,6578.44,7708.26087,6401.153846,7042.043478,8296.409091,9613.333333) > #'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.8950781 0.8955847 0.8960905 0.8965956 0.8971001 0.8976038 0.8981068 [8] 0.8986091 0.8991106 0.8996115 0.9001115 0.9006108 0.9011094 0.9016072 [15] 0.9021042 0.9026005 0.9030959 0.9035906 0.9040844 0.9045775 0.9050697 [22] 0.9055612 0.9060518 0.9065415 0.9070305 0.9075185 0.9080058 0.9084921 [29] 0.9089776 0.9094622 0.9099460 0.9104288 0.9109108 0.9113918 0.9118720 [36] 0.9123512 0.9128295 0.9133069 0.9137833 0.9142588 0.9147334 0.9152070 [43] 0.9156796 0.9161513 0.9166220 0.9170916 0.9175604 0.9180281 0.9184948 [50] 0.9189605 0.9194251 0.9198888 0.9203514 0.9208130 0.9212735 0.9217330 [57] 0.9221914 0.9226488 0.9231051 0.9235603 0.9240144 0.9244675 0.9249194 [64] 0.9253702 0.9258199 0.9262685 0.9267160 0.9271623 0.9276075 0.9280516 [71] 0.9284945 0.9289362 0.9293768 0.9298162 0.9302544 0.9306914 0.9311273 [78] 0.9315619 0.9319954 0.9324276 0.9328586 0.9332884 0.9337169 0.9341442 [85] 0.9345703 0.9349951 0.9354187 0.9358410 0.9362620 0.9366817 0.9371002 [92] 0.9375174 0.9379333 0.9383478 0.9387611 0.9391731 0.9395837 0.9399930 [99] 0.9404010 0.9408076 0.9412129 0.9416168 0.9420194 0.9424206 0.9428205 [106] 0.9432189 0.9436160 0.9440117 0.9444060 0.9447989 0.9451904 0.9455805 [113] 0.9459691 0.9463564 0.9467422 0.9471265 0.9475095 0.9478909 0.9482710 [120] 0.9486495 0.9490266 0.9494023 0.9497764 0.9501491 0.9505203 0.9508899 [127] 0.9512581 0.9516248 0.9519900 0.9523536 0.9527158 0.9530764 0.9534355 [134] 0.9537930 0.9541490 0.9545034 0.9548563 0.9552077 0.9555574 0.9559056 [141] 0.9562523 0.9565973 0.9569408 0.9572827 0.9576229 0.9579616 0.9582987 [148] 0.9586341 0.9589680 0.9593002 0.9596308 0.9599598 0.9602872 0.9606129 [155] 0.9609369 0.9612593 0.9615801 0.9618992 0.9622166 0.9625324 0.9628465 [162] 0.9631590 0.9634697 0.9637788 0.9640862 0.9643918 0.9646958 0.9649981 [169] 0.9652987 0.9655976 0.9658947 0.9661902 0.9664839 0.9667759 0.9670662 [176] 0.9673547 0.9676415 0.9679266 0.9682099 0.9684914 0.9687712 0.9690493 [183] 0.9693256 0.9696001 0.9698729 0.9701439 0.9704131 0.9706806 0.9709462 [190] 0.9712101 0.9714722 0.9717325 0.9719910 0.9722477 0.9725026 0.9727558 [197] 0.9730071 0.9732566 0.9735042 0.9737501 0.9739942 0.9742364 0.9744768 [204] 0.9747154 0.9749522 0.9751871 0.9754202 0.9756515 0.9758809 0.9761085 [211] 0.9763342 0.9765581 0.9767801 0.9770003 0.9772187 0.9774352 0.9776498 [218] 0.9778626 0.9780735 0.9782825 0.9784897 0.9786950 0.9788985 0.9791001 [225] 0.9792998 0.9794976 0.9796936 0.9798877 0.9800799 0.9802702 0.9804586 [232] 0.9806452 0.9808299 0.9810127 0.9811936 0.9813726 0.9815497 0.9817250 [239] 0.9818983 0.9820698 0.9822394 0.9824070 0.9825728 0.9827367 0.9828987 [246] 0.9830588 0.9832170 0.9833733 0.9835277 0.9836802 0.9838308 0.9839795 [253] 0.9841263 0.9842712 0.9844141 0.9845552 0.9846944 0.9848317 0.9849671 [260] 0.9851006 0.9852322 0.9853618 0.9854896 0.9856155 0.9857395 0.9858615 [267] 0.9859817 0.9861000 0.9862164 0.9863308 0.9864434 0.9865541 0.9866628 [274] 0.9867697 0.9868747 0.9869778 0.9870790 0.9871782 0.9872756 0.9873711 [281] 0.9874648 0.9875565 0.9876463 0.9877342 0.9878203 0.9879044 0.9879867 [288] 0.9880671 0.9881456 0.9882222 0.9882970 0.9883698 0.9884408 0.9885099 [295] 0.9885772 0.9886425 0.9887060 0.9887677 0.9888274 0.9888853 0.9889413 [302] 0.9889955 0.9890478 0.9890982 0.9891468 0.9891935 0.9892384 0.9892814 [309] 0.9893226 0.9893619 0.9893994 0.9894351 0.9894689 0.9895008 0.9895310 [316] 0.9895593 0.9895857 0.9896104 0.9896332 0.9896542 0.9896734 0.9896907 [323] 0.9897063 0.9897200 0.9897319 0.9897420 0.9897504 0.9897569 0.9897616 [330] 0.9897645 0.9897657 0.9897650 0.9897626 0.9897584 0.9897524 0.9897446 [337] 0.9897350 0.9897237 0.9897107 0.9896958 0.9896792 0.9896609 0.9896408 [344] 0.9896189 0.9895953 0.9895700 0.9895429 0.9895141 0.9894836 0.9894513 [351] 0.9894173 0.9893816 0.9893442 0.9893050 0.9892642 0.9892216 0.9891774 [358] 0.9891315 0.9890838 0.9890345 0.9889835 0.9889308 0.9888765 0.9888204 [365] 0.9887627 0.9887034 0.9886424 0.9885797 0.9885154 0.9884494 0.9883818 [372] 0.9883125 0.9882417 0.9881691 0.9880950 0.9880193 0.9879419 0.9878629 [379] 0.9877823 0.9877001 0.9876164 0.9875310 0.9874440 0.9873555 0.9872653 [386] 0.9871736 0.9870804 0.9869855 0.9868891 0.9867912 0.9866917 0.9865907 [393] 0.9864881 0.9863840 0.9862783 0.9861711 0.9860624 0.9859522 0.9858405 [400] 0.9857273 0.9856126 > mx [1] 0.9897657 > mxli [1] 1.3 > 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/rcomp/tmp/1k88b1257800912.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/rcomp/tmp/26fog1257800912.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/rcomp/tmp/3ols41257800912.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4eykz1257800912.tab") > > system("convert tmp/1k88b1257800912.ps tmp/1k88b1257800912.png") > system("convert tmp/26fog1257800912.ps tmp/26fog1257800912.png") > system("convert tmp/3ols41257800912.ps tmp/3ols41257800912.png") > > > proc.time() user system elapsed 0.940 0.810 1.565