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(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,270976,261076,255603,260376,263903,264291,263276,262572,256167,264221,293860) > x <- c(285351,286602,283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710) > #'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.8274301 0.8275054 0.8275806 0.8276531 0.8277293 0.8278048 0.8278796 [8] 0.8279531 0.8280277 0.8281015 0.8281771 0.8282505 0.8283245 0.8283980 [15] 0.8284723 0.8285448 0.8286191 0.8286920 0.8287652 0.8288381 0.8289115 [22] 0.8289846 0.8290572 0.8291298 0.8292024 0.8292751 0.8293477 0.8294202 [29] 0.8294922 0.8295645 0.8296364 0.8297082 0.8297801 0.8298519 0.8299234 [36] 0.8299950 0.8300664 0.8301376 0.8302088 0.8302800 0.8303509 0.8304218 [43] 0.8304926 0.8305633 0.8306338 0.8307043 0.8307747 0.8308449 0.8309151 [50] 0.8309852 0.8310551 0.8311250 0.8311947 0.8312644 0.8313339 0.8314033 [57] 0.8314727 0.8315419 0.8316110 0.8316800 0.8317490 0.8318178 0.8318865 [64] 0.8319551 0.8320236 0.8320920 0.8321603 0.8322285 0.8322966 0.8323646 [71] 0.8324325 0.8325003 0.8325679 0.8326355 0.8327030 0.8327703 0.8328376 [78] 0.8329048 0.8329718 0.8330388 0.8331056 0.8331724 0.8332390 0.8333056 [85] 0.8333720 0.8334383 0.8335046 0.8335707 0.8336367 0.8337026 0.8337684 [92] 0.8338341 0.8338997 0.8339653 0.8340307 0.8340959 0.8341611 0.8342262 [99] 0.8342912 0.8343561 0.8344209 0.8344856 0.8345501 0.8346146 0.8346790 [106] 0.8347432 0.8348074 0.8348714 0.8349354 0.8349992 0.8350630 0.8351266 [113] 0.8351902 0.8352536 0.8353169 0.8353802 0.8354433 0.8355063 0.8355692 [120] 0.8356320 0.8356947 0.8357573 0.8358199 0.8358823 0.8359445 0.8360067 [127] 0.8360688 0.8361308 0.8361927 0.8362545 0.8363162 0.8363777 0.8364392 [134] 0.8365006 0.8365618 0.8366230 0.8366840 0.8367450 0.8368058 0.8368666 [141] 0.8369272 0.8369878 0.8370482 0.8371085 0.8371688 0.8372289 0.8372889 [148] 0.8373488 0.8374086 0.8374684 0.8375280 0.8375875 0.8376469 0.8377062 [155] 0.8377654 0.8378245 0.8378835 0.8379423 0.8380011 0.8380598 0.8381184 [162] 0.8381769 0.8382352 0.8382935 0.8383517 0.8384097 0.8384677 0.8385255 [169] 0.8385833 0.8386409 0.8386985 0.8387559 0.8388133 0.8388705 0.8389276 [176] 0.8389847 0.8390416 0.8390984 0.8391551 0.8392118 0.8392683 0.8393247 [183] 0.8393810 0.8394372 0.8394933 0.8395493 0.8396052 0.8396610 0.8397167 [190] 0.8397723 0.8398278 0.8398832 0.8399384 0.8399936 0.8400487 0.8401037 [197] 0.8401585 0.8402133 0.8402680 0.8403225 0.8403770 0.8404313 0.8404856 [204] 0.8405397 0.8405938 0.8406477 0.8407016 0.8407553 0.8408090 0.8408625 [211] 0.8409159 0.8409692 0.8410225 0.8410756 0.8411286 0.8411815 0.8412343 [218] 0.8412871 0.8413397 0.8413922 0.8414446 0.8414969 0.8415491 0.8416012 [225] 0.8416532 0.8417051 0.8417569 0.8418086 0.8418601 0.8419116 0.8419630 [232] 0.8420143 0.8420655 0.8421165 0.8421675 0.8422184 0.8422692 0.8423198 [239] 0.8423704 0.8424208 0.8424712 0.8425215 0.8425716 0.8426217 0.8426716 [246] 0.8427215 0.8427712 0.8428209 0.8428704 0.8429198 0.8429692 0.8430184 [253] 0.8430675 0.8431166 0.8431655 0.8432143 0.8432631 0.8433117 0.8433602 [260] 0.8434086 0.8434569 0.8435052 0.8435533 0.8436013 0.8436492 0.8436970 [267] 0.8437447 0.8437923 0.8438398 0.8438872 0.8439345 0.8439817 0.8440288 [274] 0.8440758 0.8441227 0.8441695 0.8442162 0.8442628 0.8443093 0.8443557 [281] 0.8444020 0.8444482 0.8444942 0.8445402 0.8445861 0.8446319 0.8446776 [288] 0.8447231 0.8447686 0.8448140 0.8448593 0.8449044 0.8449495 0.8449945 [295] 0.8450393 0.8450841 0.8451288 0.8451733 0.8452178 0.8452622 0.8453064 [302] 0.8453506 0.8453946 0.8454386 0.8454825 0.8455262 0.8455699 0.8456134 [309] 0.8456569 0.8457002 0.8457435 0.8457866 0.8458297 0.8458726 0.8459155 [316] 0.8459582 0.8460009 0.8460434 0.8460859 0.8461282 0.8461705 0.8462126 [323] 0.8462546 0.8462966 0.8463384 0.8463802 0.8464218 0.8464634 0.8465048 [330] 0.8465461 0.8465874 0.8466285 0.8466696 0.8467105 0.8467513 0.8467921 [337] 0.8468327 0.8468733 0.8469137 0.8469540 0.8469943 0.8470344 0.8470744 [344] 0.8471144 0.8471542 0.8471940 0.8472336 0.8472731 0.8473126 0.8473519 [351] 0.8473912 0.8474303 0.8474693 0.8475083 0.8475471 0.8475858 0.8476245 [358] 0.8476630 0.8477015 0.8477398 0.8477781 0.8478162 0.8478542 0.8478922 [365] 0.8479300 0.8479678 0.8480054 0.8480430 0.8480804 0.8481177 0.8481550 [372] 0.8481921 0.8482292 0.8482661 0.8483030 0.8483397 0.8483764 0.8484129 [379] 0.8484494 0.8484857 0.8485220 0.8485582 0.8485942 0.8486302 0.8486660 [386] 0.8487018 0.8487375 0.8487730 0.8488085 0.8488438 0.8488791 0.8489143 [393] 0.8489493 0.8489843 0.8490192 0.8490540 0.8490886 0.8491232 0.8491577 [400] 0.8491921 0.8492263 > mx [1] 0.8492263 > mxli [1] 2 > 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/10eq11258363046.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/2fvza1258363046.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/3q7yb1258363046.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/4rfrp1258363046.tab") > > system("convert tmp/10eq11258363046.ps tmp/10eq11258363046.png") > system("convert tmp/2fvza1258363046.ps tmp/2fvza1258363046.png") > system("convert tmp/3q7yb1258363046.ps tmp/3q7yb1258363046.png") > > > proc.time() user system elapsed 0.785 0.518 1.239