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(111.4,114.1,121.8,127.6,129.9,128.0,123.5,124.0,127.4,127.6,128.4,131.4,135.1,134.0,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207.0,206.6,210.6,211.1,215.0,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221.0,213.6,243.4,253.8,265.3,268.2,268.5,266.9,268.4,250.8,231.2,192.0) > x <- c(118.4,121.4,128.8,131.7,141.7,142.9,139.4,134.7,125.0,113.6,111.5,108.5,112.3,116.6,115.5,120.1,132.9,128.1,129.3,132.5,131.0,124.9,120.8,122.0,122.1,127.4,135.2,137.3,135.0,136.0,138.4,134.7,138.4,133.9,133.6,141.2,151.8,155.4,156.6,161.6,160.7,156.0,159.5,168.7,169.9,169.9,185.9,190.8,195.8,211.9,227.1,251.3,256.7,251.9,251.2,270.3,267.2,243.0,229.9,187.2) > #'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.8781741 0.8782362 0.8782970 0.8783567 0.8784151 0.8784722 0.8785282 [8] 0.8785829 0.8786364 0.8786886 0.8787397 0.8787894 0.8788380 0.8788852 [15] 0.8789313 0.8789761 0.8790197 0.8790620 0.8791030 0.8791428 0.8791814 [22] 0.8792187 0.8792547 0.8792895 0.8793230 0.8793553 0.8793863 0.8794161 [29] 0.8794446 0.8794718 0.8794977 0.8795224 0.8795458 0.8795680 0.8795889 [36] 0.8796085 0.8796268 0.8796439 0.8796597 0.8796742 0.8796874 0.8796994 [43] 0.8797100 0.8797194 0.8797275 0.8797344 0.8797399 0.8797442 0.8797472 [50] 0.8797489 0.8797493 0.8797484 0.8797462 0.8797428 0.8797380 0.8797320 [57] 0.8797247 0.8797160 0.8797061 0.8796949 0.8796824 0.8796687 0.8796536 [64] 0.8796372 0.8796195 0.8796006 0.8795803 0.8795587 0.8795359 0.8795117 [71] 0.8794863 0.8794596 0.8794315 0.8794022 0.8793715 0.8793396 0.8793064 [78] 0.8792718 0.8792360 0.8791989 0.8791604 0.8791207 0.8790797 0.8790373 [85] 0.8789937 0.8789488 0.8789026 0.8788550 0.8788062 0.8787561 0.8787047 [92] 0.8786520 0.8785979 0.8785426 0.8784860 0.8784281 0.8783689 0.8783084 [99] 0.8782466 0.8781835 0.8781192 0.8780535 0.8779865 0.8779183 0.8778487 [106] 0.8777779 0.8777057 0.8776323 0.8775576 0.8774816 0.8774043 0.8773257 [113] 0.8772458 0.8771647 0.8770822 0.8769985 0.8769135 0.8768272 0.8767396 [120] 0.8766508 0.8765607 0.8764692 0.8763766 0.8762826 0.8761874 0.8760908 [127] 0.8759931 0.8758940 0.8757937 0.8756921 0.8755892 0.8754851 0.8753797 [134] 0.8752730 0.8751651 0.8750559 0.8749455 0.8748338 0.8747208 0.8746066 [141] 0.8744912 0.8743744 0.8742565 0.8741373 0.8740168 0.8738951 0.8737721 [148] 0.8736480 0.8735225 0.8733959 0.8732679 0.8731388 0.8730084 0.8728768 [155] 0.8727440 0.8726099 0.8724746 0.8723381 0.8722004 0.8720615 0.8719213 [162] 0.8717799 0.8716373 0.8714935 0.8713485 0.8712023 0.8710549 0.8709063 [169] 0.8707564 0.8706054 0.8704532 0.8702998 0.8701452 0.8699894 0.8698325 [176] 0.8696743 0.8695150 0.8693545 0.8691928 0.8690300 0.8688660 0.8687008 [183] 0.8685344 0.8683669 0.8681982 0.8680284 0.8678574 0.8676853 0.8675120 [190] 0.8673376 0.8671620 0.8669853 0.8668075 0.8666285 0.8664484 0.8662672 [197] 0.8660848 0.8659013 0.8657167 0.8655310 0.8653442 0.8651563 0.8649672 [204] 0.8647771 0.8645858 0.8643935 0.8642001 0.8640055 0.8638099 0.8636132 [211] 0.8634155 0.8632166 0.8630167 0.8628157 0.8626136 0.8624105 0.8622063 [218] 0.8620010 0.8617947 0.8615874 0.8613790 0.8611695 0.8609590 0.8607475 [225] 0.8605350 0.8603214 0.8601068 0.8598912 0.8596745 0.8594569 0.8592382 [232] 0.8590185 0.8587978 0.8585762 0.8583535 0.8581298 0.8579052 0.8576795 [239] 0.8574529 0.8572253 0.8569967 0.8567672 0.8565367 0.8563052 0.8560728 [246] 0.8558394 0.8556051 0.8553698 0.8551336 0.8548965 0.8546584 0.8544194 [253] 0.8541794 0.8539386 0.8536968 0.8534541 0.8532105 0.8529660 0.8527206 [260] 0.8524743 0.8522271 0.8519790 0.8517300 0.8514802 0.8512294 0.8509778 [267] 0.8507254 0.8504720 0.8502179 0.8499628 0.8497069 0.8494502 0.8491926 [274] 0.8489342 0.8486749 0.8484149 0.8481540 0.8478922 0.8476297 0.8473663 [281] 0.8471022 0.8468372 0.8465715 0.8463049 0.8460376 0.8457694 0.8455005 [288] 0.8452308 0.8449604 0.8446892 0.8444172 0.8441444 0.8438709 0.8435967 [295] 0.8433217 0.8430459 0.8427695 0.8424923 0.8422143 0.8419357 0.8416563 [302] 0.8413762 0.8410954 0.8408139 0.8405317 0.8402489 0.8399653 0.8396810 [309] 0.8393961 0.8391104 0.8388241 0.8385372 0.8382495 0.8379613 0.8376723 [316] 0.8373827 0.8370925 0.8368016 0.8365101 0.8362180 0.8359252 0.8356318 [323] 0.8353378 0.8350432 0.8347479 0.8344521 0.8341557 0.8338587 0.8335610 [330] 0.8332628 0.8329641 0.8326647 0.8323648 0.8320643 0.8317632 0.8314616 [337] 0.8311595 0.8308568 0.8305535 0.8302497 0.8299454 0.8296405 0.8293352 [344] 0.8290293 0.8287228 0.8284159 0.8281085 0.8278006 0.8274921 0.8271832 [351] 0.8268738 0.8265639 0.8262535 0.8259427 0.8256313 0.8253196 0.8250073 [358] 0.8246946 0.8243815 0.8240679 0.8237538 0.8234393 0.8231244 0.8228091 [365] 0.8224933 0.8221771 0.8218605 0.8215435 0.8212261 0.8209083 0.8205901 [372] 0.8202715 0.8199525 0.8196331 0.8193133 0.8189932 0.8186727 0.8183518 [379] 0.8180306 0.8177090 0.8173871 0.8170648 0.8167422 0.8164192 0.8160959 [386] 0.8157722 0.8154483 0.8151240 0.8147994 0.8144745 0.8141492 0.8138237 [393] 0.8134979 0.8131718 0.8128453 0.8125186 0.8121917 0.8118644 0.8115368 [400] 0.8112090 0.8108810 > mx [1] 0.8797493 > mxli [1] -1.5 > 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/1e5q11226568355.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/2pabf1226568355.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/3nr2m1226568355.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/4m2941226568355.tab") > > system("convert tmp/1e5q11226568355.ps tmp/1e5q11226568355.png") > system("convert tmp/2pabf1226568355.ps tmp/2pabf1226568355.png") > system("convert tmp/3nr2m1226568355.ps tmp/3nr2m1226568355.png") > > > proc.time() user system elapsed 1.029 0.527 1.220