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(519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258) > x <- c(3.253,3.233,3.196,3.138,3.091,3.17,3.378,3.468,3.33,3.413,3.356,3.525,3.633,3.597,3.6,3.522,3.503,3.532,3.686,3.748,3.672,3.843,3.905,3.999,4.07,4.084,4.042,3.951,3.933,3.958,4.147,4.221,4.058,4.057,4.089,4.268,4.309,4.303,4.177,4.117,4.065,3.983,4.091,4.067,4.024,3.868,3.8,3.804,3.862,3.792,3.674,3.56,3.489,3.412,3.674,3.672,3.463,3.429,3.4,3.533) > #'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.7899440 0.7899529 0.7899617 0.7899703 0.7899787 0.7899869 0.7899950 [8] 0.7900029 0.7900106 0.7900182 0.7900256 0.7900328 0.7900399 0.7900468 [15] 0.7900535 0.7900600 0.7900664 0.7900727 0.7900787 0.7900846 0.7900903 [22] 0.7900959 0.7901012 0.7901064 0.7901115 0.7901164 0.7901211 0.7901256 [29] 0.7901300 0.7901342 0.7901382 0.7901421 0.7901458 0.7901493 0.7901527 [36] 0.7901559 0.7901589 0.7901617 0.7901644 0.7901670 0.7901693 0.7901715 [43] 0.7901735 0.7901754 0.7901771 0.7901786 0.7901799 0.7901811 0.7901821 [50] 0.7901830 0.7901836 0.7901841 0.7901845 0.7901847 0.7901847 0.7901845 [57] 0.7901842 0.7901837 0.7901830 0.7901822 0.7901812 0.7901800 0.7901787 [64] 0.7901772 0.7901755 0.7901737 0.7901717 0.7901695 0.7901672 0.7901647 [71] 0.7901620 0.7901592 0.7901562 0.7901530 0.7901497 0.7901462 0.7901425 [78] 0.7901386 0.7901346 0.7901305 0.7901261 0.7901216 0.7901169 0.7901121 [85] 0.7901071 0.7901019 0.7900966 0.7900911 0.7900854 0.7900796 0.7900736 [92] 0.7900674 0.7900610 0.7900545 0.7900479 0.7900410 0.7900340 0.7900269 [99] 0.7900195 0.7900120 0.7900044 0.7899965 0.7899885 0.7899804 0.7899720 [106] 0.7899635 0.7899549 0.7899460 0.7899370 0.7899279 0.7899186 0.7899091 [113] 0.7898994 0.7898896 0.7898796 0.7898694 0.7898591 0.7898486 0.7898380 [120] 0.7898272 0.7898162 0.7898051 0.7897937 0.7897823 0.7897706 0.7897588 [127] 0.7897469 0.7897347 0.7897224 0.7897100 0.7896973 0.7896845 0.7896716 [134] 0.7896585 0.7896452 0.7896317 0.7896181 0.7896043 0.7895904 0.7895763 [141] 0.7895620 0.7895476 0.7895330 0.7895182 0.7895033 0.7894882 0.7894729 [148] 0.7894575 0.7894419 0.7894262 0.7894103 0.7893942 0.7893780 0.7893616 [155] 0.7893450 0.7893283 0.7893114 0.7892943 0.7892771 0.7892597 0.7892422 [162] 0.7892245 0.7892066 0.7891886 0.7891704 0.7891521 0.7891335 0.7891149 [169] 0.7890960 0.7890770 0.7890578 0.7890385 0.7890190 0.7889994 0.7889795 [176] 0.7889596 0.7889394 0.7889191 0.7888987 0.7888780 0.7888572 0.7888363 [183] 0.7888152 0.7887939 0.7887725 0.7887509 0.7887291 0.7887072 0.7886851 [190] 0.7886629 0.7886405 0.7886179 0.7885952 0.7885723 0.7885493 0.7885261 [197] 0.7885027 0.7884792 0.7884555 0.7884316 0.7884076 0.7883835 0.7883591 [204] 0.7883346 0.7883100 0.7882852 0.7882602 0.7882351 0.7882098 0.7881844 [211] 0.7881587 0.7881330 0.7881071 0.7880810 0.7880547 0.7880283 0.7880018 [218] 0.7879750 0.7879482 0.7879211 0.7878939 0.7878666 0.7878390 0.7878114 [225] 0.7877835 0.7877555 0.7877274 0.7876991 0.7876706 0.7876420 0.7876132 [232] 0.7875843 0.7875552 0.7875259 0.7874965 0.7874669 0.7874372 0.7874073 [239] 0.7873773 0.7873471 0.7873167 0.7872862 0.7872555 0.7872247 0.7871937 [246] 0.7871626 0.7871313 0.7870998 0.7870682 0.7870364 0.7870045 0.7869724 [253] 0.7869402 0.7869078 0.7868753 0.7868425 0.7868097 0.7867767 0.7867435 [260] 0.7867102 0.7866767 0.7866430 0.7866092 0.7865753 0.7865412 0.7865069 [267] 0.7864725 0.7864379 0.7864032 0.7863683 0.7863333 0.7862981 0.7862628 [274] 0.7862273 0.7861916 0.7861558 0.7861199 0.7860837 0.7860475 0.7860111 [281] 0.7859745 0.7859377 0.7859009 0.7858638 0.7858266 0.7857893 0.7857518 [288] 0.7857141 0.7856763 0.7856384 0.7856003 0.7855620 0.7855236 0.7854850 [295] 0.7854463 0.7854075 0.7853684 0.7853293 0.7852899 0.7852505 0.7852108 [302] 0.7851710 0.7851311 0.7850910 0.7850508 0.7850104 0.7849699 0.7849292 [309] 0.7848883 0.7848473 0.7848062 0.7847649 0.7847235 0.7846819 0.7846401 [316] 0.7845982 0.7845562 0.7845140 0.7844716 0.7844291 0.7843865 0.7843437 [323] 0.7843007 0.7842577 0.7842144 0.7841710 0.7841275 0.7840838 0.7840399 [330] 0.7839959 0.7839518 0.7839075 0.7838631 0.7838185 0.7837738 0.7837289 [337] 0.7836839 0.7836387 0.7835933 0.7835479 0.7835023 0.7834565 0.7834106 [344] 0.7833645 0.7833183 0.7832719 0.7832254 0.7831788 0.7831320 0.7830850 [351] 0.7830379 0.7829907 0.7829433 0.7828958 0.7828481 0.7828003 0.7827523 [358] 0.7827042 0.7826559 0.7826075 0.7825589 0.7825102 0.7824614 0.7824124 [365] 0.7823633 0.7823140 0.7822646 0.7822150 0.7821653 0.7821154 0.7820654 [372] 0.7820153 0.7819650 0.7819145 0.7818639 0.7818132 0.7817623 0.7817113 [379] 0.7816602 0.7816089 0.7815574 0.7815058 0.7814541 0.7814022 0.7813502 [386] 0.7812980 0.7812457 0.7811933 0.7811407 0.7810880 0.7810351 0.7809821 [393] 0.7809289 0.7808756 0.7808222 0.7807686 0.7807149 0.7806610 0.7806070 [400] 0.7805528 0.7804985 > mx [1] 0.7901847 > mxli [1] -1.46 > 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/1ygmu1226564955.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/2ozd91226564955.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/3u28o1226564955.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/41t0v1226564955.tab") > > system("convert tmp/1ygmu1226564955.ps tmp/1ygmu1226564955.png") > system("convert tmp/2ozd91226564955.ps tmp/2ozd91226564955.png") > system("convert tmp/3u28o1226564955.ps tmp/3u28o1226564955.png") > > > proc.time() user system elapsed 0.990 0.507 1.165