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(123.1,136.6,112.1,95.1,96.3,105.7,115.8,105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.9,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105,109,129.4,148.6,101.4,134.8,143.7,81.6,90.3,141.5,140.7,140.2,100.2,125.7,119.6,134.7,109,116.3,146.9,97.4,89.4,132.1,139.8,129,112.5,121.9,121.7,123.1,131.6,119.3,132.5,98.3,85.1,131.7,129.3,90.7,78.6,68.9,79.1) > x <- c(7.8,8,8.1,8.2,8.3,8.2,8,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8) > #'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.1493276 -0.1493422 -0.1493568 -0.1493714 -0.1493859 -0.1494004 [7] -0.1494148 -0.1494291 -0.1494434 -0.1494576 -0.1494718 -0.1494860 [13] -0.1495000 -0.1495141 -0.1495280 -0.1495420 -0.1495558 -0.1495696 [19] -0.1495834 -0.1495971 -0.1496108 -0.1496244 -0.1496379 -0.1496514 [25] -0.1496648 -0.1496782 -0.1496916 -0.1497049 -0.1497181 -0.1497313 [31] -0.1497444 -0.1497574 -0.1497705 -0.1497834 -0.1497963 -0.1498092 [37] -0.1498220 -0.1498347 -0.1498474 -0.1498601 -0.1498727 -0.1498852 [43] -0.1498977 -0.1499101 -0.1499225 -0.1499348 -0.1499471 -0.1499593 [49] -0.1499715 -0.1499836 -0.1499956 -0.1500076 -0.1500196 -0.1500315 [55] -0.1500433 -0.1500551 -0.1500668 -0.1500785 -0.1500901 -0.1501017 [61] -0.1501132 -0.1501247 -0.1501361 -0.1501475 -0.1501588 -0.1501701 [67] -0.1501813 -0.1501924 -0.1502035 -0.1502145 -0.1502255 -0.1502365 [73] -0.1502474 -0.1502582 -0.1502690 -0.1502797 -0.1502904 -0.1503010 [79] -0.1503115 -0.1503220 -0.1503325 -0.1503429 -0.1503533 -0.1503636 [85] -0.1503738 -0.1503840 -0.1503941 -0.1504042 -0.1504142 -0.1504242 [91] -0.1504341 -0.1504440 -0.1504538 -0.1504636 -0.1504733 -0.1504830 [97] -0.1504926 -0.1505021 -0.1505116 -0.1505211 -0.1505305 -0.1505398 [103] -0.1505491 -0.1505583 -0.1505675 -0.1505766 -0.1505857 -0.1505947 [109] -0.1506037 -0.1506126 -0.1506215 -0.1506303 -0.1506390 -0.1506477 [115] -0.1506564 -0.1506650 -0.1506735 -0.1506820 -0.1506904 -0.1506988 [121] -0.1507071 -0.1507154 -0.1507236 -0.1507318 -0.1507399 -0.1507480 [127] -0.1507560 -0.1507640 -0.1507719 -0.1507797 -0.1507875 -0.1507953 [133] -0.1508030 -0.1508106 -0.1508182 -0.1508257 -0.1508332 -0.1508406 [139] -0.1508480 -0.1508553 -0.1508626 -0.1508698 -0.1508770 -0.1508841 [145] -0.1508912 -0.1508982 -0.1509051 -0.1509120 -0.1509189 -0.1509257 [151] -0.1509324 -0.1509391 -0.1509457 -0.1509523 -0.1509588 -0.1509653 [157] -0.1509717 -0.1509781 -0.1509844 -0.1509907 -0.1509969 -0.1510031 [163] -0.1510092 -0.1510153 -0.1510213 -0.1510272 -0.1510331 -0.1510390 [169] -0.1510448 -0.1510505 -0.1510562 -0.1510618 -0.1510674 -0.1510729 [175] -0.1510784 -0.1510838 -0.1510892 -0.1510945 -0.1510998 -0.1511050 [181] -0.1511102 -0.1511153 -0.1511204 -0.1511254 -0.1511303 -0.1511352 [187] -0.1511401 -0.1511449 -0.1511496 -0.1511543 -0.1511590 -0.1511636 [193] -0.1511681 -0.1511726 -0.1511770 -0.1511814 -0.1511857 -0.1511900 [199] -0.1511942 -0.1511984 -0.1512025 -0.1512066 -0.1512106 -0.1512146 [205] -0.1512185 -0.1512223 -0.1512261 -0.1512299 -0.1512336 -0.1512373 [211] -0.1512409 -0.1512444 -0.1512479 -0.1512514 -0.1512547 -0.1512581 [217] -0.1512614 -0.1512646 -0.1512678 -0.1512709 -0.1512740 -0.1512770 [223] -0.1512800 -0.1512830 -0.1512858 -0.1512887 -0.1512914 -0.1512941 [229] -0.1512968 -0.1512994 -0.1513020 -0.1513045 -0.1513070 -0.1513094 [235] -0.1513118 -0.1513141 -0.1513163 -0.1513185 -0.1513207 -0.1513228 [241] -0.1513248 -0.1513268 -0.1513288 -0.1513307 -0.1513325 -0.1513343 [247] -0.1513361 -0.1513378 -0.1513394 -0.1513410 -0.1513425 -0.1513440 [253] -0.1513455 -0.1513468 -0.1513482 -0.1513495 -0.1513507 -0.1513519 [259] -0.1513530 -0.1513541 -0.1513551 -0.1513561 -0.1513570 -0.1513579 [265] -0.1513587 -0.1513595 -0.1513602 -0.1513609 -0.1513615 -0.1513621 [271] -0.1513626 -0.1513631 -0.1513635 -0.1513639 -0.1513642 -0.1513644 [277] -0.1513647 -0.1513648 -0.1513649 -0.1513650 -0.1513650 -0.1513650 [283] -0.1513649 -0.1513648 -0.1513646 -0.1513643 -0.1513641 -0.1513637 [289] -0.1513633 -0.1513629 -0.1513624 -0.1513619 -0.1513613 -0.1513606 [295] -0.1513599 -0.1513592 -0.1513584 -0.1513576 -0.1513567 -0.1513557 [301] -0.1513548 -0.1513537 -0.1513526 -0.1513515 -0.1513503 -0.1513491 [307] -0.1513478 -0.1513464 -0.1513450 -0.1513436 -0.1513421 -0.1513406 [313] -0.1513390 -0.1513373 -0.1513357 -0.1513339 -0.1513321 -0.1513303 [319] -0.1513284 -0.1513265 -0.1513245 -0.1513225 -0.1513204 -0.1513182 [325] -0.1513161 -0.1513138 -0.1513115 -0.1513092 -0.1513068 -0.1513044 [331] -0.1513019 -0.1512994 -0.1512968 -0.1512942 -0.1512915 -0.1512888 [337] -0.1512860 -0.1512832 -0.1512803 -0.1512774 -0.1512744 -0.1512714 [343] -0.1512683 -0.1512652 -0.1512621 -0.1512589 -0.1512556 -0.1512523 [349] -0.1512489 -0.1512455 -0.1512421 -0.1512385 -0.1512350 -0.1512314 [355] -0.1512277 -0.1512240 -0.1512203 -0.1512165 -0.1512126 -0.1512087 [361] -0.1512048 -0.1512008 -0.1511968 -0.1511927 -0.1511886 -0.1511844 [367] -0.1511801 -0.1511759 -0.1511715 -0.1511671 -0.1511627 -0.1511583 [373] -0.1511537 -0.1511492 -0.1511445 -0.1511399 -0.1511352 -0.1511304 [379] -0.1511256 -0.1511207 -0.1511158 -0.1511109 -0.1511059 -0.1511008 [385] -0.1510957 -0.1510906 -0.1510854 -0.1510802 -0.1510749 -0.1510695 [391] -0.1510642 -0.1510587 -0.1510533 -0.1510477 -0.1510422 -0.1510365 [397] -0.1510309 -0.1510252 -0.1510194 -0.1510136 -0.1510077 > mx [1] 0.1513650 > mxli [1] 0.8 > 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/1fowx1257328915.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/2py4i1257328915.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/3z9hx1257328915.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/422vs1257328915.tab") > > system("convert tmp/1fowx1257328915.ps tmp/1fowx1257328915.png") > system("convert tmp/2py4i1257328915.ps tmp/2py4i1257328915.png") > system("convert tmp/3z9hx1257328915.ps tmp/3z9hx1257328915.png") > > > proc.time() user system elapsed 1.235 0.830 1.401