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(168802,173276,172957,173558,173820,171663,174110,174338,175440,174922,172188,171330,169560,174579,173740,173427,172952,170305,172717,173019,173690,172439,171914,171968,169500,173898,172308,171568,164939,161275,160770,162466,160185,154836,154103,150495,142707,149962,149967,144572,143819,141070,144119,145330,143279,139063,139202,133632,134476,141859,140693,138047,138346,140167,146796,152228,155410,159032,160312,157687,160141,167421,167628,164403,163405) > x <- c(105.4,104.4,104.9,106.9,107.6,106.5,106,106.5,105.9,104.3,103.8,102.7,103.2,103.5,104.5,103.5,103.8,102.6,102.1,105.1,106.2,106.5,106.3,107.6,107.4,109.2,108.5,107,107.8,109.7,110.6,110.9,111.7,111.2,110.2,112.5,111.6,111.2,112.6,113.1,111.8,106.3,115,114,113.1,114.9,115.5,113.8,114.7,114.2,112.9,112.1,111.1,109.2,106.6,104.1,103.2,91.2,93.6,93.9,93.8,93.8,93.8,94.3,94.5) > #'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.4484262 -0.4486557 -0.4488852 -0.4491147 -0.4493442 -0.4495736 [7] -0.4498031 -0.4500326 -0.4502620 -0.4504914 -0.4507209 -0.4509503 [13] -0.4511797 -0.4514091 -0.4516384 -0.4518678 -0.4520972 -0.4523265 [19] -0.4525558 -0.4527852 -0.4530145 -0.4532438 -0.4534730 -0.4537023 [25] -0.4539316 -0.4541608 -0.4543901 -0.4546193 -0.4548485 -0.4550777 [31] -0.4553068 -0.4555360 -0.4557651 -0.4559943 -0.4562234 -0.4564525 [37] -0.4566816 -0.4569106 -0.4571397 -0.4573687 -0.4575978 -0.4578268 [43] -0.4580558 -0.4582847 -0.4585137 -0.4587426 -0.4589715 -0.4592004 [49] -0.4594293 -0.4596582 -0.4598871 -0.4601159 -0.4603447 -0.4605735 [55] -0.4608023 -0.4610310 -0.4612598 -0.4614885 -0.4617172 -0.4619459 [61] -0.4621745 -0.4624032 -0.4626318 -0.4628604 -0.4630890 -0.4633175 [67] -0.4635461 -0.4637746 -0.4640031 -0.4642315 -0.4644600 -0.4646884 [73] -0.4649168 -0.4651452 -0.4653736 -0.4656019 -0.4658302 -0.4660585 [79] -0.4662868 -0.4665151 -0.4667433 -0.4669715 -0.4671997 -0.4674278 [85] -0.4676559 -0.4678840 -0.4681121 -0.4683402 -0.4685682 -0.4687962 [91] -0.4690242 -0.4692521 -0.4694801 -0.4697080 -0.4699358 -0.4701637 [97] -0.4703915 -0.4706193 -0.4708471 -0.4710748 -0.4713025 -0.4715302 [103] -0.4717579 -0.4719855 -0.4722131 -0.4724407 -0.4726682 -0.4728957 [109] -0.4731232 -0.4733507 -0.4735781 -0.4738055 -0.4740329 -0.4742602 [115] -0.4744875 -0.4747148 -0.4749420 -0.4751693 -0.4753965 -0.4756236 [121] -0.4758507 -0.4760778 -0.4763049 -0.4765319 -0.4767589 -0.4769859 [127] -0.4772128 -0.4774397 -0.4776666 -0.4778935 -0.4781203 -0.4783470 [133] -0.4785738 -0.4788005 -0.4790272 -0.4792538 -0.4794804 -0.4797070 [139] -0.4799335 -0.4801600 -0.4803865 -0.4806129 -0.4808393 -0.4810657 [145] -0.4812920 -0.4815183 -0.4817445 -0.4819708 -0.4821969 -0.4824231 [151] -0.4826492 -0.4828753 -0.4831013 -0.4833273 -0.4835533 -0.4837792 [157] -0.4840051 -0.4842309 -0.4844567 -0.4846825 -0.4849082 -0.4851339 [163] -0.4853596 -0.4855852 -0.4858108 -0.4860363 -0.4862618 -0.4864873 [169] -0.4867127 -0.4869381 -0.4871634 -0.4873887 -0.4876140 -0.4878392 [175] -0.4880644 -0.4882895 -0.4885146 -0.4887397 -0.4889647 -0.4891897 [181] -0.4894146 -0.4896395 -0.4898643 -0.4900891 -0.4903139 -0.4905386 [187] -0.4907633 -0.4909879 -0.4912125 -0.4914370 -0.4916615 -0.4918860 [193] -0.4921104 -0.4923347 -0.4925591 -0.4927833 -0.4930076 -0.4932318 [199] -0.4934559 -0.4936800 -0.4939041 -0.4941281 -0.4943520 -0.4945759 [205] -0.4947998 -0.4950236 -0.4952474 -0.4954711 -0.4956948 -0.4959184 [211] -0.4961420 -0.4963655 -0.4965890 -0.4968125 -0.4970359 -0.4972592 [217] -0.4974825 -0.4977058 -0.4979290 -0.4981521 -0.4983752 -0.4985983 [223] -0.4988213 -0.4990442 -0.4992671 -0.4994900 -0.4997128 -0.4999355 [229] -0.5001582 -0.5003809 -0.5006035 -0.5008260 -0.5010485 -0.5012710 [235] -0.5014934 -0.5017157 -0.5019380 -0.5021602 -0.5023824 -0.5026046 [241] -0.5028266 -0.5030487 -0.5032706 -0.5034926 -0.5037144 -0.5039363 [247] -0.5041580 -0.5043797 -0.5046014 -0.5048230 -0.5050445 -0.5052660 [253] -0.5054875 -0.5057088 -0.5059302 -0.5061514 -0.5063726 -0.5065938 [259] -0.5068149 -0.5070360 -0.5072570 -0.5074779 -0.5076988 -0.5079196 [265] -0.5081404 -0.5083611 -0.5085817 -0.5088023 -0.5090229 -0.5092433 [271] -0.5094638 -0.5096841 -0.5099044 -0.5101247 -0.5103449 -0.5105650 [277] -0.5107851 -0.5110051 -0.5112250 -0.5114449 -0.5116648 -0.5118846 [283] -0.5121043 -0.5123239 -0.5125435 -0.5127631 -0.5129825 -0.5132020 [289] -0.5134213 -0.5136406 -0.5138598 -0.5140790 -0.5142981 -0.5145172 [295] -0.5147362 -0.5149551 -0.5151739 -0.5153927 -0.5156115 -0.5158302 [301] -0.5160488 -0.5162673 -0.5164858 -0.5167042 -0.5169226 -0.5171409 [307] -0.5173591 -0.5175773 -0.5177954 -0.5180134 -0.5182314 -0.5184493 [313] -0.5186672 -0.5188850 -0.5191027 -0.5193203 -0.5195379 -0.5197554 [319] -0.5199729 -0.5201903 -0.5204076 -0.5206249 -0.5208421 -0.5210592 [325] -0.5212762 -0.5214932 -0.5217102 -0.5219270 -0.5221438 -0.5223605 [331] -0.5225772 -0.5227938 -0.5230103 -0.5232267 -0.5234431 -0.5236594 [337] -0.5238757 -0.5240919 -0.5243080 -0.5245240 -0.5247400 -0.5249559 [343] -0.5251717 -0.5253875 -0.5256032 -0.5258188 -0.5260343 -0.5262498 [349] -0.5264652 -0.5266806 -0.5268959 -0.5271111 -0.5273262 -0.5275412 [355] -0.5277562 -0.5279711 -0.5281860 -0.5284008 -0.5286155 -0.5288301 [361] -0.5290446 -0.5292591 -0.5294735 -0.5296879 -0.5299021 -0.5301163 [367] -0.5303304 -0.5305445 -0.5307585 -0.5309724 -0.5311862 -0.5313999 [373] -0.5316136 -0.5318272 -0.5320407 -0.5322542 -0.5324676 -0.5326809 [379] -0.5328941 -0.5331073 -0.5333203 -0.5335333 -0.5337463 -0.5339591 [385] -0.5341719 -0.5343846 -0.5345972 -0.5348098 -0.5350222 -0.5352346 [391] -0.5354469 -0.5356592 -0.5358713 -0.5360834 -0.5362954 -0.5365074 [397] -0.5367192 -0.5369310 -0.5371427 -0.5373543 -0.5375659 > mx [1] 0.5375659 > 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/1tfnb1258034378.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/2fenr1258034378.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/3mblq1258034378.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/4ox2y1258034378.tab") > > system("convert tmp/1tfnb1258034378.ps tmp/1tfnb1258034378.png") > system("convert tmp/2fenr1258034378.ps tmp/2fenr1258034378.png") > system("convert tmp/3mblq1258034378.ps tmp/3mblq1258034378.png") > > > proc.time() user system elapsed 1.215 0.785 1.518