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(114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1) > x <- c(8.9,8.2,7.6,7.7,8.1,8.3,8.3,7.9,7.8,8,8.5,8.6,8.5,8,7.8,8,8.2,8.3,8.2,8.1,8,7.8,7.8,7.7,7.6,7.6,7.6,7.8,8,8,7.9,7.7,7.4,6.9,6.7,6.5,6.4,6.7,6.8,6.9,6.9,6.7,6.4,6.2,5.9,6.1,6.7,6.8,6.6,6.4,6.4,6.7,7.1,7.1,6.9,6.4,6,6,6.3,6.6) > #'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.008244483 -0.008261173 -0.008277877 -0.008294598 -0.008311334 [6] -0.008328085 -0.008344853 -0.008361635 -0.008378433 -0.008395247 [11] -0.008412076 -0.008428921 -0.008445781 -0.008462656 -0.008479546 [16] -0.008496452 -0.008513374 -0.008530310 -0.008547262 -0.008564228 [21] -0.008581210 -0.008598208 -0.008615220 -0.008632247 -0.008649290 [26] -0.008666347 -0.008683419 -0.008700507 -0.008717609 -0.008734726 [31] -0.008751859 -0.008769006 -0.008786167 -0.008803344 -0.008820535 [36] -0.008837741 -0.008854962 -0.008872198 -0.008889448 -0.008906713 [41] -0.008923992 -0.008941286 -0.008958594 -0.008975917 -0.008993254 [46] -0.009010606 -0.009027972 -0.009045353 -0.009062748 -0.009080157 [51] -0.009097581 -0.009115019 -0.009132471 -0.009149937 -0.009167417 [56] -0.009184912 -0.009202420 -0.009219943 -0.009237480 -0.009255030 [61] -0.009272595 -0.009290174 -0.009307766 -0.009325373 -0.009342993 [66] -0.009360627 -0.009378275 -0.009395936 -0.009413612 -0.009431301 [71] -0.009449003 -0.009466720 -0.009484450 -0.009502193 -0.009519950 [76] -0.009537720 -0.009555504 -0.009573301 -0.009591112 -0.009608936 [81] -0.009626773 -0.009644624 -0.009662488 -0.009680365 -0.009698255 [86] -0.009716159 -0.009734075 -0.009752005 -0.009769948 -0.009787903 [91] -0.009805872 -0.009823854 -0.009841848 -0.009859856 -0.009877876 [96] -0.009895909 -0.009913955 -0.009932014 -0.009950085 -0.009968169 [101] -0.009986266 -0.010004375 -0.010022497 -0.010040631 -0.010058778 [106] -0.010076937 -0.010095109 -0.010113293 -0.010131489 -0.010149698 [111] -0.010167919 -0.010186152 -0.010204398 -0.010222655 -0.010240925 [116] -0.010259207 -0.010277501 -0.010295807 -0.010314125 -0.010332455 [121] -0.010350796 -0.010369150 -0.010387516 -0.010405893 -0.010424282 [126] -0.010442683 -0.010461095 -0.010479520 -0.010497955 -0.010516403 [131] -0.010534862 -0.010553332 -0.010571814 -0.010590307 -0.010608812 [136] -0.010627328 -0.010645855 -0.010664394 -0.010682944 -0.010701505 [141] -0.010720077 -0.010738660 -0.010757255 -0.010775860 -0.010794477 [146] -0.010813104 -0.010831742 -0.010850392 -0.010869052 -0.010887722 [151] -0.010906404 -0.010925096 -0.010943800 -0.010962513 -0.010981238 [156] -0.010999973 -0.011018718 -0.011037474 -0.011056240 -0.011075017 [161] -0.011093804 -0.011112602 -0.011131409 -0.011150227 -0.011169056 [166] -0.011187894 -0.011206743 -0.011225601 -0.011244470 -0.011263348 [171] -0.011282237 -0.011301136 -0.011320044 -0.011338962 -0.011357890 [176] -0.011376828 -0.011395776 -0.011414733 -0.011433700 -0.011452676 [181] -0.011471662 -0.011490658 -0.011509663 -0.011528677 -0.011547701 [186] -0.011566734 -0.011585776 -0.011604828 -0.011623889 -0.011642959 [191] -0.011662038 -0.011681126 -0.011700223 -0.011719330 -0.011738445 [196] -0.011757569 -0.011776702 -0.011795844 -0.011814994 -0.011834154 [201] -0.011853322 -0.011872498 -0.011891684 -0.011910878 -0.011930080 [206] -0.011949291 -0.011968510 -0.011987738 -0.012006974 -0.012026218 [211] -0.012045471 -0.012064732 -0.012084000 -0.012103278 -0.012122563 [216] -0.012141856 -0.012161157 -0.012180466 -0.012199783 -0.012219108 [221] -0.012238441 -0.012257781 -0.012277130 -0.012296486 -0.012315849 [226] -0.012335220 -0.012354599 -0.012373985 -0.012393378 -0.012412779 [231] -0.012432188 -0.012451603 -0.012471026 -0.012490457 -0.012509894 [236] -0.012529338 -0.012548790 -0.012568248 -0.012587714 -0.012607186 [241] -0.012626666 -0.012646152 -0.012665645 -0.012685145 -0.012704651 [246] -0.012724165 -0.012743684 -0.012763211 -0.012782744 -0.012802283 [251] -0.012821829 -0.012841381 -0.012860939 -0.012880504 -0.012900075 [256] -0.012919653 -0.012939236 -0.012958825 -0.012978421 -0.012998022 [261] -0.013017630 -0.013037243 -0.013056863 -0.013076488 -0.013096118 [266] -0.013115755 -0.013135397 -0.013155045 -0.013174698 -0.013194357 [271] -0.013214022 -0.013233692 -0.013253367 -0.013273047 -0.013292733 [276] -0.013312424 -0.013332120 -0.013351822 -0.013371528 -0.013391239 [281] -0.013410956 -0.013430677 -0.013450403 -0.013470135 -0.013489870 [286] -0.013509611 -0.013529356 -0.013549106 -0.013568861 -0.013588620 [291] -0.013608383 -0.013628151 -0.013647924 -0.013667700 -0.013687481 [296] -0.013707267 -0.013727056 -0.013746850 -0.013766647 -0.013786449 [301] -0.013806255 -0.013826064 -0.013845878 -0.013865695 -0.013885516 [306] -0.013905341 -0.013925170 -0.013945002 -0.013964838 -0.013984677 [311] -0.014004520 -0.014024366 -0.014044215 -0.014064068 -0.014083925 [316] -0.014103784 -0.014123646 -0.014143512 -0.014163381 -0.014183253 [321] -0.014203127 -0.014223005 -0.014242886 -0.014262769 -0.014282655 [326] -0.014302544 -0.014322435 -0.014342329 -0.014362226 -0.014382125 [331] -0.014402026 -0.014421930 -0.014441837 -0.014461745 -0.014481656 [336] -0.014501569 -0.014521484 -0.014541401 -0.014561320 -0.014581242 [341] -0.014601165 -0.014621090 -0.014641016 -0.014660945 -0.014680875 [346] -0.014700807 -0.014720741 -0.014740676 -0.014760612 -0.014780550 [351] -0.014800489 -0.014820430 -0.014840372 -0.014860315 -0.014880260 [356] -0.014900205 -0.014920152 -0.014940099 -0.014960048 -0.014979997 [361] -0.014999948 -0.015019899 -0.015039851 -0.015059803 -0.015079756 [366] -0.015099710 -0.015119664 -0.015139619 -0.015159574 -0.015179530 [371] -0.015199486 -0.015219442 -0.015239398 -0.015259355 -0.015279311 [376] -0.015299268 -0.015319224 -0.015339181 -0.015359137 -0.015379093 [381] -0.015399049 -0.015419005 -0.015438960 -0.015458915 -0.015478869 [386] -0.015498823 -0.015518777 -0.015538729 -0.015558681 -0.015578633 [391] -0.015598583 -0.015618533 -0.015638482 -0.015658430 -0.015678376 [396] -0.015698322 -0.015718267 -0.015738210 -0.015758152 -0.015778093 [401] -0.015798033 > mx [1] 0.01579803 > 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/17wzc1258135156.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/2j83i1258135156.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/328dm1258135156.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/4d7w71258135156.tab") > > system("convert tmp/17wzc1258135156.ps tmp/17wzc1258135156.png") > system("convert tmp/2j83i1258135156.ps tmp/2j83i1258135156.png") > system("convert tmp/328dm1258135156.ps tmp/328dm1258135156.png") > > > proc.time() user system elapsed 0.780 0.523 1.285