R version 2.7.2 (2008-08-25) 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(1.00,1.04,1.02,1.07,1.12,1.08,1.02,1.01,1.04,0.98,0.95,0.94,0.94,0.96,0.97,1.03,1.01,0.99,1.00,1.00,1.02,1.01,0.99,0.98,1.01,1.03,1.03,1.00,0.96,0.97,0.98,1.02,1.04,1.01,1.01,1.00,1.01,1.02,1.03,1.06,1.12,1.12,1.13,1.13,1.13,1.17,1.14,1.08,1.07,1.12,1.14,1.21,1.20,1.23,1.29,1.31,1.37,1.35,1.26,1.26) > x <- c(0.33,0.33,0.32,0.33,0.34,0.36,0.34,0.33,0.35,0.31,0.28,0.26,0.26,0.26,0.29,0.30,0.30,0.28,0.29,0.29,0.32,0.33,0.29,0.31,0.33,0.36,0.39,0.30,0.27,0.28,0.29,0.30,0.30,0.30,0.31,0.30,0.31,0.29,0.32,0.33,0.35,0.35,0.36,0.40,0.40,0.47,0.43,0.38,0.38,0.40,0.45,0.47,0.45,0.50,0.54,0.55,0.59,0.51,0.50,0.50) > #'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.9045853 0.9048915 0.9051970 0.9055019 0.9058061 0.9061096 0.9064125 [8] 0.9067147 0.9070162 0.9073171 0.9076173 0.9079168 0.9082157 0.9085138 [15] 0.9088113 0.9091081 0.9094042 0.9096996 0.9099943 0.9102883 0.9105816 [22] 0.9108742 0.9111662 0.9114574 0.9117479 0.9120377 0.9123267 0.9126151 [29] 0.9129028 0.9131897 0.9134759 0.9137614 0.9140462 0.9143302 0.9146135 [36] 0.9148961 0.9151779 0.9154590 0.9157394 0.9160190 0.9162979 0.9165761 [43] 0.9168535 0.9171301 0.9174060 0.9176811 0.9179555 0.9182291 0.9185020 [50] 0.9187741 0.9190454 0.9193160 0.9195858 0.9198549 0.9201231 0.9203906 [57] 0.9206573 0.9209232 0.9211884 0.9214527 0.9217163 0.9219791 0.9222411 [64] 0.9225023 0.9227627 0.9230224 0.9232812 0.9235392 0.9237964 0.9240528 [71] 0.9243084 0.9245632 0.9248172 0.9250704 0.9253228 0.9255743 0.9258251 [78] 0.9260750 0.9263241 0.9265723 0.9268198 0.9270664 0.9273122 0.9275571 [85] 0.9278013 0.9280445 0.9282870 0.9285286 0.9287694 0.9290093 0.9292484 [92] 0.9294866 0.9297240 0.9299605 0.9301962 0.9304310 0.9306650 0.9308981 [99] 0.9311304 0.9313618 0.9315923 0.9318220 0.9320508 0.9322787 0.9325058 [106] 0.9327320 0.9329573 0.9331817 0.9334053 0.9336280 0.9338498 0.9340707 [113] 0.9342907 0.9345099 0.9347282 0.9349455 0.9351620 0.9353776 0.9355923 [120] 0.9358061 0.9360190 0.9362310 0.9364422 0.9366524 0.9368617 0.9370701 [127] 0.9372776 0.9374841 0.9376898 0.9378946 0.9380984 0.9383014 0.9385034 [134] 0.9387045 0.9389047 0.9391039 0.9393023 0.9394997 0.9396962 0.9398918 [141] 0.9400864 0.9402801 0.9404729 0.9406647 0.9408557 0.9410456 0.9412347 [148] 0.9414228 0.9416100 0.9417962 0.9419815 0.9421658 0.9423492 0.9425317 [155] 0.9427132 0.9428938 0.9430734 0.9432520 0.9434298 0.9436065 0.9437823 [162] 0.9439572 0.9441311 0.9443040 0.9444760 0.9446470 0.9448171 0.9449861 [169] 0.9451543 0.9453214 0.9454876 0.9456529 0.9458171 0.9459804 0.9461428 [176] 0.9463041 0.9464645 0.9466239 0.9467823 0.9469398 0.9470963 0.9472518 [183] 0.9474063 0.9475599 0.9477124 0.9478640 0.9480146 0.9481642 0.9483129 [190] 0.9484605 0.9486072 0.9487529 0.9488975 0.9490412 0.9491840 0.9493257 [197] 0.9494664 0.9496061 0.9497449 0.9498826 0.9500194 0.9501552 0.9502899 [204] 0.9504237 0.9505565 0.9506882 0.9508190 0.9509488 0.9510776 0.9512053 [211] 0.9513321 0.9514579 0.9515826 0.9517064 0.9518292 0.9519509 0.9520717 [218] 0.9521914 0.9523101 0.9524279 0.9525446 0.9526603 0.9527750 0.9528887 [225] 0.9530014 0.9531130 0.9532237 0.9533334 0.9534420 0.9535496 0.9536562 [232] 0.9537618 0.9538664 0.9539700 0.9540725 0.9541741 0.9542746 0.9543741 [239] 0.9544726 0.9545701 0.9546665 0.9547620 0.9548564 0.9549498 0.9550422 [246] 0.9551336 0.9552239 0.9553132 0.9554016 0.9554888 0.9555751 0.9556604 [253] 0.9557446 0.9558278 0.9559100 0.9559912 0.9560713 0.9561505 0.9562286 [260] 0.9563057 0.9563817 0.9564568 0.9565308 0.9566038 0.9566758 0.9567467 [267] 0.9568167 0.9568856 0.9569535 0.9570204 0.9570862 0.9571510 0.9572149 [274] 0.9572776 0.9573394 0.9574001 0.9574599 0.9575186 0.9575762 0.9576329 [281] 0.9576885 0.9577432 0.9577967 0.9578493 0.9579009 0.9579514 0.9580009 [288] 0.9580494 0.9580969 0.9581433 0.9581888 0.9582332 0.9582766 0.9583190 [295] 0.9583603 0.9584007 0.9584400 0.9584783 0.9585156 0.9585518 0.9585871 [302] 0.9586213 0.9586545 0.9586868 0.9587179 0.9587481 0.9587773 0.9588054 [309] 0.9588326 0.9588587 0.9588838 0.9589079 0.9589310 0.9589530 0.9589741 [316] 0.9589942 0.9590132 0.9590312 0.9590483 0.9590643 0.9590793 0.9590933 [323] 0.9591063 0.9591183 0.9591292 0.9591392 0.9591482 0.9591562 0.9591631 [330] 0.9591691 0.9591741 0.9591780 0.9591810 0.9591829 0.9591839 0.9591839 [337] 0.9591828 0.9591808 0.9591778 0.9591737 0.9591687 0.9591627 0.9591557 [344] 0.9591477 0.9591387 0.9591287 0.9591177 0.9591058 0.9590928 0.9590789 [351] 0.9590640 0.9590480 0.9590311 0.9590133 0.9589944 0.9589745 0.9589537 [358] 0.9589319 0.9589091 0.9588853 0.9588606 0.9588348 0.9588081 0.9587805 [365] 0.9587518 0.9587222 0.9586916 0.9586600 0.9586274 0.9585939 0.9585594 [372] 0.9585240 0.9584876 0.9584502 0.9584118 0.9583725 0.9583323 0.9582910 [379] 0.9582488 0.9582057 0.9581616 0.9581165 0.9580705 0.9580235 0.9579755 [386] 0.9579266 0.9578768 0.9578260 0.9577743 0.9577216 0.9576679 0.9576134 [393] 0.9575578 0.9575014 0.9574440 0.9573856 0.9573263 0.9572661 0.9572049 [400] 0.9571428 0.9570798 > mx [1] 0.9591839 > mxli [1] 1.34 > 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/10poq1226412887.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/2tu1f1226412887.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/33mh91226412887.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/4d6gp1226412887.tab") > > system("convert tmp/10poq1226412887.ps tmp/10poq1226412887.png") > system("convert tmp/2tu1f1226412887.ps tmp/2tu1f1226412887.png") > system("convert tmp/33mh91226412887.ps tmp/33mh91226412887.png") > > > proc.time() user system elapsed 1.045 0.516 1.191