R version 2.7.0 (2008-04-22) 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(99.3,98.7,107.9,101.0,97.6,103.0,94.1,94.1,115.1,116.5,103.4,112.5,95.6,97.5,119.3,100.9,97.7,115.3,92.8,99.2,118.7,110.1,110.3,112.9,102.2,99.4,116.1,103.8,101.8,113.7,89.7,99.5,122.9,108.6,114.4,110.5,104.1,103.6,121.6,101.1,116.0,120.1,96.0,105.0,124.7,123.9,123.6,114.8,108.8,106.1,123.2,106.2,115.2,120.6,109.5,114.4,121.4,129.5,124.3,112.6) > x <- c(93.0,99.2,112.2,112.1,103.3,108.2,90.4,72.8,111.0,117.9,111.3,110.5,94.8,100.4,132.1,114.6,101.9,130.2,84.0,86.4,122.3,120.9,110.2,112.6,102.0,105.0,130.5,115.5,103.7,130.9,89.1,93.8,123.8,111.9,118.3,116.9,103.6,116.6,141.3,107.0,125.2,136.4,91.6,95.3,132.3,130.6,131.9,118.6,114.3,111.3,126.5,112.1,119.3,142.4,101.1,97.4,129.1,136.9,129.8,123.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.8056909 0.8060574 0.8064228 0.8067873 0.8071507 0.8075132 0.8078746 [8] 0.8082351 0.8085945 0.8089529 0.8093104 0.8096668 0.8100222 0.8103766 [15] 0.8107300 0.8110823 0.8114337 0.8117840 0.8121334 0.8124817 0.8128290 [22] 0.8131753 0.8135206 0.8138648 0.8142081 0.8145503 0.8148915 0.8152317 [29] 0.8155709 0.8159091 0.8162462 0.8165824 0.8169175 0.8172516 0.8175846 [36] 0.8179167 0.8182477 0.8185777 0.8189067 0.8192347 0.8195616 0.8198875 [43] 0.8202124 0.8205363 0.8208592 0.8211810 0.8215018 0.8218216 0.8221404 [50] 0.8224581 0.8227748 0.8230905 0.8234052 0.8237188 0.8240314 0.8243430 [57] 0.8246536 0.8249631 0.8252716 0.8255791 0.8258856 0.8261910 0.8264954 [64] 0.8267988 0.8271012 0.8274025 0.8277029 0.8280021 0.8283004 0.8285977 [71] 0.8288939 0.8291891 0.8294832 0.8297764 0.8300685 0.8303596 0.8306496 [78] 0.8309387 0.8312267 0.8315137 0.8317996 0.8320846 0.8323685 0.8326514 [85] 0.8329333 0.8332141 0.8334939 0.8337727 0.8340505 0.8343273 0.8346030 [92] 0.8348777 0.8351514 0.8354241 0.8356958 0.8359664 0.8362360 0.8365046 [99] 0.8367721 0.8370387 0.8373042 0.8375687 0.8378322 0.8380947 0.8383562 [106] 0.8386166 0.8388760 0.8391344 0.8393918 0.8396482 0.8399036 0.8401579 [113] 0.8404113 0.8406636 0.8409149 0.8411652 0.8414144 0.8416627 0.8419100 [120] 0.8421562 0.8424015 0.8426457 0.8428889 0.8431311 0.8433723 0.8436125 [127] 0.8438517 0.8440899 0.8443270 0.8445632 0.8447984 0.8450325 0.8452657 [134] 0.8454978 0.8457290 0.8459591 0.8461883 0.8464164 0.8466436 0.8468697 [141] 0.8470949 0.8473190 0.8475422 0.8477643 0.8479855 0.8482057 0.8484248 [148] 0.8486430 0.8488602 0.8490764 0.8492916 0.8495058 0.8497190 0.8499313 [155] 0.8501425 0.8503528 0.8505621 0.8507704 0.8509777 0.8511840 0.8513893 [162] 0.8515937 0.8517971 0.8519995 0.8522009 0.8524013 0.8526008 0.8527992 [169] 0.8529967 0.8531933 0.8533888 0.8535834 0.8537770 0.8539696 0.8541613 [176] 0.8543520 0.8545417 0.8547305 0.8549183 0.8551051 0.8552909 0.8554758 [183] 0.8556597 0.8558427 0.8560247 0.8562058 0.8563858 0.8565650 0.8567431 [190] 0.8569203 0.8570966 0.8572719 0.8574462 0.8576196 0.8577921 0.8579635 [197] 0.8581341 0.8583037 0.8584723 0.8586400 0.8588068 0.8589726 0.8591374 [204] 0.8593013 0.8594643 0.8596264 0.8597875 0.8599476 0.8601068 0.8602651 [211] 0.8604225 0.8605789 0.8607344 0.8608889 0.8610426 0.8611952 0.8613470 [218] 0.8614978 0.8616478 0.8617967 0.8619448 0.8620919 0.8622382 0.8623835 [225] 0.8625278 0.8626713 0.8628138 0.8629555 0.8630962 0.8632360 0.8633749 [232] 0.8635129 0.8636499 0.8637861 0.8639213 0.8640557 0.8641891 0.8643216 [239] 0.8644533 0.8645840 0.8647138 0.8648428 0.8649708 0.8650979 0.8652242 [246] 0.8653495 0.8654740 0.8655975 0.8657202 0.8658420 0.8659629 0.8660829 [253] 0.8662020 0.8663202 0.8664376 0.8665541 0.8666697 0.8667844 0.8668982 [260] 0.8670112 0.8671232 0.8672344 0.8673448 0.8674542 0.8675628 0.8676705 [267] 0.8677774 0.8678834 0.8679885 0.8680928 0.8681962 0.8682987 0.8684004 [274] 0.8685012 0.8686011 0.8687002 0.8687985 0.8688959 0.8689924 0.8690881 [281] 0.8691829 0.8692769 0.8693701 0.8694623 0.8695538 0.8696444 0.8697342 [288] 0.8698231 0.8699112 0.8699984 0.8700848 0.8701704 0.8702552 0.8703391 [295] 0.8704221 0.8705044 0.8705858 0.8706664 0.8707462 0.8708251 0.8709032 [302] 0.8709805 0.8710570 0.8711327 0.8712075 0.8712815 0.8713547 0.8714271 [309] 0.8714987 0.8715695 0.8716394 0.8717086 0.8717769 0.8718445 0.8719112 [316] 0.8719771 0.8720423 0.8721066 0.8721701 0.8722329 0.8722948 0.8723559 [323] 0.8724163 0.8724758 0.8725346 0.8725926 0.8726498 0.8727062 0.8727618 [330] 0.8728166 0.8728707 0.8729240 0.8729765 0.8730282 0.8730791 0.8731293 [337] 0.8731787 0.8732273 0.8732751 0.8733222 0.8733685 0.8734140 0.8734588 [344] 0.8735028 0.8735461 0.8735885 0.8736303 0.8736712 0.8737114 0.8737509 [351] 0.8737896 0.8738275 0.8738647 0.8739012 0.8739369 0.8739718 0.8740060 [358] 0.8740395 0.8740722 0.8741041 0.8741354 0.8741658 0.8741956 0.8742246 [365] 0.8742529 0.8742804 0.8743072 0.8743333 0.8743587 0.8743833 0.8744072 [372] 0.8744304 0.8744528 0.8744745 0.8744955 0.8745158 0.8745354 0.8745542 [379] 0.8745723 0.8745898 0.8746065 0.8746225 0.8746377 0.8746523 0.8746662 [386] 0.8746793 0.8746918 0.8747035 0.8747146 0.8747249 0.8747346 0.8747435 [393] 0.8747518 0.8747594 0.8747662 0.8747724 0.8747779 0.8747827 0.8747868 [400] 0.8747902 0.8747930 > mx [1] 0.874793 > 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/1xepk1228485784.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/22zku1228485784.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/3jq2v1228485784.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/4jvcs1228485785.tab") > > system("convert tmp/1xepk1228485784.ps tmp/1xepk1228485784.png") > system("convert tmp/22zku1228485784.ps tmp/22zku1228485784.png") > system("convert tmp/3jq2v1228485784.ps tmp/3jq2v1228485784.png") > > > proc.time() user system elapsed 1.849 0.802 1.983