R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(1.74,1.75,1.83,2.09,2.12,2.29,2.4,2.82,3.18,4,4.8,5.28,5.37,5.27,5.33,5.23,5.08,5.11,5.1,4.97,5,5.2,4.9,4.82,5.04,4.82,4.77,4.79,4.58,4.59,4.57,4.35,4.27,4.39,3.97,3.84,3.73,3.58,3.45,3.44,3.25,3.25,3.02,2.87,2.92,2.95,2.75,2.7,2.75,2.72,2.71,2.76,2.68,2.78,2.86,2.75,2.87,2.91,2.79,2.77) > x <- c(2.67,2.72,2.84,3,3.08,3.21,3.44,3.74,4.08,4.79,5.44,6.02,6.01,5.85,5.93,5.85,5.74,5.75,5.78,5.62,5.67,5.89,5.67,5.64,5.64,5.64,5.54,5.52,5.28,5.25,5.23,5.09,5,5.02,4.8,4.71,4.51,4.51,4.42,4.4,4.25,4.18,4.09,3.97,3.89,4.02,3.81,3.67,3.68,3.66,3.66,3.65,3.67,3.66,3.7,3.77,3.74,3.8,3.79,3.75) > #'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.9274810 0.9279369 0.9283915 0.9288446 0.9292963 0.9297465 0.9301954 [8] 0.9306428 0.9310888 0.9315334 0.9319765 0.9324182 0.9328585 0.9332973 [15] 0.9337346 0.9341706 0.9346050 0.9350380 0.9354695 0.9358996 0.9363282 [22] 0.9367553 0.9371810 0.9376052 0.9380279 0.9384491 0.9388688 0.9392871 [29] 0.9397038 0.9401191 0.9405329 0.9409451 0.9413559 0.9417652 0.9421729 [36] 0.9425792 0.9429839 0.9433871 0.9437888 0.9441890 0.9445877 0.9449848 [43] 0.9453805 0.9457745 0.9461671 0.9465581 0.9469476 0.9473356 0.9477220 [50] 0.9481069 0.9484903 0.9488721 0.9492523 0.9496310 0.9500082 0.9503838 [57] 0.9507579 0.9511304 0.9515014 0.9518708 0.9522386 0.9526049 0.9529696 [64] 0.9533328 0.9536944 0.9540544 0.9544129 0.9547698 0.9551252 0.9554789 [71] 0.9558312 0.9561818 0.9565309 0.9568784 0.9572243 0.9575686 0.9579114 [78] 0.9582526 0.9585922 0.9589303 0.9592668 0.9596017 0.9599350 0.9602667 [85] 0.9605969 0.9609255 0.9612525 0.9615779 0.9619017 0.9622240 0.9625447 [92] 0.9628638 0.9631813 0.9634972 0.9638116 0.9641244 0.9644356 0.9647452 [99] 0.9650532 0.9653597 0.9656645 0.9659678 0.9662695 0.9665697 0.9668682 [106] 0.9671652 0.9674606 0.9677544 0.9680467 0.9683373 0.9686264 0.9689139 [113] 0.9691999 0.9694842 0.9697670 0.9700482 0.9703279 0.9706060 0.9708825 [120] 0.9711574 0.9714307 0.9717025 0.9719728 0.9722414 0.9725085 0.9727741 [127] 0.9730380 0.9733004 0.9735613 0.9738206 0.9740783 0.9743345 0.9745891 [134] 0.9748422 0.9750937 0.9753436 0.9755920 0.9758389 0.9760842 0.9763280 [141] 0.9765702 0.9768109 0.9770501 0.9772877 0.9775237 0.9777583 0.9779913 [148] 0.9782227 0.9784527 0.9786811 0.9789080 0.9791333 0.9793572 0.9795795 [155] 0.9798003 0.9800196 0.9802373 0.9804536 0.9806684 0.9808816 0.9810933 [162] 0.9813036 0.9815123 0.9817195 0.9819253 0.9821295 0.9823322 0.9825335 [169] 0.9827333 0.9829316 0.9831284 0.9833237 0.9835175 0.9837099 0.9839008 [176] 0.9840902 0.9842782 0.9844647 0.9846497 0.9848333 0.9850154 0.9851961 [183] 0.9853753 0.9855530 0.9857293 0.9859042 0.9860776 0.9862496 0.9864202 [190] 0.9865893 0.9867570 0.9869233 0.9870881 0.9872516 0.9874136 0.9875742 [197] 0.9877333 0.9878911 0.9880475 0.9882025 0.9883560 0.9885082 0.9886590 [204] 0.9888084 0.9889564 0.9891030 0.9892482 0.9893921 0.9895345 0.9896757 [211] 0.9898154 0.9899538 0.9900908 0.9902265 0.9903608 0.9904937 0.9906253 [218] 0.9907556 0.9908845 0.9910121 0.9911384 0.9912633 0.9913869 0.9915091 [225] 0.9916301 0.9917497 0.9918680 0.9919850 0.9921007 0.9922151 0.9923282 [232] 0.9924400 0.9925505 0.9926597 0.9927676 0.9928743 0.9929796 0.9930837 [239] 0.9931866 0.9932881 0.9933884 0.9934874 0.9935852 0.9936817 0.9937770 [246] 0.9938710 0.9939638 0.9940553 0.9941456 0.9942347 0.9943225 0.9944092 [253] 0.9944946 0.9945787 0.9946617 0.9947435 0.9948240 0.9949034 0.9949815 [260] 0.9950585 0.9951343 0.9952089 0.9952823 0.9953545 0.9954255 0.9954954 [267] 0.9955641 0.9956317 0.9956981 0.9957633 0.9958274 0.9958903 0.9959521 [274] 0.9960127 0.9960722 0.9961306 0.9961879 0.9962440 0.9962990 0.9963528 [281] 0.9964056 0.9964573 0.9965078 0.9965573 0.9966056 0.9966529 0.9966990 [288] 0.9967441 0.9967881 0.9968310 0.9968728 0.9969136 0.9969533 0.9969919 [295] 0.9970295 0.9970660 0.9971014 0.9971359 0.9971692 0.9972015 0.9972328 [302] 0.9972631 0.9972923 0.9973205 0.9973477 0.9973739 0.9973990 0.9974231 [309] 0.9974463 0.9974684 0.9974895 0.9975096 0.9975288 0.9975469 0.9975641 [316] 0.9975803 0.9975955 0.9976098 0.9976230 0.9976354 0.9976467 0.9976571 [323] 0.9976665 0.9976750 0.9976826 0.9976892 0.9976948 0.9976996 0.9977034 [330] 0.9977063 0.9977082 0.9977092 0.9977094 0.9977086 0.9977069 0.9977043 [337] 0.9977007 0.9976963 0.9976911 0.9976849 0.9976778 0.9976698 0.9976610 [344] 0.9976513 0.9976407 0.9976293 0.9976170 0.9976038 0.9975898 0.9975749 [351] 0.9975592 0.9975426 0.9975252 0.9975070 0.9974879 0.9974680 0.9974473 [358] 0.9974257 0.9974033 0.9973801 0.9973561 0.9973313 0.9973057 0.9972792 [365] 0.9972520 0.9972240 0.9971952 0.9971656 0.9971352 0.9971041 0.9970721 [372] 0.9970394 0.9970059 0.9969717 0.9969367 0.9969009 0.9968644 0.9968271 [379] 0.9967890 0.9967503 0.9967107 0.9966705 0.9966295 0.9965878 0.9965453 [386] 0.9965021 0.9964582 0.9964136 0.9963683 0.9963222 0.9962755 0.9962280 [393] 0.9961798 0.9961310 0.9960814 0.9960312 0.9959802 0.9959286 0.9958763 [400] 0.9958233 0.9957696 > mx [1] 0.9977094 > mxli [1] 1.32 > 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/1stbs1258123177.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/2he1p1258123177.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/3pohh1258123177.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/4qv7x1258123177.tab") > system("convert tmp/1stbs1258123177.ps tmp/1stbs1258123177.png") > system("convert tmp/2he1p1258123177.ps tmp/2he1p1258123177.png") > system("convert tmp/3pohh1258123177.ps tmp/3pohh1258123177.png") > > > proc.time() user system elapsed 0.771 0.506 0.913