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(116222,110924,103753,99983,93302,91496,119321,139261,133739,123913,113438,109416,109406,105645,101328,97686,93093,91382,122257,139183,139887,131822,116805,113706,113012,110452,107005,102841,98173,98181,137277,147579,146571,138920,130340,128140,127059,122860,117702,113537,108366,111078,150739,159129,157928,147768,137507,136919,136151,133001,125554,119647,114158,116193,152803,161761,160942,149470,139208,134588,130322,126611,122401,117352,112135,112879,148729,157230,157221,146681,136524,132111,125326,122716,116615,113719,110737,112093,143565,149946,149147,134339,122683,115614,116566,111272,104609,101802,94542,93051,124129,130374,123946,114971,105531,104919,104782,101281,94545,93248,84031,87486,115867,120327) > x <- c(274452,267700,257841,255124,247377,247823,276919,294271,281758,270434,258848,256674,258882,255060,247698,244779,240901,239933,270247,283893,282348,273570,254756,254354,255843,254490,251995,246339,244019,245953,279806,283111,281097,275964,270694,271901,274412,272433,268361,268586,264768,269974,304744,309365,308347,298427,289231,291975,294912,293488,290555,284736,281818,287854,316263,325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,301631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257) > #'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.8053372 0.8053531 0.8053725 0.8053888 0.8054068 0.8054245 0.8054401 [8] 0.8054573 0.8054732 0.8054903 0.8055067 0.8055223 0.8055389 0.8055543 [15] 0.8055703 0.8055858 0.8056014 0.8056167 0.8056319 0.8056472 0.8056623 [22] 0.8056770 0.8056916 0.8057060 0.8057208 0.8057350 0.8057492 0.8057633 [29] 0.8057772 0.8057911 0.8058046 0.8058182 0.8058315 0.8058448 0.8058579 [36] 0.8058709 0.8058837 0.8058965 0.8059091 0.8059215 0.8059339 0.8059460 [43] 0.8059581 0.8059700 0.8059818 0.8059934 0.8060050 0.8060163 0.8060276 [50] 0.8060387 0.8060497 0.8060605 0.8060713 0.8060818 0.8060923 0.8061026 [57] 0.8061128 0.8061228 0.8061327 0.8061425 0.8061522 0.8061617 0.8061710 [64] 0.8061803 0.8061894 0.8061984 0.8062072 0.8062159 0.8062245 0.8062329 [71] 0.8062412 0.8062493 0.8062574 0.8062653 0.8062730 0.8062806 0.8062881 [78] 0.8062955 0.8063027 0.8063098 0.8063167 0.8063236 0.8063302 0.8063368 [85] 0.8063432 0.8063494 0.8063556 0.8063616 0.8063675 0.8063732 0.8063788 [92] 0.8063842 0.8063896 0.8063948 0.8063998 0.8064047 0.8064095 0.8064142 [99] 0.8064187 0.8064230 0.8064273 0.8064314 0.8064354 0.8064392 0.8064429 [106] 0.8064464 0.8064499 0.8064532 0.8064563 0.8064593 0.8064622 0.8064650 [113] 0.8064676 0.8064700 0.8064724 0.8064746 0.8064766 0.8064786 0.8064804 [120] 0.8064820 0.8064835 0.8064849 0.8064862 0.8064873 0.8064883 0.8064891 [127] 0.8064898 0.8064904 0.8064908 0.8064911 0.8064913 0.8064913 0.8064912 [134] 0.8064909 0.8064905 0.8064900 0.8064893 0.8064885 0.8064876 0.8064865 [141] 0.8064853 0.8064840 0.8064825 0.8064809 0.8064791 0.8064772 0.8064752 [148] 0.8064730 0.8064707 0.8064683 0.8064657 0.8064630 0.8064602 0.8064572 [155] 0.8064541 0.8064508 0.8064474 0.8064439 0.8064402 0.8064364 0.8064325 [162] 0.8064284 0.8064242 0.8064198 0.8064153 0.8064107 0.8064060 0.8064011 [169] 0.8063960 0.8063908 0.8063855 0.8063801 0.8063745 0.8063688 0.8063629 [176] 0.8063569 0.8063508 0.8063445 0.8063381 0.8063316 0.8063249 0.8063181 [183] 0.8063111 0.8063041 0.8062968 0.8062895 0.8062820 0.8062743 0.8062666 [190] 0.8062586 0.8062506 0.8062424 0.8062341 0.8062256 0.8062170 0.8062083 [197] 0.8061994 0.8061904 0.8061813 0.8061720 0.8061626 0.8061530 0.8061433 [204] 0.8061335 0.8061235 0.8061134 0.8061032 0.8060928 0.8060823 0.8060717 [211] 0.8060609 0.8060500 0.8060389 0.8060277 0.8060164 0.8060049 0.8059933 [218] 0.8059816 0.8059697 0.8059577 0.8059455 0.8059332 0.8059208 0.8059082 [225] 0.8058955 0.8058827 0.8058697 0.8058566 0.8058434 0.8058300 0.8058165 [232] 0.8058028 0.8057890 0.8057751 0.8057610 0.8057468 0.8057325 0.8057180 [239] 0.8057034 0.8056887 0.8056738 0.8056588 0.8056436 0.8056283 0.8056129 [246] 0.8055973 0.8055816 0.8055658 0.8055498 0.8055337 0.8055174 0.8055010 [253] 0.8054845 0.8054679 0.8054511 0.8054341 0.8054171 0.8053999 0.8053825 [260] 0.8053651 0.8053475 0.8053297 0.8053118 0.8052938 0.8052757 0.8052574 [267] 0.8052390 0.8052204 0.8052017 0.8051829 0.8051639 0.8051448 0.8051256 [274] 0.8051062 0.8050867 0.8050670 0.8050473 0.8050273 0.8050073 0.8049871 [281] 0.8049668 0.8049463 0.8049257 0.8049050 0.8048841 0.8048631 0.8048420 [288] 0.8048207 0.8047993 0.8047778 0.8047561 0.8047343 0.8047123 0.8046903 [295] 0.8046681 0.8046457 0.8046232 0.8046006 0.8045778 0.8045550 0.8045319 [302] 0.8045088 0.8044855 0.8044620 0.8044385 0.8044148 0.8043909 0.8043670 [309] 0.8043429 0.8043186 0.8042943 0.8042698 0.8042451 0.8042204 0.8041955 [316] 0.8041704 0.8041452 0.8041199 0.8040945 0.8040689 0.8040432 0.8040173 [323] 0.8039914 0.8039653 0.8039390 0.8039126 0.8038861 0.8038595 0.8038327 [330] 0.8038058 0.8037787 0.8037515 0.8037242 0.8036968 0.8036692 0.8036415 [337] 0.8036136 0.8035857 0.8035575 0.8035293 0.8035009 0.8034724 0.8034438 [344] 0.8034150 0.8033861 0.8033570 0.8033278 0.8032985 0.8032691 0.8032395 [351] 0.8032098 0.8031800 0.8031500 0.8031199 0.8030897 0.8030593 0.8030288 [358] 0.8029982 0.8029674 0.8029365 0.8029055 0.8028743 0.8028430 0.8028116 [365] 0.8027800 0.8027483 0.8027165 0.8026846 0.8026525 0.8026203 0.8025879 [372] 0.8025555 0.8025229 0.8024901 0.8024572 0.8024242 0.8023911 0.8023578 [379] 0.8023245 0.8022909 0.8022573 0.8022235 0.8021896 0.8021555 0.8021214 [386] 0.8020870 0.8020526 0.8020180 0.8019833 0.8019485 0.8019136 0.8018785 [393] 0.8018433 0.8018079 0.8017724 0.8017368 0.8017011 0.8016652 0.8016292 [400] 0.8015931 0.8015568 > mx [1] 0.8064913 > mxli [1] -0.69 > 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/1m4bq1226508923.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/2m3yx1226508923.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/3vcbb1226508923.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/4bw4m1226508923.tab") > > system("convert tmp/1m4bq1226508923.ps tmp/1m4bq1226508923.png") > system("convert tmp/2m3yx1226508923.ps tmp/2m3yx1226508923.png") > system("convert tmp/3vcbb1226508923.ps tmp/3vcbb1226508923.png") > > > proc.time() user system elapsed 1.215 0.805 1.497