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(0.5857,0.5858,0.5717,0.5945,0.5961,0.5973,0.6036,0.6096,0.6315,0.6262,0.6121,0.6326,0.6214,0.6274,0.6175,0.6208,0.6225,0.5889,0.6020,0.5932,0.5841,0.6000,0.5947,0.5891,0.6051,0.5960,0.6012,0.5957,0.5959,0.6049,0.6064,0.6137,0.6311,0.6258,0.6010,0.6232,0.6384,0.6014,0.5980,0.5987,0.6237,0.5813,0.5991,0.6160,0.6096,0.6051,0.5857,0.5565,0.5223,0.5091,0.4919,0.4995,0.5069,0.5190,0.5460,0.5648,0.5751,0.5862,0.5877) > x <- c(0.7461,0.7775,0.7790,0.7744,0.7905,0.7719,0.7811,0.7557,0.7637,0.7595,0.7471,0.7615,0.7487,0.7389,0.7337,0.7510,0.7382,0.7159,0.7542,0.7636,0.7433,0.7658,0.7627,0.7480,0.7692,0.7850,0.7913,0.7720,0.7880,0.8070,0.8268,0.8244,0.8487,0.8572,0.8214,0.8827,0.9216,0.8865,0.8816,0.8884,0.9466,0.9180,0.9337,0.9559,0.9626,0.9434,0.8639,0.7996,0.6680,0.6572,0.6928,0.6438,0.6454,0.6873,0.7265,0.7912,0.8114,0.8281,0.8393) > #'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.6302866 0.6300118 0.6297369 0.6294617 0.6291863 0.6289108 0.6286351 [8] 0.6283591 0.6280830 0.6278067 0.6275302 0.6272535 0.6269767 0.6266996 [15] 0.6264224 0.6261449 0.6258673 0.6255895 0.6253116 0.6250334 0.6247550 [22] 0.6244765 0.6241978 0.6239189 0.6236399 0.6233606 0.6230812 0.6228016 [29] 0.6225218 0.6222419 0.6219617 0.6216814 0.6214010 0.6211203 0.6208395 [36] 0.6205585 0.6202773 0.6199960 0.6197145 0.6194328 0.6191510 0.6188690 [43] 0.6185868 0.6183045 0.6180220 0.6177393 0.6174565 0.6171735 0.6168903 [50] 0.6166070 0.6163235 0.6160399 0.6157561 0.6154721 0.6151880 0.6149037 [57] 0.6146193 0.6143347 0.6140500 0.6137651 0.6134801 0.6131949 0.6129095 [64] 0.6126240 0.6123384 0.6120526 0.6117666 0.6114805 0.6111943 0.6109079 [71] 0.6106214 0.6103347 0.6100478 0.6097609 0.6094738 0.6091865 0.6088991 [78] 0.6086116 0.6083239 0.6080361 0.6077481 0.6074600 0.6071718 0.6068834 [85] 0.6065949 0.6063063 0.6060175 0.6057286 0.6054396 0.6051504 0.6048611 [92] 0.6045717 0.6042821 0.6039924 0.6037026 0.6034127 0.6031226 0.6028324 [99] 0.6025421 0.6022516 0.6019611 0.6016704 0.6013796 0.6010886 0.6007976 [106] 0.6005064 0.6002151 0.5999237 0.5996322 0.5993405 0.5990487 0.5987569 [113] 0.5984649 0.5981728 0.5978806 0.5975882 0.5972958 0.5970032 0.5967106 [120] 0.5964178 0.5961249 0.5958319 0.5955388 0.5952456 0.5949523 0.5946589 [127] 0.5943654 0.5940718 0.5937781 0.5934843 0.5931903 0.5928963 0.5926022 [134] 0.5923080 0.5920137 0.5917193 0.5914248 0.5911302 0.5908355 0.5905407 [141] 0.5902458 0.5899508 0.5896557 0.5893606 0.5890653 0.5887700 0.5884746 [148] 0.5881791 0.5878835 0.5875878 0.5872920 0.5869962 0.5867002 0.5864042 [155] 0.5861081 0.5858119 0.5855156 0.5852193 0.5849229 0.5846264 0.5843298 [162] 0.5840331 0.5837364 0.5834396 0.5831427 0.5828457 0.5825487 0.5822516 [169] 0.5819544 0.5816572 0.5813599 0.5810625 0.5807650 0.5804675 0.5801699 [176] 0.5798723 0.5795746 0.5792768 0.5789789 0.5786810 0.5783831 0.5780850 [183] 0.5777869 0.5774888 0.5771906 0.5768923 0.5765940 0.5762956 0.5759971 [190] 0.5756986 0.5754001 0.5751015 0.5748028 0.5745041 0.5742054 0.5739065 [197] 0.5736077 0.5733088 0.5730098 0.5727108 0.5724117 0.5721126 0.5718135 [204] 0.5715143 0.5712151 0.5709158 0.5706165 0.5703171 0.5700177 0.5697183 [211] 0.5694188 0.5691193 0.5688197 0.5685201 0.5682205 0.5679208 0.5676211 [218] 0.5673214 0.5670216 0.5667218 0.5664219 0.5661221 0.5658222 0.5655223 [225] 0.5652223 0.5649223 0.5646223 0.5643223 0.5640222 0.5637221 0.5634220 [232] 0.5631219 0.5628217 0.5625215 0.5622213 0.5619211 0.5616209 0.5613206 [239] 0.5610203 0.5607200 0.5604197 0.5601194 0.5598190 0.5595187 0.5592183 [246] 0.5589179 0.5586175 0.5583171 0.5580167 0.5577162 0.5574158 0.5571153 [253] 0.5568149 0.5565144 0.5562139 0.5559135 0.5556130 0.5553125 0.5550120 [260] 0.5547115 0.5544110 0.5541105 0.5538100 0.5535095 0.5532090 0.5529085 [267] 0.5526080 0.5523075 0.5520070 0.5517065 0.5514061 0.5511056 0.5508051 [274] 0.5505046 0.5502042 0.5499037 0.5496033 0.5493029 0.5490025 0.5487021 [281] 0.5484017 0.5481013 0.5478009 0.5475006 0.5472002 0.5468999 0.5465996 [288] 0.5462993 0.5459991 0.5456988 0.5453986 0.5450984 0.5447982 0.5444980 [295] 0.5441979 0.5438977 0.5435976 0.5432976 0.5429975 0.5426975 0.5423975 [302] 0.5420975 0.5417976 0.5414977 0.5411978 0.5408979 0.5405981 0.5402983 [309] 0.5399985 0.5396988 0.5393991 0.5390994 0.5387998 0.5385002 0.5382006 [316] 0.5379011 0.5376016 0.5373022 0.5370028 0.5367034 0.5364040 0.5361048 [323] 0.5358055 0.5355063 0.5352071 0.5349080 0.5346089 0.5343099 0.5340109 [330] 0.5337120 0.5334131 0.5331142 0.5328154 0.5325167 0.5322180 0.5319193 [337] 0.5316207 0.5313221 0.5310236 0.5307252 0.5304268 0.5301285 0.5298302 [344] 0.5295319 0.5292338 0.5289356 0.5286376 0.5283396 0.5280416 0.5277437 [351] 0.5274459 0.5271481 0.5268504 0.5265528 0.5262552 0.5259577 0.5256602 [358] 0.5253628 0.5250655 0.5247682 0.5244710 0.5241739 0.5238768 0.5235798 [365] 0.5232829 0.5229860 0.5226892 0.5223925 0.5220959 0.5217993 0.5215028 [372] 0.5212064 0.5209100 0.5206137 0.5203175 0.5200214 0.5197253 0.5194293 [379] 0.5191334 0.5188376 0.5185418 0.5182461 0.5179506 0.5176550 0.5173596 [386] 0.5170642 0.5167690 0.5164738 0.5161787 0.5158837 0.5155887 0.5152939 [393] 0.5149991 0.5147044 0.5144098 0.5141153 0.5138209 0.5135266 0.5132323 [400] 0.5129381 0.5126441 > mx [1] 0.6302866 > 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/148cc1257445725.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/26i321257445725.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/347lj1257445725.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/4s5d81257445725.tab") > > system("convert tmp/148cc1257445725.ps tmp/148cc1257445725.png") > system("convert tmp/26i321257445725.ps tmp/26i321257445725.png") > system("convert tmp/347lj1257445725.ps tmp/347lj1257445725.png") > > > proc.time() user system elapsed 0.772 0.496 1.985