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(2.05,2.11,2.09,2.05,2.08,2.06,2.06,2.08,2.07,2.06,2.07,2.06,2.09,2.07,2.09,2.28,2.33,2.35,2.52,2.63,2.58,2.70,2.81,2.97,3.04,3.28,3.33,3.50,3.56,3.57,3.69,3.82,3.79,3.96,4.06,4.05,4.03,3.94,4.02,3.88,4.02,4.03,4.09,3.99,4.01,4.01,4.19,4.30,4.27,3.82,3.15,2.49,1.81,1.26,1.06,0.84,0.78,0.70,0.36,0.35) > x <- c(1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.25,1.25,1.25,1.50,1.50,1.50,1.75,1.75,2.00,2.00,2.25,2.25,2.50,2.50,2.50,2.75,2.75,2.75,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.00,3.25,3.25,3.25,3.25,2.75,2.00,1.00,1.00,0.50,0.25,0.25,0.25,0.25,0.25) > #'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.6832789 0.6841176 0.6849647 0.6858203 0.6866844 0.6875572 0.6884386 [8] 0.6893288 0.6902277 0.6911355 0.6920522 0.6929779 0.6939126 0.6948563 [15] 0.6958092 0.6967712 0.6977425 0.6987231 0.6997130 0.7007122 0.7017209 [22] 0.7027391 0.7037668 0.7048041 0.7058509 0.7069075 0.7079737 0.7090497 [29] 0.7101355 0.7112310 0.7123365 0.7134518 0.7145771 0.7157123 0.7168575 [36] 0.7180127 0.7191780 0.7203534 0.7215388 0.7227344 0.7239401 0.7251560 [43] 0.7263820 0.7276183 0.7288647 0.7301214 0.7313882 0.7326653 0.7339527 [50] 0.7352502 0.7365580 0.7378760 0.7392042 0.7405426 0.7418911 0.7432499 [57] 0.7446188 0.7459979 0.7473870 0.7487862 0.7501955 0.7516147 0.7530440 [64] 0.7544832 0.7559322 0.7573911 0.7588598 0.7603382 0.7618262 0.7633239 [71] 0.7648311 0.7663477 0.7678738 0.7694091 0.7709537 0.7725074 0.7740701 [78] 0.7756418 0.7772223 0.7788116 0.7804095 0.7820159 0.7836307 0.7852538 [85] 0.7868850 0.7885242 0.7901713 0.7918261 0.7934885 0.7951583 0.7968354 [92] 0.7985196 0.8002107 0.8019086 0.8036131 0.8053240 0.8070411 0.8087643 [99] 0.8104932 0.8122278 0.8139679 0.8157131 0.8174633 0.8192183 0.8209778 [106] 0.8227417 0.8245096 0.8262813 0.8280566 0.8298353 0.8316170 0.8334016 [113] 0.8351887 0.8369781 0.8387695 0.8405627 0.8423572 0.8441530 0.8459496 [120] 0.8477468 0.8495443 0.8513418 0.8531389 0.8549354 0.8567310 0.8585253 [127] 0.8603180 0.8621088 0.8638974 0.8656834 0.8674666 0.8692466 0.8710230 [134] 0.8727955 0.8745639 0.8763277 0.8780866 0.8798403 0.8815884 0.8833306 [141] 0.8850666 0.8867960 0.8885184 0.8902336 0.8919412 0.8936408 0.8953322 [148] 0.8970149 0.8986887 0.9003532 0.9020080 0.9036529 0.9052875 0.9069115 [155] 0.9085246 0.9101264 0.9117166 0.9132950 0.9148612 0.9164149 0.9179558 [162] 0.9194837 0.9209981 0.9224990 0.9239858 0.9254585 0.9269166 0.9283601 [169] 0.9297885 0.9312016 0.9325993 0.9339812 0.9353471 0.9366969 0.9380302 [176] 0.9393469 0.9406468 0.9419296 0.9431953 0.9444435 0.9456741 0.9468871 [183] 0.9480821 0.9492591 0.9504179 0.9515583 0.9526804 0.9537838 0.9548686 [190] 0.9559346 0.9569818 0.9580100 0.9590192 0.9600093 0.9609803 0.9619320 [197] 0.9628646 0.9637778 0.9646717 0.9655464 0.9664017 0.9672376 0.9680543 [204] 0.9688516 0.9696297 0.9703885 0.9711280 0.9718484 0.9725497 0.9732319 [211] 0.9738951 0.9745394 0.9751648 0.9757715 0.9763595 0.9769289 0.9774799 [218] 0.9780125 0.9785269 0.9790231 0.9795013 0.9799617 0.9804044 0.9808295 [225] 0.9812372 0.9816275 0.9820008 0.9823571 0.9826966 0.9830194 0.9833258 [232] 0.9836160 0.9838900 0.9841481 0.9843904 0.9846172 0.9848286 0.9850249 [239] 0.9852062 0.9853727 0.9855246 0.9856621 0.9857855 0.9858949 0.9859905 [246] 0.9860725 0.9861412 0.9861967 0.9862392 0.9862690 0.9862863 0.9862913 [253] 0.9862841 0.9862651 0.9862343 0.9861920 0.9861385 0.9860739 0.9859984 [260] 0.9859122 0.9858156 0.9857087 0.9855918 0.9854650 0.9853286 0.9851827 [267] 0.9850275 0.9848633 0.9846903 0.9845085 0.9843183 0.9841198 0.9839132 [274] 0.9836986 0.9834764 0.9832466 0.9830094 0.9827650 0.9825136 0.9822554 [281] 0.9819905 0.9817191 0.9814414 0.9811575 0.9808677 0.9805719 0.9802705 [288] 0.9799636 0.9796513 0.9793338 0.9790112 0.9786837 0.9783514 0.9780145 [295] 0.9776731 0.9773273 0.9769773 0.9766233 0.9762652 0.9759034 0.9755378 [302] 0.9751687 0.9747961 0.9744202 0.9740410 0.9736588 0.9732735 0.9728854 [309] 0.9724945 0.9721009 0.9717048 0.9713062 0.9709052 0.9705020 0.9700966 [316] 0.9696892 0.9692797 0.9688684 0.9684552 0.9680403 0.9676238 0.9672058 [323] 0.9667862 0.9663652 0.9659430 0.9655194 0.9650947 0.9646689 0.9642420 [330] 0.9638142 0.9633855 0.9629559 0.9625255 0.9620944 0.9616627 0.9612303 [337] 0.9607974 0.9603640 0.9599302 0.9594960 0.9590614 0.9586265 0.9581914 [344] 0.9577561 0.9573206 0.9568850 0.9564494 0.9560137 0.9555781 0.9551424 [351] 0.9547069 0.9542715 0.9538363 0.9534012 0.9529664 0.9525318 0.9520975 [358] 0.9516635 0.9512299 0.9507966 0.9503638 0.9499313 0.9494993 0.9490678 [365] 0.9486368 0.9482063 0.9477763 0.9473470 0.9469181 0.9464899 0.9460623 [372] 0.9456354 0.9452091 0.9447835 0.9443585 0.9439343 0.9435108 0.9430880 [379] 0.9426659 0.9422446 0.9418241 0.9414043 0.9409854 0.9405672 0.9401499 [386] 0.9397333 0.9393176 0.9389028 0.9384888 0.9380756 0.9376633 0.9372518 [393] 0.9368413 0.9364316 0.9360227 0.9356148 0.9352078 0.9348016 0.9343964 [400] 0.9339921 0.9335886 > mx [1] 0.9862913 > mxli [1] 0.51 > 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/1p2p01258134027.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/2v9qf1258134027.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/3kctz1258134027.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/4ys4k1258134027.tab") > > system("convert tmp/1p2p01258134027.ps tmp/1p2p01258134027.png") > system("convert tmp/2v9qf1258134027.ps tmp/2v9qf1258134027.png") > system("convert tmp/3kctz1258134027.ps tmp/3kctz1258134027.png") > > > proc.time() user system elapsed 0.791 0.499 0.898