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(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) > x <- 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) > #'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.7688202 0.7690375 0.7692537 0.7694688 0.7696828 0.7698957 0.7701075 [8] 0.7703182 0.7705278 0.7707363 0.7709438 0.7711501 0.7713553 0.7715595 [15] 0.7717625 0.7719645 0.7721654 0.7723651 0.7725638 0.7727614 0.7729579 [22] 0.7731533 0.7733476 0.7735408 0.7737329 0.7739239 0.7741139 0.7743027 [29] 0.7744905 0.7746771 0.7748627 0.7750472 0.7752306 0.7754129 0.7755941 [36] 0.7757742 0.7759533 0.7761313 0.7763081 0.7764839 0.7766586 0.7768322 [43] 0.7770048 0.7771762 0.7773466 0.7775159 0.7776841 0.7778512 0.7780173 [50] 0.7781822 0.7783461 0.7785089 0.7786706 0.7788313 0.7789909 0.7791494 [57] 0.7793068 0.7794632 0.7796184 0.7797727 0.7799258 0.7800779 0.7802289 [64] 0.7803788 0.7805276 0.7806754 0.7808222 0.7809678 0.7811124 0.7812560 [71] 0.7813984 0.7815398 0.7816802 0.7818195 0.7819577 0.7820949 0.7822310 [78] 0.7823660 0.7825000 0.7826330 0.7827649 0.7828957 0.7830255 0.7831542 [85] 0.7832819 0.7834086 0.7835342 0.7836587 0.7837822 0.7839047 0.7840261 [92] 0.7841465 0.7842658 0.7843841 0.7845014 0.7846176 0.7847328 0.7848469 [99] 0.7849601 0.7850721 0.7851832 0.7852932 0.7854022 0.7855102 0.7856171 [106] 0.7857230 0.7858279 0.7859318 0.7860347 0.7861365 0.7862373 0.7863371 [113] 0.7864359 0.7865336 0.7866304 0.7867261 0.7868208 0.7869146 0.7870073 [120] 0.7870990 0.7871897 0.7872794 0.7873681 0.7874557 0.7875424 0.7876281 [127] 0.7877128 0.7877965 0.7878792 0.7879609 0.7880416 0.7881213 0.7882001 [134] 0.7882778 0.7883546 0.7884304 0.7885052 0.7885790 0.7886518 0.7887237 [141] 0.7887945 0.7888644 0.7889333 0.7890013 0.7890683 0.7891343 0.7891993 [148] 0.7892634 0.7893265 0.7893886 0.7894498 0.7895100 0.7895693 0.7896276 [155] 0.7896849 0.7897413 0.7897968 0.7898513 0.7899048 0.7899574 0.7900090 [162] 0.7900597 0.7901094 0.7901582 0.7902061 0.7902530 0.7902990 0.7903441 [169] 0.7903882 0.7904313 0.7904736 0.7905149 0.7905553 0.7905947 0.7906333 [176] 0.7906709 0.7907076 0.7907433 0.7907782 0.7908121 0.7908451 0.7908772 [183] 0.7909084 0.7909387 0.7909681 0.7909965 0.7910241 0.7910507 0.7910765 [190] 0.7911013 0.7911252 0.7911483 0.7911704 0.7911917 0.7912120 0.7912315 [197] 0.7912501 0.7912678 0.7912846 0.7913005 0.7913155 0.7913296 0.7913429 [204] 0.7913553 0.7913668 0.7913774 0.7913872 0.7913961 0.7914041 0.7914113 [211] 0.7914175 0.7914230 0.7914275 0.7914312 0.7914340 0.7914360 0.7914371 [218] 0.7914373 0.7914367 0.7914353 0.7914330 0.7914298 0.7914258 0.7914210 [225] 0.7914153 0.7914088 0.7914014 0.7913932 0.7913841 0.7913742 0.7913635 [232] 0.7913519 0.7913396 0.7913263 0.7913123 0.7912974 0.7912817 0.7912652 [239] 0.7912479 0.7912297 0.7912107 0.7911909 0.7911703 0.7911489 0.7911266 [246] 0.7911036 0.7910797 0.7910551 0.7910296 0.7910033 0.7909762 0.7909484 [253] 0.7909197 0.7908902 0.7908599 0.7908289 0.7907970 0.7907644 0.7907309 [260] 0.7906967 0.7906617 0.7906259 0.7905893 0.7905520 0.7905139 0.7904749 [267] 0.7904352 0.7903948 0.7903535 0.7903115 0.7902688 0.7902252 0.7901809 [274] 0.7901358 0.7900900 0.7900434 0.7899960 0.7899479 0.7898990 0.7898493 [281] 0.7897990 0.7897478 0.7896959 0.7896433 0.7895899 0.7895357 0.7894809 [288] 0.7894252 0.7893689 0.7893118 0.7892539 0.7891953 0.7891360 0.7890760 [295] 0.7890152 0.7889537 0.7888914 0.7888284 0.7887647 0.7887003 0.7886352 [302] 0.7885693 0.7885027 0.7884354 0.7883674 0.7882986 0.7882292 0.7881590 [309] 0.7880882 0.7880166 0.7879443 0.7878713 0.7877976 0.7877232 0.7876481 [316] 0.7875722 0.7874957 0.7874185 0.7873406 0.7872620 0.7871827 0.7871028 [323] 0.7870221 0.7869407 0.7868587 0.7867760 0.7866926 0.7866085 0.7865237 [330] 0.7864382 0.7863521 0.7862653 0.7861778 0.7860896 0.7860008 0.7859113 [337] 0.7858211 0.7857303 0.7856388 0.7855466 0.7854537 0.7853602 0.7852661 [344] 0.7851713 0.7850758 0.7849796 0.7848829 0.7847854 0.7846873 0.7845886 [351] 0.7844892 0.7843891 0.7842884 0.7841871 0.7840851 0.7839825 0.7838792 [358] 0.7837753 0.7836708 0.7835656 0.7834598 0.7833533 0.7832463 0.7831385 [365] 0.7830302 0.7829212 0.7828116 0.7827014 0.7825905 0.7824791 0.7823670 [372] 0.7822542 0.7821409 0.7820270 0.7819124 0.7817972 0.7816814 0.7815650 [379] 0.7814480 0.7813303 0.7812121 0.7810932 0.7809738 0.7808537 0.7807330 [386] 0.7806118 0.7804899 0.7803674 0.7802444 0.7801207 0.7799964 0.7798716 [393] 0.7797461 0.7796201 0.7794935 0.7793662 0.7792384 0.7791100 0.7789811 [400] 0.7788515 0.7787213 > mx [1] 0.7914373 > mxli [1] 0.17 > 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/1a6x51226420302.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/2wq3y1226420302.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/3i2qg1226420302.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/4pud51226420302.tab") > > system("convert tmp/1a6x51226420302.ps tmp/1a6x51226420302.png") > system("convert tmp/2wq3y1226420302.ps tmp/2wq3y1226420302.png") > system("convert tmp/3i2qg1226420302.ps tmp/3i2qg1226420302.png") > > > proc.time() user system elapsed 0.995 0.506 1.207