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(117.1,118.7,126.5,127.5,134.6,131.8,135.9,142.7,141.7,153.4,145,137.7,148.3,152.2,169.4,168.6,161.1,174.1,179,190.6,190,181.6,174.8,180.5,196.8,193.8,197,216.3,221.4,217.9,229.7,227.4,204.2,196.6,198.8,207.5,190.7,201.6,210.5,223.5,223.8,231.2,244,234.7,250.2,265.7,287.6,283.3,295.4,312.3,333.8,347.7,383.2,407.1,413.6,362.7,321.9,239.4,191,159.7,163.4) > x <- c(1.4,1.2,1,1.7,2.4,2,2.1,2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5,3.6,4.4,4.1,5.1,5.8,5.9,5.4,5.5,4.8,3.2,2.7,2.1) > #'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.4006304 0.4017948 0.4029632 0.4041356 0.4053121 0.4064924 0.4076768 [8] 0.4088650 0.4100573 0.4112534 0.4124534 0.4136574 0.4148652 0.4160768 [15] 0.4172923 0.4185117 0.4197348 0.4209618 0.4221925 0.4234270 0.4246652 [22] 0.4259071 0.4271528 0.4284021 0.4296551 0.4309117 0.4321719 0.4334358 [29] 0.4347032 0.4359742 0.4372487 0.4385267 0.4398082 0.4410932 0.4423816 [36] 0.4436734 0.4449687 0.4462672 0.4475691 0.4488743 0.4501828 0.4514945 [43] 0.4528095 0.4541277 0.4554490 0.4567734 0.4581010 0.4594316 0.4607653 [50] 0.4621020 0.4634417 0.4647843 0.4661298 0.4674782 0.4688295 0.4701836 [57] 0.4715404 0.4729000 0.4742623 0.4756273 0.4769948 0.4783650 0.4797378 [64] 0.4811130 0.4824908 0.4838710 0.4852535 0.4866385 0.4880257 0.4894153 [71] 0.4908070 0.4922010 0.4935971 0.4949953 0.4963956 0.4977979 0.4992022 [78] 0.5006084 0.5020165 0.5034265 0.5048382 0.5062517 0.5076669 0.5090837 [85] 0.5105022 0.5119222 0.5133437 0.5147667 0.5161910 0.5176168 0.5190438 [92] 0.5204721 0.5219016 0.5233323 0.5247640 0.5261969 0.5276307 0.5290654 [99] 0.5305011 0.5319375 0.5333748 0.5348128 0.5362515 0.5376907 0.5391306 [106] 0.5405709 0.5420117 0.5434529 0.5448944 0.5463362 0.5477783 0.5492204 [113] 0.5506627 0.5521051 0.5535474 0.5549897 0.5564318 0.5578737 0.5593154 [120] 0.5607568 0.5621978 0.5636384 0.5650785 0.5665180 0.5679569 0.5693952 [127] 0.5708327 0.5722695 0.5737053 0.5751403 0.5765743 0.5780072 0.5794391 [134] 0.5808697 0.5822992 0.5837273 0.5851541 0.5865795 0.5880035 0.5894258 [141] 0.5908466 0.5922657 0.5936831 0.5950987 0.5965125 0.5979243 0.5993342 [148] 0.6007420 0.6021477 0.6035513 0.6049526 0.6063517 0.6077484 0.6091427 [155] 0.6105345 0.6119238 0.6133105 0.6146945 0.6160759 0.6174544 0.6188301 [162] 0.6202029 0.6215727 0.6229396 0.6243033 0.6256639 0.6270213 0.6283754 [169] 0.6297263 0.6310737 0.6324177 0.6337582 0.6350952 0.6364285 0.6377582 [176] 0.6390842 0.6404064 0.6417247 0.6430392 0.6443497 0.6456562 0.6469587 [183] 0.6482570 0.6495512 0.6508411 0.6521268 0.6534082 0.6546852 0.6559577 [190] 0.6572258 0.6584894 0.6597484 0.6610027 0.6622524 0.6634973 0.6647375 [197] 0.6659729 0.6672033 0.6684289 0.6696495 0.6708651 0.6720756 0.6732811 [204] 0.6744814 0.6756765 0.6768664 0.6780511 0.6792304 0.6804044 0.6815730 [211] 0.6827361 0.6838938 0.6850460 0.6861926 0.6873337 0.6884691 0.6895989 [218] 0.6907230 0.6918414 0.6929540 0.6940608 0.6951618 0.6962570 0.6973463 [225] 0.6984296 0.6995070 0.7005785 0.7016439 0.7027033 0.7037567 0.7048040 [232] 0.7058451 0.7068801 0.7079090 0.7089317 0.7099482 0.7109585 0.7119625 [239] 0.7129602 0.7139517 0.7149368 0.7159156 0.7168881 0.7178542 0.7188140 [246] 0.7197673 0.7207143 0.7216548 0.7225889 0.7235165 0.7244376 0.7253523 [253] 0.7262605 0.7271622 0.7280574 0.7289461 0.7298283 0.7307039 0.7315730 [260] 0.7324356 0.7332916 0.7341410 0.7349839 0.7358202 0.7366499 0.7374731 [267] 0.7382897 0.7390998 0.7399033 0.7407001 0.7414905 0.7422742 0.7430514 [274] 0.7438220 0.7445861 0.7453436 0.7460945 0.7468389 0.7475767 0.7483080 [281] 0.7490328 0.7497510 0.7504627 0.7511679 0.7518666 0.7525588 0.7532446 [288] 0.7539238 0.7545966 0.7552630 0.7559229 0.7565763 0.7572234 0.7578641 [295] 0.7584983 0.7591262 0.7597478 0.7603630 0.7609719 0.7615744 0.7621707 [302] 0.7627607 0.7633444 0.7639219 0.7644931 0.7650582 0.7656171 0.7661697 [309] 0.7667163 0.7672567 0.7677910 0.7683192 0.7688414 0.7693575 0.7698676 [316] 0.7703717 0.7708698 0.7713619 0.7718481 0.7723284 0.7728028 0.7732714 [323] 0.7737341 0.7741910 0.7746421 0.7750875 0.7755271 0.7759610 0.7763892 [330] 0.7768117 0.7772286 0.7776400 0.7780457 0.7784458 0.7788405 0.7792296 [337] 0.7796133 0.7799915 0.7803643 0.7807317 0.7810938 0.7814505 0.7818019 [344] 0.7821481 0.7824890 0.7828247 0.7831552 0.7834805 0.7838007 0.7841158 [351] 0.7844258 0.7847308 0.7850308 0.7853258 0.7856158 0.7859009 0.7861811 [358] 0.7864565 0.7867270 0.7869928 0.7872537 0.7875099 0.7877614 0.7880083 [365] 0.7882504 0.7884880 0.7887210 0.7889494 0.7891733 0.7893927 0.7896076 [372] 0.7898181 0.7900242 0.7902259 0.7904232 0.7906163 0.7908050 0.7909896 [379] 0.7911699 0.7913460 0.7915179 0.7916857 0.7918494 0.7920091 0.7921647 [386] 0.7923163 0.7924639 0.7926076 0.7927474 0.7928832 0.7930153 0.7931434 [393] 0.7932678 0.7933885 0.7935053 0.7936185 0.7937280 0.7938339 0.7939361 [400] 0.7940347 0.7941298 > mx [1] 0.7941298 > 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/freestat/rcomp/tmp/1ctwc1257955051.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/2zuki1257955051.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/3jlfv1257955051.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/4mndz1257955051.tab") > > system("convert tmp/1ctwc1257955051.ps tmp/1ctwc1257955051.png") > system("convert tmp/2zuki1257955051.ps tmp/2zuki1257955051.png") > system("convert tmp/3jlfv1257955051.ps tmp/3jlfv1257955051.png") > > > proc.time() user system elapsed 1.339 0.930 1.664