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(7.5,8,7.9,7.8,7.7,7.6,7.4,7.2,7.3,7.4,7.5,7.6,8,8.3,8.3,8.2,7.8,8,8,7.9,7.4,7.5,7.4,7.3,7.5,7.5,7.5,7.1,6.8,6.9,6.6,6.7,6.5,6.6,6.5,6.5,6.7,6.8,6.1,5.8,5.8,6.1,5.6,5.4,5.1,5.2,5,5.2,5.4,5.5,5.1,4.8,5,4.9,4.6,4.3,4.3,4.4,4.4,4.5) > x <- c(5.7,6.1,6,5.9,5.8,5.7,5.6,5.4,5.4,5.5,5.6,5.7,5.9,6.1,6,5.8,5.8,5.7,5.5,5.3,5.2,5.2,5,5.1,5.1,5.2,4.9,4.8,4.5,4.5,4.4,4.4,4.2,4.1,3.9,3.8,3.9,4.2,4.1,3.8,3.6,3.7,3.5,3.4,3.1,3.1,3.1,3.2,3.3,3.5,3.6,3.5,3.3,3.2,3.1,3.2,3,3,3.1,3.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.9691524 0.9691973 0.9692416 0.9692852 0.9693282 0.9693706 0.9694123 [8] 0.9694534 0.9694939 0.9695338 0.9695730 0.9696116 0.9696496 0.9696870 [15] 0.9697237 0.9697598 0.9697952 0.9698300 0.9698642 0.9698977 0.9699307 [22] 0.9699629 0.9699946 0.9700255 0.9700559 0.9700856 0.9701147 0.9701431 [29] 0.9701709 0.9701981 0.9702246 0.9702504 0.9702757 0.9703002 0.9703242 [36] 0.9703474 0.9703701 0.9703921 0.9704134 0.9704341 0.9704542 0.9704736 [43] 0.9704923 0.9705104 0.9705278 0.9705446 0.9705608 0.9705763 0.9705911 [50] 0.9706053 0.9706188 0.9706317 0.9706439 0.9706555 0.9706664 0.9706767 [57] 0.9706863 0.9706952 0.9707035 0.9707112 0.9707181 0.9707244 0.9707301 [64] 0.9707351 0.9707394 0.9707431 0.9707461 0.9707485 0.9707502 0.9707512 [71] 0.9707516 0.9707513 0.9707504 0.9707488 0.9707465 0.9707435 0.9707399 [78] 0.9707357 0.9707308 0.9707252 0.9707189 0.9707120 0.9707044 0.9706962 [85] 0.9706872 0.9706777 0.9706674 0.9706565 0.9706449 0.9706327 0.9706198 [92] 0.9706062 0.9705920 0.9705771 0.9705615 0.9705453 0.9705283 0.9705108 [99] 0.9704925 0.9704736 0.9704540 0.9704338 0.9704129 0.9703913 0.9703691 [106] 0.9703462 0.9703226 0.9702983 0.9702734 0.9702478 0.9702216 0.9701947 [113] 0.9701671 0.9701388 0.9701099 0.9700803 0.9700501 0.9700191 0.9699875 [120] 0.9699553 0.9699224 0.9698888 0.9698545 0.9698196 0.9697840 0.9697477 [127] 0.9697108 0.9696732 0.9696349 0.9695960 0.9695564 0.9695162 0.9694752 [134] 0.9694336 0.9693914 0.9693485 0.9693049 0.9692606 0.9692157 0.9691701 [141] 0.9691239 0.9690770 0.9690294 0.9689812 0.9689323 0.9688827 0.9688325 [148] 0.9687816 0.9687301 0.9686779 0.9686250 0.9685715 0.9685173 0.9684625 [155] 0.9684070 0.9683508 0.9682940 0.9682365 0.9681783 0.9681195 0.9680601 [162] 0.9680000 0.9679392 0.9678778 0.9678157 0.9677529 0.9676896 0.9676255 [169] 0.9675608 0.9674954 0.9674294 0.9673628 0.9672955 0.9672275 0.9671589 [176] 0.9670896 0.9670197 0.9669491 0.9668779 0.9668061 0.9667335 0.9666604 [183] 0.9665866 0.9665121 0.9664370 0.9663613 0.9662849 0.9662079 0.9661302 [190] 0.9660519 0.9659729 0.9658933 0.9658131 0.9657322 0.9656507 0.9655685 [197] 0.9654857 0.9654023 0.9653182 0.9652335 0.9651482 0.9650622 0.9649756 [204] 0.9648884 0.9648005 0.9647120 0.9646228 0.9645331 0.9644427 0.9643517 [211] 0.9642600 0.9641677 0.9640748 0.9639813 0.9638871 0.9637923 0.9636969 [218] 0.9636009 0.9635043 0.9634070 0.9633091 0.9632106 0.9631115 0.9630117 [225] 0.9629114 0.9628104 0.9627088 0.9626066 0.9625038 0.9624004 0.9622964 [232] 0.9621917 0.9620865 0.9619806 0.9618741 0.9617670 0.9616594 0.9615511 [239] 0.9614422 0.9613327 0.9612226 0.9611119 0.9610006 0.9608887 0.9607762 [246] 0.9606631 0.9605494 0.9604352 0.9603203 0.9602048 0.9600888 0.9599721 [253] 0.9598549 0.9597371 0.9596187 0.9594997 0.9593801 0.9592599 0.9591392 [260] 0.9590178 0.9588959 0.9587734 0.9586504 0.9585267 0.9584025 0.9582777 [267] 0.9581523 0.9580264 0.9578998 0.9577727 0.9576451 0.9575169 0.9573881 [274] 0.9572587 0.9571288 0.9569983 0.9568672 0.9567356 0.9566034 0.9564707 [281] 0.9563374 0.9562035 0.9560691 0.9559342 0.9557987 0.9556626 0.9555260 [288] 0.9553888 0.9552511 0.9551128 0.9549740 0.9548347 0.9546948 0.9545543 [295] 0.9544133 0.9542718 0.9541298 0.9539872 0.9538440 0.9537004 0.9535562 [302] 0.9534114 0.9532662 0.9531204 0.9529741 0.9528272 0.9526799 0.9525320 [309] 0.9523835 0.9522346 0.9520851 0.9519352 0.9517847 0.9516336 0.9514821 [316] 0.9513301 0.9511775 0.9510245 0.9508709 0.9507168 0.9505622 0.9504071 [323] 0.9502515 0.9500954 0.9499388 0.9497817 0.9496241 0.9494660 0.9493074 [330] 0.9491483 0.9489887 0.9488287 0.9486681 0.9485070 0.9483455 0.9481835 [337] 0.9480210 0.9478580 0.9476945 0.9475305 0.9473661 0.9472012 0.9470358 [344] 0.9468699 0.9467036 0.9465368 0.9463695 0.9462017 0.9460335 0.9458648 [351] 0.9456957 0.9455261 0.9453560 0.9451854 0.9450145 0.9448430 0.9446711 [358] 0.9444987 0.9443259 0.9441526 0.9439789 0.9438048 0.9436301 0.9434551 [365] 0.9432796 0.9431036 0.9429272 0.9427504 0.9425732 0.9423954 0.9422173 [372] 0.9420387 0.9418597 0.9416803 0.9415004 0.9413201 0.9411394 0.9409583 [379] 0.9407767 0.9405947 0.9404123 0.9402295 0.9400462 0.9398625 0.9396785 [386] 0.9394940 0.9393091 0.9391238 0.9389380 0.9387519 0.9385654 0.9383784 [393] 0.9381911 0.9380033 0.9378152 0.9376266 0.9374377 0.9372484 0.9370586 [400] 0.9368685 0.9366780 > mx [1] 0.9707516 > 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/html/rcomp/tmp/1ig531257772850.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/22w4z1257772850.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/3m9061257772850.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/4tp5f1257772850.tab") > > system("convert tmp/1ig531257772850.ps tmp/1ig531257772850.png") > system("convert tmp/22w4z1257772850.ps tmp/22w4z1257772850.png") > system("convert tmp/3m9061257772850.ps tmp/3m9061257772850.png") > > > proc.time() user system elapsed 0.784 0.509 0.946