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(95.05,96.84,96.92,97.44,97.78,97.69,96.67,98.29,98.2,98.71,98.54,98.2,96.92,99.06,99.65,99.82,99.99,100.33,99.31,101.1,101.1,100.93,100.85,100.93,99.6,101.88,101.81,102.38,102.74,102.82,101.72,103.47,102.98,102.68,102.9,103.03,101.29,103.69,103.68,104.2,104.08,104.16,103.05,104.66,104.46,104.95,105.85,106.23,104.86,107.44,108.23,108.45,109.39,110.15,109.13,110.28,110.17,109.99,109.26,109.11) > x <- c(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,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.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.7382355 -0.7382889 -0.7383421 -0.7383950 -0.7384477 -0.7385001 [7] -0.7385524 -0.7386044 -0.7386561 -0.7387077 -0.7387589 -0.7388100 [13] -0.7388608 -0.7389114 -0.7389618 -0.7390120 -0.7390619 -0.7391115 [19] -0.7391610 -0.7392102 -0.7392591 -0.7393079 -0.7393564 -0.7394047 [25] -0.7394527 -0.7395005 -0.7395481 -0.7395954 -0.7396426 -0.7396894 [31] -0.7397361 -0.7397825 -0.7398287 -0.7398747 -0.7399204 -0.7399659 [37] -0.7400111 -0.7400562 -0.7401009 -0.7401455 -0.7401898 -0.7402339 [43] -0.7402778 -0.7403214 -0.7403648 -0.7404080 -0.7404509 -0.7404937 [49] -0.7405361 -0.7405784 -0.7406204 -0.7406622 -0.7407037 -0.7407450 [55] -0.7407861 -0.7408270 -0.7408676 -0.7409080 -0.7409481 -0.7409881 [61] -0.7410278 -0.7410672 -0.7411065 -0.7411455 -0.7411842 -0.7412228 [67] -0.7412611 -0.7412992 -0.7413370 -0.7413746 -0.7414120 -0.7414492 [73] -0.7414861 -0.7415228 -0.7415593 -0.7415955 -0.7416315 -0.7416673 [79] -0.7417028 -0.7417381 -0.7417732 -0.7418080 -0.7418426 -0.7418770 [85] -0.7419112 -0.7419451 -0.7419788 -0.7420123 -0.7420455 -0.7420785 [91] -0.7421113 -0.7421438 -0.7421761 -0.7422082 -0.7422401 -0.7422717 [97] -0.7423031 -0.7423342 -0.7423652 -0.7423959 -0.7424264 -0.7424566 [103] -0.7424866 -0.7425164 -0.7425460 -0.7425753 -0.7426044 -0.7426333 [109] -0.7426619 -0.7426903 -0.7427185 -0.7427464 -0.7427742 -0.7428017 [115] -0.7428289 -0.7428560 -0.7428828 -0.7429093 -0.7429357 -0.7429618 [121] -0.7429877 -0.7430134 -0.7430388 -0.7430640 -0.7430890 -0.7431137 [127] -0.7431383 -0.7431626 -0.7431866 -0.7432105 -0.7432341 -0.7432575 [133] -0.7432806 -0.7433035 -0.7433262 -0.7433487 -0.7433710 -0.7433930 [139] -0.7434148 -0.7434363 -0.7434577 -0.7434788 -0.7434997 -0.7435203 [145] -0.7435407 -0.7435609 -0.7435809 -0.7436006 -0.7436202 -0.7436395 [151] -0.7436585 -0.7436774 -0.7436960 -0.7437144 -0.7437325 -0.7437505 [157] -0.7437682 -0.7437856 -0.7438029 -0.7438199 -0.7438367 -0.7438533 [163] -0.7438697 -0.7438858 -0.7439017 -0.7439173 -0.7439328 -0.7439480 [169] -0.7439630 -0.7439778 -0.7439923 -0.7440067 -0.7440208 -0.7440346 [175] -0.7440483 -0.7440617 -0.7440749 -0.7440879 -0.7441006 -0.7441131 [181] -0.7441254 -0.7441375 -0.7441494 -0.7441610 -0.7441724 -0.7441836 [187] -0.7441945 -0.7442053 -0.7442158 -0.7442261 -0.7442361 -0.7442460 [193] -0.7442556 -0.7442650 -0.7442741 -0.7442831 -0.7442918 -0.7443003 [199] -0.7443086 -0.7443166 -0.7443244 -0.7443320 -0.7443394 -0.7443466 [205] -0.7443535 -0.7443603 -0.7443667 -0.7443730 -0.7443791 -0.7443849 [211] -0.7443905 -0.7443959 -0.7444010 -0.7444060 -0.7444107 -0.7444152 [217] -0.7444195 -0.7444235 -0.7444274 -0.7444310 -0.7444344 -0.7444376 [223] -0.7444405 -0.7444432 -0.7444457 -0.7444480 -0.7444501 -0.7444519 [229] -0.7444536 -0.7444550 -0.7444562 -0.7444571 -0.7444579 -0.7444584 [235] -0.7444587 -0.7444588 -0.7444587 -0.7444583 -0.7444578 -0.7444570 [241] -0.7444560 -0.7444547 -0.7444533 -0.7444516 -0.7444497 -0.7444476 [247] -0.7444453 -0.7444428 -0.7444400 -0.7444371 -0.7444339 -0.7444305 [253] -0.7444268 -0.7444230 -0.7444189 -0.7444146 -0.7444101 -0.7444054 [259] -0.7444005 -0.7443953 -0.7443900 -0.7443844 -0.7443786 -0.7443725 [265] -0.7443663 -0.7443599 -0.7443532 -0.7443463 -0.7443392 -0.7443319 [271] -0.7443244 -0.7443166 -0.7443086 -0.7443005 -0.7442921 -0.7442834 [277] -0.7442746 -0.7442656 -0.7442563 -0.7442468 -0.7442371 -0.7442272 [283] -0.7442171 -0.7442068 -0.7441962 -0.7441855 -0.7441745 -0.7441633 [289] -0.7441519 -0.7441403 -0.7441284 -0.7441164 -0.7441041 -0.7440917 [295] -0.7440790 -0.7440661 -0.7440530 -0.7440396 -0.7440261 -0.7440123 [301] -0.7439984 -0.7439842 -0.7439698 -0.7439552 -0.7439404 -0.7439253 [307] -0.7439101 -0.7438946 -0.7438790 -0.7438631 -0.7438470 -0.7438307 [313] -0.7438142 -0.7437975 -0.7437805 -0.7437634 -0.7437460 -0.7437285 [319] -0.7437107 -0.7436927 -0.7436745 -0.7436561 -0.7436375 -0.7436186 [325] -0.7435996 -0.7435803 -0.7435609 -0.7435412 -0.7435213 -0.7435012 [331] -0.7434809 -0.7434604 -0.7434397 -0.7434188 -0.7433976 -0.7433763 [337] -0.7433547 -0.7433330 -0.7433110 -0.7432888 -0.7432664 -0.7432438 [343] -0.7432210 -0.7431980 -0.7431748 -0.7431514 -0.7431277 -0.7431039 [349] -0.7430798 -0.7430556 -0.7430311 -0.7430064 -0.7429816 -0.7429565 [355] -0.7429312 -0.7429057 -0.7428800 -0.7428541 -0.7428280 -0.7428016 [361] -0.7427751 -0.7427484 -0.7427214 -0.7426943 -0.7426669 -0.7426394 [367] -0.7426116 -0.7425836 -0.7425555 -0.7425271 -0.7424985 -0.7424697 [373] -0.7424407 -0.7424115 -0.7423822 -0.7423525 -0.7423227 -0.7422927 [379] -0.7422625 -0.7422321 -0.7422015 -0.7421707 -0.7421396 -0.7421084 [385] -0.7420770 -0.7420453 -0.7420135 -0.7419815 -0.7419492 -0.7419168 [391] -0.7418841 -0.7418513 -0.7418182 -0.7417850 -0.7417515 -0.7417179 [397] -0.7416840 -0.7416499 -0.7416157 -0.7415812 -0.7415466 > mx [1] 0.7444588 > mxli [1] 0.35 > 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/1xhif1258017216.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/2a5701258017216.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/3s06m1258017216.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/4n8mx1258017216.tab") > > system("convert tmp/1xhif1258017216.ps tmp/1xhif1258017216.png") > system("convert tmp/2a5701258017216.ps tmp/2a5701258017216.png") > system("convert tmp/3s06m1258017216.ps tmp/3s06m1258017216.png") > > > proc.time() user system elapsed 0.773 0.502 0.913