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(98.2,98.7,113.3,104.6,99.3,111.8,97.3,97.7,115.6,111.9,107.0,107.1,100.6,99.2,108.4,103.0,99.8,115.0,90.8,95.9,114.4,108.2,112.6,109.1,105.0,105.0,118.5,103.7,112.5,116.6,96.6,101.9,116.5,119.3,115.4,108.5,111.5,108.8,121.8,109.6,112.2,119.6,104.1,105.3,115.0,124.1,116.8,107.5,115.6,116.2,116.3,119.0,111.9,118.6,106.9,103.2,118.6,118.7,102.8,100.6) > x <- c(95.1,97.0,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99.0,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102.0,106.0,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100.0,110.7,112.8,109.8,117.3,109.1,115.9,96.0,99.8,116.8,115.7,99.4,94.3) > #'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.9248342 0.9249978 0.9251611 0.9253239 0.9254864 0.9256484 0.9258101 [8] 0.9259714 0.9261323 0.9262928 0.9264529 0.9266126 0.9267719 0.9269308 [15] 0.9270893 0.9272475 0.9274052 0.9275626 0.9277195 0.9278761 0.9280323 [22] 0.9281880 0.9283434 0.9284984 0.9286530 0.9288073 0.9289611 0.9291145 [29] 0.9292675 0.9294202 0.9295725 0.9297243 0.9298758 0.9300269 0.9301776 [36] 0.9303279 0.9304778 0.9306273 0.9307765 0.9309252 0.9310736 0.9312215 [43] 0.9313691 0.9315163 0.9316631 0.9318095 0.9319555 0.9321011 0.9322464 [50] 0.9323912 0.9325357 0.9326797 0.9328234 0.9329667 0.9331096 0.9332521 [57] 0.9333943 0.9335360 0.9336774 0.9338184 0.9339589 0.9340991 0.9342389 [64] 0.9343784 0.9345174 0.9346560 0.9347943 0.9349322 0.9350697 0.9352068 [71] 0.9353435 0.9354798 0.9356158 0.9357514 0.9358865 0.9360213 0.9361557 [78] 0.9362898 0.9364234 0.9365567 0.9366896 0.9368220 0.9369542 0.9370859 [85] 0.9372172 0.9373482 0.9374788 0.9376090 0.9377388 0.9378682 0.9379973 [92] 0.9381259 0.9382542 0.9383821 0.9385097 0.9386368 0.9387636 0.9388900 [99] 0.9390160 0.9391416 0.9392668 0.9393917 0.9395162 0.9396403 0.9397640 [106] 0.9398874 0.9400104 0.9401330 0.9402552 0.9403770 0.9404985 0.9406196 [113] 0.9407403 0.9408606 0.9409806 0.9411002 0.9412194 0.9413382 0.9414567 [120] 0.9415747 0.9416924 0.9418098 0.9419267 0.9420433 0.9421595 0.9422754 [127] 0.9423908 0.9425059 0.9426206 0.9427350 0.9428490 0.9429626 0.9430758 [134] 0.9431886 0.9433011 0.9434133 0.9435250 0.9436364 0.9437474 0.9438580 [141] 0.9439683 0.9440782 0.9441877 0.9442969 0.9444057 0.9445141 0.9446221 [148] 0.9447298 0.9448371 0.9449441 0.9450507 0.9451569 0.9452628 0.9453682 [155] 0.9454734 0.9455781 0.9456825 0.9457865 0.9458902 0.9459935 0.9460964 [162] 0.9461990 0.9463012 0.9464031 0.9465046 0.9466057 0.9467064 0.9468068 [169] 0.9469069 0.9470065 0.9471059 0.9472048 0.9473034 0.9474016 0.9474995 [176] 0.9475970 0.9476942 0.9477910 0.9478874 0.9479835 0.9480792 0.9481746 [183] 0.9482696 0.9483643 0.9484586 0.9485525 0.9486461 0.9487393 0.9488322 [190] 0.9489247 0.9490169 0.9491087 0.9492001 0.9492912 0.9493820 0.9494724 [197] 0.9495624 0.9496521 0.9497415 0.9498305 0.9499191 0.9500074 0.9500953 [204] 0.9501829 0.9502701 0.9503570 0.9504436 0.9505298 0.9506156 0.9507011 [211] 0.9507862 0.9508710 0.9509555 0.9510396 0.9511234 0.9512068 0.9512898 [218] 0.9513726 0.9514549 0.9515370 0.9516186 0.9517000 0.9517810 0.9518616 [225] 0.9519420 0.9520219 0.9521016 0.9521808 0.9522598 0.9523384 0.9524167 [232] 0.9524946 0.9525722 0.9526494 0.9527263 0.9528029 0.9528791 0.9529550 [239] 0.9530305 0.9531057 0.9531806 0.9532552 0.9533294 0.9534032 0.9534768 [246] 0.9535500 0.9536228 0.9536953 0.9537675 0.9538394 0.9539109 0.9539821 [253] 0.9540530 0.9541235 0.9541937 0.9542635 0.9543331 0.9544023 0.9544711 [260] 0.9545397 0.9546079 0.9546757 0.9547433 0.9548105 0.9548774 0.9549440 [267] 0.9550102 0.9550761 0.9551417 0.9552070 0.9552719 0.9553365 0.9554008 [274] 0.9554647 0.9555284 0.9555917 0.9556546 0.9557173 0.9557796 0.9558416 [281] 0.9559033 0.9559647 0.9560257 0.9560865 0.9561469 0.9562070 0.9562667 [288] 0.9563262 0.9563853 0.9564441 0.9565026 0.9565608 0.9566186 0.9566761 [295] 0.9567334 0.9567903 0.9568468 0.9569031 0.9569591 0.9570147 0.9570700 [302] 0.9571250 0.9571797 0.9572341 0.9572882 0.9573419 0.9573954 0.9574485 [309] 0.9575013 0.9575539 0.9576061 0.9576579 0.9577095 0.9577608 0.9578118 [316] 0.9578624 0.9579127 0.9579628 0.9580125 0.9580619 0.9581110 0.9581599 [323] 0.9582084 0.9582565 0.9583044 0.9583520 0.9583993 0.9584463 0.9584930 [330] 0.9585393 0.9585854 0.9586312 0.9586766 0.9587218 0.9587666 0.9588112 [337] 0.9588555 0.9588994 0.9589431 0.9589864 0.9590295 0.9590723 0.9591147 [344] 0.9591569 0.9591988 0.9592403 0.9592816 0.9593226 0.9593633 0.9594036 [351] 0.9594437 0.9594835 0.9595230 0.9595623 0.9596012 0.9596398 0.9596781 [358] 0.9597162 0.9597539 0.9597914 0.9598285 0.9598654 0.9599020 0.9599383 [365] 0.9599743 0.9600100 0.9600454 0.9600806 0.9601154 0.9601500 0.9601843 [372] 0.9602183 0.9602520 0.9602854 0.9603185 0.9603514 0.9603839 0.9604162 [379] 0.9604482 0.9604799 0.9605113 0.9605425 0.9605733 0.9606039 0.9606342 [386] 0.9606642 0.9606940 0.9607234 0.9607526 0.9607815 0.9608101 0.9608385 [393] 0.9608665 0.9608943 0.9609218 0.9609491 0.9609760 0.9610027 0.9610291 [400] 0.9610552 0.9610811 > mx [1] 0.961081 > mxli [1] 2 > 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/1gogg1260369989.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/2kph31260369989.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/3g7if1260369989.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/4pkwg1260369989.tab") > > system("convert tmp/1gogg1260369989.ps tmp/1gogg1260369989.png") > system("convert tmp/2kph31260369989.ps tmp/2kph31260369989.png") > system("convert tmp/3g7if1260369989.ps tmp/3g7if1260369989.png") > > > proc.time() user system elapsed 0.774 0.500 0.947