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(5.66,5.48,5.29,5.18,4.99,4.92,4.81,4.79,4.75,4.68,4.68,4.73,4.75,4.61,4.76,4.74,4.64,4.65,4.68,4.78,4.78,4.95,4.96,4.71,4.45,4.38,4.32,4.27,4.17,4.07,4.02,3.95,3.90,3.90,3.88,3.89,3.89,3.93,3.94,3.97,4.00,4.04,4.18,4.32,4.37,4.40,4.38,4.36,4.36,4.40,4.41,4.43,4.42,4.46,4.61,4.78,4.88,4.95,4.95,4.93,4.93) > x <- c(111.28,111.41,111.62,111.76,111.89,112.04,112.12,112.30,112.47,112.59,112.78,112.73,112.99,113.10,113.33,113.38,113.68,113.65,113.81,113.88,114.02,114.25,114.28,114.38,114.73,114.97,115.05,115.29,115.37,115.54,115.76,115.92,116.02,116.21,116.26,116.51,104.71,105.35,106.31,106.26,106.97,107.04,106.98,107.05,107.33,107.36,107.28,107.58,109.03,110.43,111.01,111.01,110.76,111.13,111.07,111.09,110.96,110.64,110.62,110.58,111.33) > #'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.13857033 0.13845567 0.13834099 0.13822629 0.13811159 0.13799687 [7] 0.13788214 0.13776739 0.13765264 0.13753787 0.13742308 0.13730829 [13] 0.13719348 0.13707866 0.13696383 0.13684899 0.13673413 0.13661926 [19] 0.13650437 0.13638948 0.13627457 0.13615965 0.13604472 0.13592977 [25] 0.13581481 0.13569984 0.13558486 0.13546987 0.13535486 0.13523984 [31] 0.13512481 0.13500976 0.13489470 0.13477964 0.13466455 0.13454946 [37] 0.13443435 0.13431923 0.13420410 0.13408896 0.13397380 0.13385864 [43] 0.13374346 0.13362826 0.13351306 0.13339784 0.13328261 0.13316737 [49] 0.13305212 0.13293686 0.13282158 0.13270629 0.13259099 0.13247567 [55] 0.13236035 0.13224501 0.13212966 0.13201430 0.13189892 0.13178354 [61] 0.13166814 0.13155273 0.13143731 0.13132188 0.13120643 0.13109097 [67] 0.13097550 0.13086002 0.13074453 0.13062902 0.13051351 0.13039798 [73] 0.13028244 0.13016689 0.13005132 0.12993575 0.12982016 0.12970456 [79] 0.12958895 0.12947332 0.12935769 0.12924204 0.12912639 0.12901072 [85] 0.12889503 0.12877934 0.12866364 0.12854792 0.12843219 0.12831645 [91] 0.12820070 0.12808494 0.12796916 0.12785338 0.12773758 0.12762177 [97] 0.12750595 0.12739012 0.12727428 0.12715842 0.12704256 0.12692668 [103] 0.12681079 0.12669489 0.12657898 0.12646306 0.12634712 0.12623117 [109] 0.12611522 0.12599925 0.12588327 0.12576728 0.12565128 0.12553526 [115] 0.12541924 0.12530320 0.12518715 0.12507110 0.12495503 0.12483894 [121] 0.12472285 0.12460675 0.12449063 0.12437451 0.12425837 0.12414222 [127] 0.12402607 0.12390990 0.12379371 0.12367752 0.12356132 0.12344511 [133] 0.12332888 0.12321264 0.12309640 0.12298014 0.12286387 0.12274759 [139] 0.12263130 0.12251500 0.12239868 0.12228236 0.12216603 0.12204968 [145] 0.12193333 0.12181696 0.12170058 0.12158419 0.12146779 0.12135138 [151] 0.12123496 0.12111853 0.12100209 0.12088563 0.12076917 0.12065270 [157] 0.12053621 0.12041972 0.12030321 0.12018669 0.12007016 0.11995363 [163] 0.11983708 0.11972052 0.11960395 0.11948737 0.11937078 0.11925417 [169] 0.11913756 0.11902094 0.11890431 0.11878766 0.11867101 0.11855434 [175] 0.11843767 0.11832098 0.11820429 0.11808758 0.11797087 0.11785414 [181] 0.11773740 0.11762065 0.11750390 0.11738713 0.11727035 0.11715356 [187] 0.11703676 0.11691995 0.11680313 0.11668630 0.11656946 0.11645261 [193] 0.11633575 0.11621888 0.11610200 0.11598511 0.11586821 0.11575130 [199] 0.11563438 0.11551745 0.11540051 0.11528356 0.11516659 0.11504962 [205] 0.11493264 0.11481565 0.11469865 0.11458164 0.11446462 0.11434759 [211] 0.11423055 0.11411349 0.11399643 0.11387936 0.11376228 0.11364519 [217] 0.11352809 0.11341098 0.11329386 0.11317673 0.11305959 0.11294244 [223] 0.11282528 0.11270812 0.11259094 0.11247375 0.11235655 0.11223934 [229] 0.11212213 0.11200490 0.11188766 0.11177042 0.11165316 0.11153590 [235] 0.11141862 0.11130134 0.11118404 0.11106674 0.11094942 0.11083210 [241] 0.11071477 0.11059743 0.11048008 0.11036272 0.11024535 0.11012797 [247] 0.11001058 0.10989318 0.10977577 0.10965835 0.10954093 0.10942349 [253] 0.10930605 0.10918859 0.10907113 0.10895366 0.10883617 0.10871868 [259] 0.10860118 0.10848367 0.10836615 0.10824862 0.10813109 0.10801354 [265] 0.10789598 0.10777842 0.10766084 0.10754326 0.10742567 0.10730806 [271] 0.10719045 0.10707283 0.10695521 0.10683757 0.10671992 0.10660226 [277] 0.10648460 0.10636693 0.10624924 0.10613155 0.10601385 0.10589614 [283] 0.10577842 0.10566069 0.10554296 0.10542521 0.10530746 0.10518970 [289] 0.10507192 0.10495414 0.10483635 0.10471856 0.10460075 0.10448293 [295] 0.10436511 0.10424728 0.10412943 0.10401158 0.10389372 0.10377586 [301] 0.10365798 0.10354009 0.10342220 0.10330430 0.10318639 0.10306847 [307] 0.10295054 0.10283260 0.10271466 0.10259670 0.10247874 0.10236077 [313] 0.10224279 0.10212480 0.10200681 0.10188880 0.10177079 0.10165277 [319] 0.10153474 0.10141670 0.10129865 0.10118060 0.10106253 0.10094446 [325] 0.10082638 0.10070829 0.10059020 0.10047209 0.10035398 0.10023586 [331] 0.10011773 0.09999959 0.09988145 0.09976329 0.09964513 0.09952696 [337] 0.09940878 0.09929059 0.09917240 0.09905419 0.09893598 0.09881776 [343] 0.09869954 0.09858130 0.09846306 0.09834481 0.09822655 0.09810828 [349] 0.09799001 0.09787172 0.09775343 0.09763513 0.09751683 0.09739851 [355] 0.09728019 0.09716186 0.09704352 0.09692517 0.09680682 0.09668846 [361] 0.09657009 0.09645171 0.09633333 0.09621493 0.09609653 0.09597812 [367] 0.09585971 0.09574128 0.09562285 0.09550441 0.09538597 0.09526751 [373] 0.09514905 0.09503058 0.09491210 0.09479362 0.09467512 0.09455662 [379] 0.09443812 0.09431960 0.09420108 0.09408255 0.09396401 0.09384547 [385] 0.09372691 0.09360835 0.09348979 0.09337121 0.09325263 0.09313404 [391] 0.09301544 0.09289684 0.09277823 0.09265961 0.09254098 0.09242235 [397] 0.09230371 0.09218506 0.09206640 0.09194774 0.09182907 > mx [1] 0.1385703 > 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/1vgl91258135734.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/260kt1258135734.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/316ck1258135734.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/4k8r11258135734.tab") > > system("convert tmp/1vgl91258135734.ps tmp/1vgl91258135734.png") > system("convert tmp/260kt1258135734.ps tmp/260kt1258135734.png") > system("convert tmp/316ck1258135734.ps tmp/316ck1258135734.png") > > > proc.time() user system elapsed 0.807 0.512 0.977