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(103.34,103.38,103.64,104.04,104.11,104.11,104.11,104.17,105.16,105.86,106.11,106.11,106.11,106.13,106.67,106.85,106.97,107.02,107.02,107.07,107.76,108.10,108.18,108.22,108.22,108.17,108.31,108.31,108.36,108.46,108.46,108.46,109.43,109.55,109.62,109.70,109.70,109.56,109.92,109.81,109.78,109.80,109.80,109.79,110.40,110.95,111.07,111.09,111.10,111.01,111.01,111.35,111.42,111.24,111.24,111.47,111.57,111.96,112.02,112.02) > x <- c(103.63,103.64,103.66,103.77,103.88,103.91,103.91,103.92,104.05,104.23,104.30,104.31,104.31,104.34,104.55,104.65,104.73,104.75,104.75,104.76,104.94,105.29,105.38,105.43,105.43,105.42,105.52,105.69,105.72,105.74,105.74,105.74,105.95,106.17,106.34,106.37,106.37,106.36,106.44,106.29,106.23,106.23,106.23,106.23,106.34,106.44,106.44,106.48,106.50,106.57,106.40,106.37,106.25,106.21,106.21,106.24,106.19,106.08,106.13,106.09) > #'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.9568550 0.9568534 0.9568519 0.9568503 0.9568488 0.9568472 0.9568457 [8] 0.9568441 0.9568425 0.9568410 0.9568394 0.9568379 0.9568363 0.9568348 [15] 0.9568332 0.9568316 0.9568301 0.9568285 0.9568269 0.9568254 0.9568238 [22] 0.9568222 0.9568207 0.9568191 0.9568175 0.9568160 0.9568144 0.9568128 [29] 0.9568112 0.9568097 0.9568081 0.9568065 0.9568049 0.9568033 0.9568018 [36] 0.9568002 0.9567986 0.9567970 0.9567954 0.9567939 0.9567923 0.9567907 [43] 0.9567891 0.9567875 0.9567859 0.9567843 0.9567827 0.9567812 0.9567796 [50] 0.9567780 0.9567764 0.9567748 0.9567732 0.9567716 0.9567700 0.9567684 [57] 0.9567668 0.9567652 0.9567636 0.9567620 0.9567604 0.9567588 0.9567572 [64] 0.9567556 0.9567540 0.9567524 0.9567507 0.9567491 0.9567475 0.9567459 [71] 0.9567443 0.9567427 0.9567411 0.9567395 0.9567378 0.9567362 0.9567346 [78] 0.9567330 0.9567314 0.9567298 0.9567281 0.9567265 0.9567249 0.9567233 [85] 0.9567216 0.9567200 0.9567184 0.9567168 0.9567151 0.9567135 0.9567119 [92] 0.9567102 0.9567086 0.9567070 0.9567053 0.9567037 0.9567021 0.9567004 [99] 0.9566988 0.9566972 0.9566955 0.9566939 0.9566922 0.9566906 0.9566890 [106] 0.9566873 0.9566857 0.9566840 0.9566824 0.9566807 0.9566791 0.9566774 [113] 0.9566758 0.9566741 0.9566725 0.9566708 0.9566692 0.9566675 0.9566659 [120] 0.9566642 0.9566626 0.9566609 0.9566592 0.9566576 0.9566559 0.9566543 [127] 0.9566526 0.9566509 0.9566493 0.9566476 0.9566459 0.9566443 0.9566426 [134] 0.9566409 0.9566393 0.9566376 0.9566359 0.9566343 0.9566326 0.9566309 [141] 0.9566292 0.9566276 0.9566259 0.9566242 0.9566225 0.9566208 0.9566192 [148] 0.9566175 0.9566158 0.9566141 0.9566124 0.9566107 0.9566091 0.9566074 [155] 0.9566057 0.9566040 0.9566023 0.9566006 0.9565989 0.9565972 0.9565955 [162] 0.9565939 0.9565922 0.9565905 0.9565888 0.9565871 0.9565854 0.9565837 [169] 0.9565820 0.9565803 0.9565786 0.9565769 0.9565752 0.9565735 0.9565718 [176] 0.9565700 0.9565683 0.9565666 0.9565649 0.9565632 0.9565615 0.9565598 [183] 0.9565581 0.9565564 0.9565547 0.9565529 0.9565512 0.9565495 0.9565478 [190] 0.9565461 0.9565443 0.9565426 0.9565409 0.9565392 0.9565375 0.9565357 [197] 0.9565340 0.9565323 0.9565306 0.9565288 0.9565271 0.9565254 0.9565236 [204] 0.9565219 0.9565202 0.9565184 0.9565167 0.9565150 0.9565132 0.9565115 [211] 0.9565098 0.9565080 0.9565063 0.9565046 0.9565028 0.9565011 0.9564993 [218] 0.9564976 0.9564958 0.9564941 0.9564923 0.9564906 0.9564889 0.9564871 [225] 0.9564854 0.9564836 0.9564818 0.9564801 0.9564783 0.9564766 0.9564748 [232] 0.9564731 0.9564713 0.9564696 0.9564678 0.9564660 0.9564643 0.9564625 [239] 0.9564608 0.9564590 0.9564572 0.9564555 0.9564537 0.9564519 0.9564502 [246] 0.9564484 0.9564466 0.9564449 0.9564431 0.9564413 0.9564395 0.9564378 [253] 0.9564360 0.9564342 0.9564324 0.9564307 0.9564289 0.9564271 0.9564253 [260] 0.9564235 0.9564218 0.9564200 0.9564182 0.9564164 0.9564146 0.9564128 [267] 0.9564110 0.9564093 0.9564075 0.9564057 0.9564039 0.9564021 0.9564003 [274] 0.9563985 0.9563967 0.9563949 0.9563931 0.9563913 0.9563895 0.9563877 [281] 0.9563859 0.9563841 0.9563823 0.9563805 0.9563787 0.9563769 0.9563751 [288] 0.9563733 0.9563715 0.9563697 0.9563679 0.9563661 0.9563643 0.9563624 [295] 0.9563606 0.9563588 0.9563570 0.9563552 0.9563534 0.9563516 0.9563497 [302] 0.9563479 0.9563461 0.9563443 0.9563425 0.9563406 0.9563388 0.9563370 [309] 0.9563352 0.9563333 0.9563315 0.9563297 0.9563279 0.9563260 0.9563242 [316] 0.9563224 0.9563205 0.9563187 0.9563169 0.9563150 0.9563132 0.9563114 [323] 0.9563095 0.9563077 0.9563059 0.9563040 0.9563022 0.9563003 0.9562985 [330] 0.9562966 0.9562948 0.9562930 0.9562911 0.9562893 0.9562874 0.9562856 [337] 0.9562837 0.9562819 0.9562800 0.9562782 0.9562763 0.9562744 0.9562726 [344] 0.9562707 0.9562689 0.9562670 0.9562652 0.9562633 0.9562614 0.9562596 [351] 0.9562577 0.9562559 0.9562540 0.9562521 0.9562503 0.9562484 0.9562465 [358] 0.9562447 0.9562428 0.9562409 0.9562391 0.9562372 0.9562353 0.9562334 [365] 0.9562316 0.9562297 0.9562278 0.9562259 0.9562241 0.9562222 0.9562203 [372] 0.9562184 0.9562165 0.9562146 0.9562128 0.9562109 0.9562090 0.9562071 [379] 0.9562052 0.9562033 0.9562014 0.9561996 0.9561977 0.9561958 0.9561939 [386] 0.9561920 0.9561901 0.9561882 0.9561863 0.9561844 0.9561825 0.9561806 [393] 0.9561787 0.9561768 0.9561749 0.9561730 0.9561711 0.9561692 0.9561673 [400] 0.9561654 0.9561635 > mx [1] 0.956855 > 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/1pj6v1257372704.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/276pw1257372704.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/38yi61257372704.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/45p0p1257372704.tab") > > system("convert tmp/1pj6v1257372704.ps tmp/1pj6v1257372704.png") > system("convert tmp/276pw1257372704.ps tmp/276pw1257372704.png") > system("convert tmp/38yi61257372704.ps tmp/38yi61257372704.png") > > > proc.time() user system elapsed 0.785 0.500 1.259