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(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,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.0,8.2,8.1,8.1,8.0,7.9,7.9) > x <- c(4.8,4.8,4.7,4.7,4.7,4.6,5.0,5.4,5.5,5.6,5.6,5.8,6.0,6.1,6.1,6.0,6.0,6.1,6.5,7.1,7.4,7.4,7.5,7.6,7.8,7.8,7.7,7.6,7.5,7.3,7.6,8.0,8.8,7.9,7.8,7.7,7.8,7.7,7.5,7.3,7.1,7.0,7.3,7.8,7.9,7.9,7.8,7.8,7.9,7.8,7.6,7.4,7.2,6.9,7.1,7.5,7.6,7.4,7.3,7.2,7.3,7.2,7.1,7.0,6.9,6.8,7.2,7.6,7.7,7.6,7.5,7.5,7.6,7.6,7.6,7.5,7.3,7.2,7.4,8.0,8.2,8.0,7.7,7.7,7.8,7.8,7.7,7.5,7.3,7.1,7.1,7.2,6.8,6.6,6.4,6.4,6.5,6.3,5.9,5.5,5.2,4.9,5.4,5.8,5.7,5.6,5.5,5.4,5.4,5.4,5.5,5.8,5.7,5.4,5.6,5.8,6.2,6.8,6.7,6.7,6.4,6.3,6.3,6.4,6.3,6.0,6.3,6.3,6.6,7.5,7.8,7.9,7.8,7.6,7.5,7.6,7.5,7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8.0,7.5,6.8,6.5,6.6,7.6,8.0,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7.0,7.1) > #'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.7940920 0.7942854 0.7944783 0.7946705 0.7948621 0.7950531 0.7952436 [8] 0.7954334 0.7956226 0.7958113 0.7959993 0.7961867 0.7963736 0.7965598 [15] 0.7967454 0.7969304 0.7971149 0.7972987 0.7974819 0.7976645 0.7978465 [22] 0.7980279 0.7982087 0.7983889 0.7985685 0.7987475 0.7989258 0.7991036 [29] 0.7992808 0.7994573 0.7996332 0.7998086 0.7999833 0.8001574 0.8003309 [36] 0.8005038 0.8006761 0.8008477 0.8010188 0.8011892 0.8013591 0.8015283 [43] 0.8016969 0.8018649 0.8020322 0.8021990 0.8023652 0.8025307 0.8026956 [50] 0.8028599 0.8030236 0.8031867 0.8033492 0.8035110 0.8036722 0.8038328 [57] 0.8039928 0.8041522 0.8043110 0.8044691 0.8046267 0.8047836 0.8049398 [64] 0.8050955 0.8052506 0.8054050 0.8055588 0.8057120 0.8058646 0.8060166 [71] 0.8061679 0.8063186 0.8064687 0.8066182 0.8067670 0.8069153 0.8070629 [78] 0.8072099 0.8073563 0.8075020 0.8076471 0.8077916 0.8079355 0.8080788 [85] 0.8082214 0.8083635 0.8085049 0.8086456 0.8087858 0.8089253 0.8090642 [92] 0.8092025 0.8093402 0.8094772 0.8096137 0.8097495 0.8098846 0.8100192 [99] 0.8101531 0.8102864 0.8104191 0.8105512 0.8106826 0.8108134 0.8109436 [106] 0.8110732 0.8112021 0.8113305 0.8114582 0.8115852 0.8117117 0.8118375 [113] 0.8119627 0.8120873 0.8122113 0.8123346 0.8124573 0.8125794 0.8127009 [120] 0.8128217 0.8129420 0.8130616 0.8131805 0.8132989 0.8134166 0.8135337 [127] 0.8136502 0.8137661 0.8138813 0.8139960 0.8141100 0.8142233 0.8143361 [134] 0.8144482 0.8145597 0.8146706 0.8147809 0.8148905 0.8149996 0.8151080 [141] 0.8152158 0.8153229 0.8154295 0.8155354 0.8156407 0.8157454 0.8158494 [148] 0.8159529 0.8160557 0.8161579 0.8162595 0.8163604 0.8164608 0.8165605 [155] 0.8166596 0.8167581 0.8168560 0.8169532 0.8170499 0.8171459 0.8172413 [162] 0.8173361 0.8174302 0.8175238 0.8176167 0.8177090 0.8178007 0.8178918 [169] 0.8179823 0.8180721 0.8181614 0.8182500 0.8183380 0.8184254 0.8185122 [176] 0.8185984 0.8186839 0.8187688 0.8188532 0.8189369 0.8190200 0.8191025 [183] 0.8191844 0.8192656 0.8193463 0.8194263 0.8195058 0.8195846 0.8196628 [190] 0.8197404 0.8198174 0.8198938 0.8199696 0.8200447 0.8201193 0.8201932 [197] 0.8202666 0.8203393 0.8204115 0.8204830 0.8205539 0.8206242 0.8206939 [204] 0.8207630 0.8208315 0.8208994 0.8209667 0.8210334 0.8210995 0.8211650 [211] 0.8212298 0.8212941 0.8213578 0.8214209 0.8214833 0.8215452 0.8216065 [218] 0.8216672 0.8217272 0.8217867 0.8218456 0.8219039 0.8219616 0.8220186 [225] 0.8220751 0.8221310 0.8221863 0.8222410 0.8222951 0.8223486 0.8224016 [232] 0.8224539 0.8225056 0.8225568 0.8226073 0.8226573 0.8227066 0.8227554 [239] 0.8228036 0.8228512 0.8228982 0.8229446 0.8229904 0.8230357 0.8230803 [246] 0.8231244 0.8231679 0.8232107 0.8232530 0.8232948 0.8233359 0.8233765 [253] 0.8234164 0.8234558 0.8234946 0.8235328 0.8235705 0.8236075 0.8236440 [260] 0.8236799 0.8237152 0.8237499 0.8237841 0.8238177 0.8238507 0.8238831 [267] 0.8239150 0.8239462 0.8239769 0.8240071 0.8240366 0.8240656 0.8240940 [274] 0.8241218 0.8241491 0.8241758 0.8242019 0.8242274 0.8242524 0.8242768 [281] 0.8243006 0.8243239 0.8243466 0.8243687 0.8243903 0.8244113 0.8244318 [288] 0.8244516 0.8244709 0.8244897 0.8245078 0.8245255 0.8245425 0.8245590 [295] 0.8245749 0.8245903 0.8246051 0.8246194 0.8246331 0.8246462 0.8246588 [302] 0.8246708 0.8246823 0.8246932 0.8247036 0.8247134 0.8247226 0.8247313 [309] 0.8247395 0.8247470 0.8247541 0.8247606 0.8247665 0.8247719 0.8247767 [316] 0.8247810 0.8247848 0.8247880 0.8247906 0.8247927 0.8247943 0.8247953 [323] 0.8247958 0.8247957 0.8247951 0.8247940 0.8247923 0.8247900 0.8247872 [330] 0.8247839 0.8247801 0.8247757 0.8247708 0.8247653 0.8247593 0.8247527 [337] 0.8247457 0.8247381 0.8247299 0.8247213 0.8247120 0.8247023 0.8246920 [344] 0.8246812 0.8246699 0.8246580 0.8246457 0.8246327 0.8246193 0.8246053 [351] 0.8245908 0.8245758 0.8245603 0.8245442 0.8245276 0.8245105 0.8244929 [358] 0.8244747 0.8244560 0.8244368 0.8244171 0.8243969 0.8243761 0.8243549 [365] 0.8243331 0.8243108 0.8242880 0.8242646 0.8242408 0.8242164 0.8241916 [372] 0.8241662 0.8241403 0.8241139 0.8240870 0.8240596 0.8240316 0.8240032 [379] 0.8239742 0.8239448 0.8239148 0.8238844 0.8238534 0.8238219 0.8237900 [386] 0.8237575 0.8237245 0.8236910 0.8236571 0.8236226 0.8235876 0.8235521 [393] 0.8235162 0.8234797 0.8234427 0.8234053 0.8233673 0.8233289 0.8232899 [400] 0.8232505 0.8232106 > mx [1] 0.8247958 > mxli [1] 1.22 > 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/1kn4j1257794285.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/2azmd1257794285.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/3tjnm1257794285.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/46rvn1257794285.tab") > system("convert tmp/1kn4j1257794285.ps tmp/1kn4j1257794285.png") > system("convert tmp/2azmd1257794285.ps tmp/2azmd1257794285.png") > system("convert tmp/3tjnm1257794285.ps tmp/3tjnm1257794285.png") > > > proc.time() user system elapsed 0.793 0.527 1.010