R version 2.8.0 (2008-10-20) 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(4.8,4.8,4.7,4.7,4.7,4.6,5.0,5.4,5.5,5.6,5.6,5.8,6.0,6.1,6.1,6.0,6.0,6.1,6.5,7.1,7.4,7.4,7.5,7.6,7.8,7.8,7.7,7.6,7.5,7.3,7.6,8.0,8.8,7.9,7.8,7.7,7.8,7.7,7.5,7.3,7.1,7.0,7.3,7.8,7.9,7.9,7.8,7.8,7.9,7.8,7.6,7.4,7.2,6.9,7.1,7.5,7.6,7.4,7.3,7.2,7.3,7.2,7.1,7.0,6.9,6.8,7.2,7.6,7.7,7.6,7.5,7.5,7.6,7.6,7.6,7.5,7.3,7.2,7.4,8.0,8.2,8.0,7.7,7.7,7.8,7.8,7.7,7.5,7.3,7.1,7.1,7.2,6.8,6.6,6.4,6.4,6.5,6.3,5.9,5.5,5.2,4.9,5.4,5.8,5.7,5.6,5.5,5.4,5.4,5.4,5.5,5.8,5.7,5.4,5.6,5.8,6.2,6.8,6.7,6.7,6.4,6.3,6.3,6.4,6.3,6.0,6.3,6.3,6.6,7.5,7.8,7.9,7.8,7.6,7.5,7.6,7.5,7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8.0,7.5,6.8,6.5,6.6,7.6,8.0,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7.0,7.1) > x <- c(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.0,8.2,8.1,8.1,8.0,7.9,7.9) > #'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.8463305 0.8463366 0.8463422 0.8463473 0.8463518 0.8463558 0.8463592 [8] 0.8463621 0.8463644 0.8463662 0.8463675 0.8463682 0.8463684 0.8463680 [15] 0.8463671 0.8463656 0.8463636 0.8463610 0.8463580 0.8463543 0.8463501 [22] 0.8463454 0.8463401 0.8463343 0.8463280 0.8463211 0.8463136 0.8463057 [29] 0.8462971 0.8462881 0.8462784 0.8462683 0.8462576 0.8462463 0.8462345 [36] 0.8462222 0.8462093 0.8461959 0.8461820 0.8461674 0.8461524 0.8461368 [43] 0.8461207 0.8461040 0.8460868 0.8460690 0.8460507 0.8460318 0.8460124 [50] 0.8459925 0.8459720 0.8459510 0.8459294 0.8459073 0.8458847 0.8458615 [57] 0.8458377 0.8458134 0.8457886 0.8457633 0.8457374 0.8457109 0.8456839 [64] 0.8456564 0.8456283 0.8455997 0.8455706 0.8455409 0.8455106 0.8454799 [71] 0.8454486 0.8454167 0.8453843 0.8453514 0.8453179 0.8452839 0.8452493 [78] 0.8452142 0.8451786 0.8451424 0.8451057 0.8450685 0.8450307 0.8449924 [85] 0.8449535 0.8449141 0.8448742 0.8448337 0.8447927 0.8447512 0.8447091 [92] 0.8446665 0.8446233 0.8445797 0.8445354 0.8444907 0.8444454 0.8443996 [99] 0.8443532 0.8443063 0.8442589 0.8442109 0.8441624 0.8441134 0.8440638 [106] 0.8440138 0.8439631 0.8439120 0.8438603 0.8438081 0.8437553 0.8437020 [113] 0.8436482 0.8435939 0.8435390 0.8434836 0.8434277 0.8433712 0.8433143 [120] 0.8432568 0.8431987 0.8431402 0.8430811 0.8430214 0.8429613 0.8429006 [127] 0.8428394 0.8427777 0.8427155 0.8426527 0.8425894 0.8425256 0.8424613 [134] 0.8423964 0.8423310 0.8422651 0.8421987 0.8421317 0.8420643 0.8419963 [141] 0.8419278 0.8418588 0.8417892 0.8417192 0.8416486 0.8415775 0.8415059 [148] 0.8414337 0.8413611 0.8412879 0.8412142 0.8411400 0.8410653 0.8409901 [155] 0.8409144 0.8408381 0.8407614 0.8406841 0.8406063 0.8405280 0.8404492 [162] 0.8403699 0.8402901 0.8402097 0.8401289 0.8400475 0.8399657 0.8398833 [169] 0.8398005 0.8397171 0.8396332 0.8395488 0.8394639 0.8393785 0.8392926 [176] 0.8392062 0.8391193 0.8390319 0.8389440 0.8388556 0.8387667 0.8386773 [183] 0.8385874 0.8384970 0.8384061 0.8383147 0.8382228 0.8381304 0.8380375 [190] 0.8379441 0.8378502 0.8377559 0.8376610 0.8375656 0.8374698 0.8373735 [197] 0.8372766 0.8371793 0.8370815 0.8369832 0.8368844 0.8367852 0.8366854 [204] 0.8365851 0.8364844 0.8363832 0.8362815 0.8361793 0.8360766 0.8359735 [211] 0.8358699 0.8357657 0.8356611 0.8355561 0.8354505 0.8353445 0.8352380 [218] 0.8351310 0.8350235 0.8349156 0.8348072 0.8346983 0.8345889 0.8344791 [225] 0.8343688 0.8342580 0.8341467 0.8340350 0.8339228 0.8338101 0.8336970 [232] 0.8335834 0.8334694 0.8333548 0.8332398 0.8331244 0.8330084 0.8328921 [239] 0.8327752 0.8326579 0.8325401 0.8324219 0.8323032 0.8321840 0.8320644 [246] 0.8319444 0.8318238 0.8317028 0.8315814 0.8314595 0.8313372 0.8312144 [253] 0.8310911 0.8309674 0.8308433 0.8307187 0.8305936 0.8304681 0.8303422 [260] 0.8302158 0.8300889 0.8299617 0.8298339 0.8297057 0.8295771 0.8294481 [267] 0.8293186 0.8291886 0.8290583 0.8289274 0.8287962 0.8286645 0.8285324 [274] 0.8283998 0.8282668 0.8281333 0.8279995 0.8278652 0.8277304 0.8275953 [281] 0.8274597 0.8273237 0.8271872 0.8270503 0.8269130 0.8267753 0.8266371 [288] 0.8264986 0.8263596 0.8262201 0.8260803 0.8259400 0.8257993 0.8256582 [295] 0.8255167 0.8253747 0.8252324 0.8250896 0.8249464 0.8248028 0.8246588 [302] 0.8245144 0.8243695 0.8242243 0.8240786 0.8239325 0.8237861 0.8236392 [309] 0.8234919 0.8233442 0.8231961 0.8230476 0.8228987 0.8227494 0.8225997 [316] 0.8224495 0.8222990 0.8221481 0.8219968 0.8218451 0.8216930 0.8215405 [323] 0.8213877 0.8212344 0.8210807 0.8209266 0.8207722 0.8206173 0.8204621 [330] 0.8203065 0.8201505 0.8199941 0.8198373 0.8196802 0.8195226 0.8193647 [337] 0.8192064 0.8190477 0.8188887 0.8187292 0.8185694 0.8184092 0.8182486 [344] 0.8180877 0.8179264 0.8177647 0.8176026 0.8174402 0.8172774 0.8171142 [351] 0.8169507 0.8167868 0.8166225 0.8164579 0.8162928 0.8161275 0.8159618 [358] 0.8157957 0.8156292 0.8154624 0.8152952 0.8151277 0.8149598 0.8147916 [365] 0.8146230 0.8144540 0.8142847 0.8141151 0.8139451 0.8137747 0.8136040 [372] 0.8134330 0.8132616 0.8130898 0.8129177 0.8127453 0.8125725 0.8123994 [379] 0.8122259 0.8120521 0.8118780 0.8117035 0.8115287 0.8113535 0.8111780 [386] 0.8110022 0.8108260 0.8106495 0.8104727 0.8102955 0.8101180 0.8099402 [393] 0.8097621 0.8095836 0.8094048 0.8092257 0.8090463 0.8088665 0.8086864 [400] 0.8085060 0.8083252 > mx [1] 0.8463684 > mxli [1] -1.88 > 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/freestat/rcomp/tmp/1w0bd1257796899.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/freestat/rcomp/tmp/2ilof1257796899.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/freestat/rcomp/tmp/3599a1257796899.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4k50t1257796899.tab") > system("convert tmp/1w0bd1257796899.ps tmp/1w0bd1257796899.png") > system("convert tmp/2ilof1257796899.ps tmp/2ilof1257796899.png") > system("convert tmp/3599a1257796899.ps tmp/3599a1257796899.png") > > > proc.time() user system elapsed 1.246 0.819 1.392