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(18.0,19.6,23.3,23.7,20.3,22.8,24.3,21.5,23.5,22.2,20.9,22.2,19.5,21.1,22.0,19.2,17.8,19.2,19.9,19.6,18.1,20.4,18.1,18.6,17.6,19.4,19.3,18.6,16.9,16.4,19.0,18.7,17.1,21.5,17.8,18.1,19.0,18.9,16.8,18.1,15.7,15.1,18.3,16.5,16.9,18.4,16.4,15.7,16.9,16.6,16.7,16.6,14.4,14.5,17.5,14.3,15.4,17.2,14.6,14.2,14.9,14.1,15.6,14.6,11.9,13.5,14.2,13.7,14.4,15.3,14.3,14.5) > x <- c(16.4,17.8,22.3,22.8,18.3,22.4,23.9,21.3,23.0,21.4,21.2,20.9,17.9,20.7,22.2,19.8,17.7,19.6,20.8,19.8,18.6,21.,18.6,18.9,17.3,20.0,19.9,19.5,16.2,17.6,19.8,19.4,17.2,21.1,17.8,17.5,18.0,19.1,17.7,19.2,15.1,16.3,18.6,17.2,17.8,19.1,16.6,16.0,16.7,17.4,17.9,17.8,13.9,15.9,17.9,15.4,16.4,17.9,15.3,14.6,14.9,15.0,16.7,16.3,11.7,15.1,15.5,15.0,15.4,16.0,14.7,14.8) > #'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.9006721 0.9010346 0.9013959 0.9017559 0.9021147 0.9024723 0.9028286 [8] 0.9031836 0.9035374 0.9038900 0.9042413 0.9045914 0.9049403 0.9052879 [15] 0.9056342 0.9059793 0.9063232 0.9066659 0.9070073 0.9073474 0.9076864 [22] 0.9080241 0.9083605 0.9086957 0.9090297 0.9093625 0.9096940 0.9100243 [29] 0.9103533 0.9106811 0.9110077 0.9113331 0.9116572 0.9119801 0.9123018 [36] 0.9126223 0.9129415 0.9132595 0.9135763 0.9138919 0.9142062 0.9145193 [43] 0.9148312 0.9151419 0.9154514 0.9157596 0.9160667 0.9163725 0.9166771 [50] 0.9169805 0.9172826 0.9175836 0.9178834 0.9181819 0.9184793 0.9187754 [57] 0.9190703 0.9193641 0.9196566 0.9199479 0.9202380 0.9205270 0.9208147 [64] 0.9211012 0.9213865 0.9216707 0.9219536 0.9222354 0.9225159 0.9227953 [71] 0.9230735 0.9233505 0.9236263 0.9239009 0.9241743 0.9244466 0.9247177 [78] 0.9249875 0.9252563 0.9255238 0.9257902 0.9260553 0.9263194 0.9265822 [85] 0.9268439 0.9271044 0.9273637 0.9276219 0.9278789 0.9281347 0.9283894 [92] 0.9286429 0.9288953 0.9291465 0.9293965 0.9296454 0.9298931 0.9301397 [99] 0.9303851 0.9306294 0.9308725 0.9311145 0.9313554 0.9315951 0.9318336 [106] 0.9320710 0.9323073 0.9325424 0.9327764 0.9330093 0.9332410 0.9334717 [113] 0.9337011 0.9339295 0.9341567 0.9343828 0.9346078 0.9348316 0.9350543 [120] 0.9352759 0.9354964 0.9357158 0.9359341 0.9361512 0.9363673 0.9365822 [127] 0.9367960 0.9370087 0.9372204 0.9374309 0.9376403 0.9378486 0.9380558 [134] 0.9382619 0.9384669 0.9386709 0.9388737 0.9390755 0.9392761 0.9394757 [141] 0.9396742 0.9398716 0.9400679 0.9402632 0.9404574 0.9406505 0.9408425 [148] 0.9410334 0.9412233 0.9414121 0.9415999 0.9417865 0.9419722 0.9421567 [155] 0.9423402 0.9425226 0.9427040 0.9428843 0.9430636 0.9432418 0.9434190 [162] 0.9435951 0.9437702 0.9439442 0.9441172 0.9442891 0.9444600 0.9446299 [169] 0.9447987 0.9449665 0.9451333 0.9452990 0.9454637 0.9456274 0.9457900 [176] 0.9459517 0.9461123 0.9462718 0.9464304 0.9465880 0.9467445 0.9469000 [183] 0.9470545 0.9472080 0.9473605 0.9475120 0.9476625 0.9478120 0.9479605 [190] 0.9481080 0.9482545 0.9483999 0.9485444 0.9486880 0.9488305 0.9489720 [197] 0.9491126 0.9492521 0.9493907 0.9495283 0.9496649 0.9498006 0.9499352 [204] 0.9500689 0.9502016 0.9503334 0.9504642 0.9505940 0.9507229 0.9508507 [211] 0.9509777 0.9511036 0.9512287 0.9513527 0.9514758 0.9515980 0.9517192 [218] 0.9518394 0.9519588 0.9520771 0.9521945 0.9523110 0.9524266 0.9525412 [225] 0.9526548 0.9527676 0.9528794 0.9529903 0.9531002 0.9532092 0.9533173 [232] 0.9534245 0.9535308 0.9536361 0.9537405 0.9538440 0.9539466 0.9540483 [239] 0.9541490 0.9542489 0.9543478 0.9544459 0.9545430 0.9546392 0.9547346 [246] 0.9548290 0.9549226 0.9550152 0.9551070 0.9551978 0.9552878 0.9553769 [253] 0.9554651 0.9555524 0.9556389 0.9557244 0.9558091 0.9558929 0.9559758 [260] 0.9560579 0.9561391 0.9562194 0.9562988 0.9563774 0.9564551 0.9565320 [267] 0.9566080 0.9566831 0.9567574 0.9568308 0.9569034 0.9569751 0.9570460 [274] 0.9571160 0.9571852 0.9572535 0.9573210 0.9573876 0.9574534 0.9575184 [281] 0.9575825 0.9576458 0.9577083 0.9577699 0.9578307 0.9578907 0.9579499 [288] 0.9580082 0.9580657 0.9581224 0.9581782 0.9582333 0.9582875 0.9583409 [295] 0.9583935 0.9584453 0.9584963 0.9585465 0.9585958 0.9586444 0.9586922 [302] 0.9587391 0.9587853 0.9588307 0.9588752 0.9589190 0.9589620 0.9590042 [309] 0.9590456 0.9590862 0.9591261 0.9591651 0.9592034 0.9592409 0.9592776 [316] 0.9593135 0.9593487 0.9593831 0.9594167 0.9594495 0.9594816 0.9595129 [323] 0.9595435 0.9595733 0.9596023 0.9596305 0.9596580 0.9596848 0.9597108 [330] 0.9597360 0.9597605 0.9597842 0.9598072 0.9598294 0.9598509 0.9598716 [337] 0.9598916 0.9599109 0.9599294 0.9599472 0.9599642 0.9599805 0.9599961 [344] 0.9600110 0.9600251 0.9600385 0.9600511 0.9600631 0.9600743 0.9600848 [351] 0.9600945 0.9601036 0.9601119 0.9601196 0.9601265 0.9601326 0.9601381 [358] 0.9601429 0.9601470 0.9601503 0.9601530 0.9601549 0.9601562 0.9601567 [365] 0.9601566 0.9601557 0.9601542 0.9601519 0.9601490 0.9601454 0.9601411 [372] 0.9601361 0.9601304 0.9601240 0.9601170 0.9601093 0.9601008 0.9600917 [379] 0.9600820 0.9600715 0.9600604 0.9600486 0.9600361 0.9600230 0.9600092 [386] 0.9599947 0.9599796 0.9599638 0.9599473 0.9599302 0.9599124 0.9598940 [393] 0.9598749 0.9598552 0.9598348 0.9598137 0.9597920 0.9597696 0.9597466 [400] 0.9597230 0.9596987 > mx [1] 0.9601567 > mxli [1] 1.63 > 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/1zs311258123483.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/2e25z1258123483.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/3rgi51258123483.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/4xgow1258123483.tab") > > system("convert tmp/1zs311258123483.ps tmp/1zs311258123483.png") > system("convert tmp/2e25z1258123483.ps tmp/2e25z1258123483.png") > system("convert tmp/3rgi51258123483.ps tmp/3rgi51258123483.png") > > > proc.time() user system elapsed 0.797 0.535 0.950