R version 2.7.2 (2008-08-25) 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(3277.2,3833,2606.3,3643.8,3686.4,3281.6,3669.3,3191.5,3512.7,3970.7,3601.2,3610,4172.1,3956.2,3142.7,3884.3,3892.2,3613,3730.5,3481.3,3649.5,4215.2,4066.6,4196.8,4536.6,4441.6,3548.3,4735.9,4130.6,4356.2,4159.6,3988,4167.8,4902.2,3909.4,4697.6,4308.9,4420.4,3544.2,4433,4479.7,4533.2,4237.5,4207.4,4394,5148.4,4202.2,4682.5,4884.3,5288.9,4505.2,4611.5,5081.1,4523.1,4412.8,4647.4,4778.6,4495.3,4633.5,4360.5,4517.9) > x <- c(12192.5,11268.8,9097.4,12639.8,13040.1,11687.3,11191.7,11391.9,11793.1,13933.2,12778.1,11810.3,13698.4,11956.6,10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17157.3,16159.1,13405.7,17224.7,17338.4,17370.6,18817.8,16593.2,17979.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.8141572 0.8142381 0.8143177 0.8143961 0.8144733 0.8145492 0.8146239 [8] 0.8146973 0.8147695 0.8148405 0.8149102 0.8149787 0.8150459 0.8151119 [15] 0.8151766 0.8152402 0.8153024 0.8153635 0.8154233 0.8154819 0.8155392 [22] 0.8155954 0.8156502 0.8157039 0.8157563 0.8158075 0.8158575 0.8159062 [29] 0.8159537 0.8160000 0.8160451 0.8160889 0.8161315 0.8161729 0.8162131 [36] 0.8162521 0.8162898 0.8163263 0.8163616 0.8163957 0.8164286 0.8164603 [43] 0.8164907 0.8165200 0.8165480 0.8165748 0.8166004 0.8166248 0.8166480 [50] 0.8166700 0.8166908 0.8167104 0.8167288 0.8167460 0.8167620 0.8167768 [57] 0.8167904 0.8168028 0.8168140 0.8168240 0.8168328 0.8168405 0.8168469 [64] 0.8168522 0.8168563 0.8168592 0.8168609 0.8168614 0.8168608 0.8168589 [71] 0.8168559 0.8168517 0.8168464 0.8168399 0.8168322 0.8168233 0.8168133 [78] 0.8168020 0.8167897 0.8167761 0.8167614 0.8167456 0.8167286 0.8167104 [85] 0.8166911 0.8166706 0.8166489 0.8166261 0.8166022 0.8165771 0.8165509 [92] 0.8165235 0.8164949 0.8164653 0.8164345 0.8164025 0.8163694 0.8163352 [99] 0.8162998 0.8162634 0.8162257 0.8161870 0.8161471 0.8161061 0.8160640 [106] 0.8160207 0.8159764 0.8159309 0.8158843 0.8158366 0.8157877 0.8157378 [113] 0.8156867 0.8156346 0.8155813 0.8155269 0.8154715 0.8154149 0.8153572 [120] 0.8152984 0.8152386 0.8151776 0.8151156 0.8150524 0.8149882 0.8149229 [127] 0.8148565 0.8147890 0.8147204 0.8146508 0.8145801 0.8145083 0.8144354 [134] 0.8143615 0.8142865 0.8142104 0.8141333 0.8140551 0.8139758 0.8138955 [141] 0.8138141 0.8137317 0.8136482 0.8135637 0.8134781 0.8133914 0.8133037 [148] 0.8132150 0.8131253 0.8130345 0.8129426 0.8128497 0.8127558 0.8126609 [155] 0.8125649 0.8124679 0.8123699 0.8122708 0.8121708 0.8120697 0.8119676 [162] 0.8118645 0.8117603 0.8116552 0.8115490 0.8114419 0.8113337 0.8112245 [169] 0.8111144 0.8110032 0.8108910 0.8107779 0.8106637 0.8105486 0.8104325 [176] 0.8103153 0.8101972 0.8100782 0.8099581 0.8098371 0.8097151 0.8095921 [183] 0.8094681 0.8093432 0.8092173 0.8090904 0.8089626 0.8088338 0.8087041 [190] 0.8085734 0.8084418 0.8083092 0.8081756 0.8080411 0.8079057 0.8077693 [197] 0.8076320 0.8074937 0.8073545 0.8072144 0.8070733 0.8069313 0.8067884 [204] 0.8066445 0.8064997 0.8063540 0.8062074 0.8060599 0.8059114 0.8057621 [211] 0.8056118 0.8054606 0.8053085 0.8051555 0.8050016 0.8048468 0.8046912 [218] 0.8045346 0.8043771 0.8042187 0.8040595 0.8038993 0.8037383 0.8035764 [225] 0.8034136 0.8032499 0.8030854 0.8029200 0.8027537 0.8025865 0.8024185 [232] 0.8022496 0.8020798 0.8019092 0.8017378 0.8015654 0.8013923 0.8012182 [239] 0.8010434 0.8008676 0.8006911 0.8005137 0.8003354 0.8001563 0.7999764 [246] 0.7997956 0.7996141 0.7994316 0.7992484 0.7990643 0.7988794 0.7986937 [253] 0.7985072 0.7983199 0.7981317 0.7979427 0.7977530 0.7975624 0.7973710 [260] 0.7971788 0.7969858 0.7967920 0.7965974 0.7964020 0.7962059 0.7960089 [267] 0.7958112 0.7956126 0.7954133 0.7952132 0.7950123 0.7948107 0.7946083 [274] 0.7944051 0.7942011 0.7939964 0.7937909 0.7935846 0.7933776 0.7931698 [281] 0.7929613 0.7927520 0.7925420 0.7923312 0.7921196 0.7919074 0.7916943 [288] 0.7914806 0.7912661 0.7910508 0.7908348 0.7906181 0.7904007 0.7901825 [295] 0.7899636 0.7897440 0.7895237 0.7893026 0.7890809 0.7888584 0.7886352 [302] 0.7884113 0.7881866 0.7879613 0.7877353 0.7875086 0.7872811 0.7870530 [309] 0.7868242 0.7865947 0.7863644 0.7861336 0.7859020 0.7856697 0.7854368 [316] 0.7852031 0.7849688 0.7847338 0.7844982 0.7842618 0.7840248 0.7837872 [323] 0.7835488 0.7833098 0.7830702 0.7828299 0.7825889 0.7823473 0.7821050 [330] 0.7818621 0.7816185 0.7813743 0.7811294 0.7808839 0.7806377 0.7803909 [337] 0.7801435 0.7798954 0.7796468 0.7793974 0.7791475 0.7788969 0.7786457 [344] 0.7783939 0.7781415 0.7778884 0.7776347 0.7773805 0.7771256 0.7768701 [351] 0.7766140 0.7763572 0.7760999 0.7758420 0.7755835 0.7753244 0.7750647 [358] 0.7748044 0.7745435 0.7742820 0.7740200 0.7737573 0.7734941 0.7732303 [365] 0.7729659 0.7727009 0.7724354 0.7721693 0.7719026 0.7716354 0.7713675 [372] 0.7710992 0.7708302 0.7705607 0.7702907 0.7700201 0.7697489 0.7694772 [379] 0.7692049 0.7689321 0.7686587 0.7683848 0.7681104 0.7678354 0.7675599 [386] 0.7672838 0.7670072 0.7667301 0.7664524 0.7661742 0.7658955 0.7656163 [393] 0.7653365 0.7650562 0.7647755 0.7644941 0.7642123 0.7639300 0.7636471 [400] 0.7633638 0.7630799 > mx [1] 0.8168614 > mxli [1] -1.33 > 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/11k821226420125.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/2bx7a1226420125.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/3n8j31226420125.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/4vxcr1226420125.tab") > > system("convert tmp/11k821226420125.ps tmp/11k821226420125.png") > system("convert tmp/2bx7a1226420125.ps tmp/2bx7a1226420125.png") > system("convert tmp/3n8j31226420125.ps tmp/3n8j31226420125.png") > > > proc.time() user system elapsed 1.015 0.515 1.188