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(100,83,83,83,82,71,82,86,64,66,63,67,41,65,68,90,98,108,92,100,87,91,77,72,59,55,69,71,88,88,97,94,82,75,66,71,83,97,88,89,70) > x <- c(.309,.333,.317,.305,.314,.310,.317,.317,.311,.314,.312,.319,.309,.305,.298,.320,.323,.338,.338,.324,.310,.322,.317,.309,.305,.310,.327,.323,.329,.328,.361,.346,.323,.322,.314,.317,.322,.334,.342,.340,.335) > #'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.5809477 0.5809350 0.5809222 0.5809094 0.5808966 0.5808837 0.5808707 [8] 0.5808577 0.5808447 0.5808315 0.5808184 0.5808052 0.5807919 0.5807786 [15] 0.5807652 0.5807518 0.5807384 0.5807249 0.5807113 0.5806977 0.5806840 [22] 0.5806703 0.5806565 0.5806427 0.5806289 0.5806149 0.5806010 0.5805869 [29] 0.5805729 0.5805587 0.5805446 0.5805303 0.5805161 0.5805017 0.5804874 [36] 0.5804729 0.5804585 0.5804439 0.5804293 0.5804147 0.5804000 0.5803853 [43] 0.5803705 0.5803557 0.5803408 0.5803258 0.5803109 0.5802958 0.5802807 [50] 0.5802656 0.5802504 0.5802351 0.5802198 0.5802045 0.5801891 0.5801737 [57] 0.5801581 0.5801426 0.5801270 0.5801113 0.5800956 0.5800799 0.5800641 [64] 0.5800482 0.5800323 0.5800163 0.5800003 0.5799843 0.5799681 0.5799520 [71] 0.5799357 0.5799195 0.5799032 0.5798868 0.5798704 0.5798539 0.5798374 [78] 0.5798208 0.5798041 0.5797875 0.5797707 0.5797539 0.5797371 0.5797202 [85] 0.5797033 0.5796863 0.5796692 0.5796522 0.5796350 0.5796178 0.5796006 [92] 0.5795833 0.5795659 0.5795485 0.5795310 0.5795135 0.5794960 0.5794784 [99] 0.5794607 0.5794430 0.5794252 0.5794074 0.5793895 0.5793716 0.5793537 [106] 0.5793356 0.5793176 0.5792994 0.5792813 0.5792630 0.5792447 0.5792264 [113] 0.5792080 0.5791896 0.5791711 0.5791526 0.5791340 0.5791153 0.5790966 [120] 0.5790779 0.5790591 0.5790402 0.5790213 0.5790024 0.5789833 0.5789643 [127] 0.5789452 0.5789260 0.5789068 0.5788875 0.5788682 0.5788488 0.5788294 [134] 0.5788099 0.5787904 0.5787708 0.5787512 0.5787315 0.5787118 0.5786920 [141] 0.5786721 0.5786522 0.5786323 0.5786123 0.5785923 0.5785722 0.5785520 [148] 0.5785318 0.5785115 0.5784912 0.5784709 0.5784505 0.5784300 0.5784095 [155] 0.5783889 0.5783683 0.5783476 0.5783269 0.5783061 0.5782853 0.5782644 [162] 0.5782434 0.5782225 0.5782014 0.5781803 0.5781592 0.5781380 0.5781167 [169] 0.5780954 0.5780741 0.5780527 0.5780312 0.5780097 0.5779881 0.5779665 [176] 0.5779448 0.5779231 0.5779013 0.5778795 0.5778576 0.5778357 0.5778137 [183] 0.5777917 0.5777696 0.5777475 0.5777253 0.5777030 0.5776807 0.5776584 [190] 0.5776360 0.5776135 0.5775910 0.5775684 0.5775458 0.5775232 0.5775004 [197] 0.5774777 0.5774549 0.5774320 0.5774090 0.5773861 0.5773630 0.5773399 [204] 0.5773168 0.5772936 0.5772704 0.5772471 0.5772237 0.5772003 0.5771769 [211] 0.5771534 0.5771298 0.5771062 0.5770825 0.5770588 0.5770350 0.5770112 [218] 0.5769873 0.5769634 0.5769394 0.5769154 0.5768913 0.5768671 0.5768429 [225] 0.5768187 0.5767944 0.5767700 0.5767456 0.5767212 0.5766967 0.5766721 [232] 0.5766475 0.5766228 0.5765981 0.5765733 0.5765485 0.5765236 0.5764987 [239] 0.5764737 0.5764487 0.5764236 0.5763984 0.5763732 0.5763480 0.5763227 [246] 0.5762973 0.5762719 0.5762464 0.5762209 0.5761954 0.5761697 0.5761441 [253] 0.5761183 0.5760925 0.5760667 0.5760408 0.5760149 0.5759889 0.5759628 [260] 0.5759367 0.5759106 0.5758844 0.5758581 0.5758318 0.5758055 0.5757790 [267] 0.5757526 0.5757260 0.5756995 0.5756728 0.5756462 0.5756194 0.5755926 [274] 0.5755658 0.5755389 0.5755119 0.5754849 0.5754579 0.5754308 0.5754036 [281] 0.5753764 0.5753491 0.5753218 0.5752944 0.5752670 0.5752395 0.5752120 [288] 0.5751844 0.5751568 0.5751291 0.5751013 0.5750735 0.5750457 0.5750178 [295] 0.5749898 0.5749618 0.5749337 0.5749056 0.5748774 0.5748492 0.5748209 [302] 0.5747926 0.5747642 0.5747358 0.5747073 0.5746787 0.5746501 0.5746215 [309] 0.5745928 0.5745640 0.5745352 0.5745063 0.5744774 0.5744484 0.5744194 [316] 0.5743903 0.5743612 0.5743320 0.5743028 0.5742735 0.5742441 0.5742147 [323] 0.5741853 0.5741558 0.5741262 0.5740966 0.5740669 0.5740372 0.5740074 [330] 0.5739776 0.5739477 0.5739178 0.5738878 0.5738578 0.5738277 0.5737975 [337] 0.5737673 0.5737371 0.5737067 0.5736764 0.5736460 0.5736155 0.5735850 [344] 0.5735544 0.5735238 0.5734931 0.5734623 0.5734316 0.5734007 0.5733698 [351] 0.5733389 0.5733079 0.5732768 0.5732457 0.5732145 0.5731833 0.5731520 [358] 0.5731207 0.5730893 0.5730579 0.5730264 0.5729949 0.5729633 0.5729316 [365] 0.5728999 0.5728682 0.5728364 0.5728045 0.5727726 0.5727406 0.5727086 [372] 0.5726765 0.5726444 0.5726122 0.5725800 0.5725477 0.5725153 0.5724829 [379] 0.5724505 0.5724180 0.5723854 0.5723528 0.5723201 0.5722874 0.5722546 [386] 0.5722218 0.5721889 0.5721560 0.5721230 0.5720900 0.5720569 0.5720237 [393] 0.5719905 0.5719572 0.5719239 0.5718906 0.5718572 0.5718237 0.5717902 [400] 0.5717566 0.5717229 > mx [1] 0.5809477 > 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/190ay1259927882.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/25hyf1259927882.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/3rh6y1259927882.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/4s5zr1259927882.tab") > > system("convert tmp/190ay1259927882.ps tmp/190ay1259927882.png") > system("convert tmp/25hyf1259927882.ps tmp/25hyf1259927882.png") > system("convert tmp/3rh6y1259927882.ps tmp/3rh6y1259927882.png") > > > proc.time() user system elapsed 0.744 0.506 0.903