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(267413,267366,264777,258863,254844,254868,277267,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,295881,293299) > x <- c(22.4,27.4,27.4,30.4,35.4,25.4,27.4,26.4,32.4,28.4,28.4,30.4,33.4,27.4,23.4,20.4,22.4,24.4,24.4,26.4,29.4,28.4,22.4,18.4,25.4,27.4,23.4,15.4,19.4,26.4,30.4,27.4,27.4,21.4,27.4,30.4,34.4,33.4,36.4,35.4,37.4,33.4,35.4,32.4,28.4,28.4,31.4,33.4,33.4,28.4,32.4,30.4,28.4,26.4,27.4,24.4,19.4,23.4,18.4,18.4,12.4,10.4,7.4,1,8.8,8.9,13,17.9,13.3) > #'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.05457603 -0.05466677 -0.05475959 -0.05485455 -0.05495170 -0.05505107 [7] -0.05515273 -0.05525672 -0.05536309 -0.05547189 -0.05558318 -0.05569701 [13] -0.05581343 -0.05593251 -0.05605430 -0.05617885 -0.05630623 -0.05643650 [19] -0.05656972 -0.05670595 -0.05684526 -0.05698770 -0.05713336 -0.05728229 [25] -0.05743457 -0.05759026 -0.05774944 -0.05791217 -0.05807854 -0.05824862 [31] -0.05842249 -0.05860021 -0.05878188 -0.05896757 -0.05915737 -0.05935135 [37] -0.05954961 -0.05975222 -0.05995928 -0.06017088 -0.06038710 -0.06060804 [43] -0.06083379 -0.06106445 -0.06130010 -0.06154086 -0.06178681 -0.06203805 [49] -0.06229470 -0.06255685 -0.06282460 -0.06309807 -0.06337736 -0.06366257 [55] -0.06395383 -0.06425123 -0.06455489 -0.06486494 -0.06518147 -0.06550461 [61] -0.06583448 -0.06617120 -0.06651488 -0.06686565 -0.06722362 -0.06758894 [67] -0.06796171 -0.06834207 -0.06873014 -0.06912606 -0.06952994 -0.06994192 [73] -0.07036213 -0.07079070 -0.07122776 -0.07167345 -0.07212790 -0.07259124 [79] -0.07306360 -0.07354512 -0.07403594 -0.07453618 -0.07504599 -0.07556549 [85] -0.07609482 -0.07663411 -0.07718350 -0.07774312 -0.07831309 -0.07889356 [91] -0.07948465 -0.08008649 -0.08069921 -0.08132293 -0.08195777 -0.08260387 [97] -0.08326133 -0.08393029 -0.08461084 -0.08530312 -0.08600722 -0.08672326 [103] -0.08745134 -0.08819157 -0.08894403 -0.08970882 -0.09048604 -0.09127577 [109] -0.09207809 -0.09289307 -0.09372080 -0.09456132 -0.09541472 -0.09628103 [115] -0.09716030 -0.09805259 -0.09895793 -0.09987635 -0.10080786 -0.10175249 [121] -0.10271023 -0.10368110 -0.10466509 -0.10566217 -0.10667232 -0.10769551 [127] -0.10873169 -0.10978082 -0.11084283 -0.11191765 -0.11300520 -0.11410539 [133] -0.11521811 -0.11634326 -0.11748072 -0.11863035 -0.11979200 -0.12096553 [139] -0.12215077 -0.12334755 -0.12455567 -0.12577493 -0.12700514 -0.12824607 [145] -0.12949748 -0.13075914 -0.13203079 -0.13331217 -0.13460301 -0.13590301 [151] -0.13721189 -0.13852935 -0.13985506 -0.14118870 -0.14252995 -0.14387845 [157] -0.14523386 -0.14659582 -0.14796396 -0.14933792 -0.15071730 -0.15210173 [163] -0.15349081 -0.15488414 -0.15628133 -0.15768196 -0.15908562 -0.16049191 [169] -0.16190039 -0.16331067 -0.16472231 -0.16613489 -0.16754800 -0.16896122 [175] -0.17037412 -0.17178629 -0.17319731 -0.17460678 -0.17601427 -0.17741940 [181] -0.17882175 -0.18022093 -0.18161656 -0.18300824 -0.18439561 -0.18577830 [187] -0.18715594 -0.18852818 -0.18989467 -0.19125509 -0.19260910 -0.19395638 [193] -0.19529664 -0.19662957 -0.19795489 -0.19927233 -0.20058161 -0.20188248 [199] -0.20317472 -0.20445807 -0.20573233 -0.20699728 -0.20825273 -0.20949850 [205] -0.21073441 -0.21196030 -0.21317602 -0.21438143 -0.21557640 -0.21676081 [211] -0.21793456 -0.21909756 -0.22024971 -0.22139095 -0.22252120 -0.22364041 [217] -0.22474854 -0.22584555 -0.22693141 -0.22800611 -0.22906963 -0.23012197 [223] -0.23116314 -0.23219315 -0.23321203 -0.23421979 -0.23521648 -0.23620214 [229] -0.23717680 -0.23814053 -0.23909338 -0.24003542 -0.24096671 -0.24188733 [235] -0.24279736 -0.24369686 -0.24458594 -0.24546467 -0.24633316 -0.24719149 [241] -0.24803975 -0.24887806 -0.24970651 -0.25052521 -0.25133427 -0.25213378 [247] -0.25292386 -0.25370463 -0.25447618 -0.25523864 -0.25599212 -0.25673673 [253] -0.25747258 -0.25819979 -0.25891848 -0.25962875 -0.26033073 -0.26102452 [259] -0.26171025 -0.26238802 -0.26305795 -0.26372015 -0.26437473 -0.26502181 [265] -0.26566148 -0.26629387 -0.26691908 -0.26753722 -0.26814839 -0.26875271 [271] -0.26935026 -0.26994116 -0.27052551 -0.27110340 -0.27167495 -0.27224023 [277] -0.27279936 -0.27335242 -0.27389951 -0.27444072 -0.27497614 -0.27550586 [283] -0.27602997 -0.27654856 -0.27706171 -0.27756950 -0.27807202 -0.27856934 [289] -0.27906155 -0.27954873 -0.28003095 -0.28050829 -0.28098082 -0.28144861 [295] -0.28191174 -0.28237027 -0.28282428 -0.28327383 -0.28371899 -0.28415982 [301] -0.28459638 -0.28502875 -0.28545698 -0.28588112 -0.28630125 -0.28671741 [307] -0.28712967 -0.28753807 -0.28794268 -0.28834355 -0.28874072 -0.28913426 [313] -0.28952420 -0.28991061 -0.29029352 -0.29067299 -0.29104906 -0.29142178 [319] -0.29179119 -0.29215733 -0.29252025 -0.29288000 -0.29323660 -0.29359010 [325] -0.29394055 -0.29428797 -0.29463241 -0.29497390 -0.29531249 -0.29564820 [331] -0.29598107 -0.29631114 -0.29663843 -0.29696299 -0.29728484 -0.29760402 [337] -0.29792056 -0.29823448 -0.29854582 -0.29885461 -0.29916087 -0.29946464 [343] -0.29976594 -0.30006480 -0.30036124 -0.30065530 -0.30094699 -0.30123635 [349] -0.30152339 -0.30180814 -0.30209063 -0.30237088 -0.30264891 -0.30292475 [355] -0.30319841 -0.30346992 -0.30373930 -0.30400657 -0.30427176 -0.30453487 [361] -0.30479594 -0.30505498 -0.30531201 -0.30556705 -0.30582012 -0.30607124 [367] -0.30632042 -0.30656769 -0.30681305 -0.30705654 -0.30729816 -0.30753793 [373] -0.30777586 -0.30801199 -0.30824631 -0.30847885 -0.30870961 -0.30893863 [379] -0.30916591 -0.30939146 -0.30961530 -0.30983745 -0.31005791 -0.31027671 [385] -0.31049386 -0.31070937 -0.31092325 -0.31113551 -0.31134618 -0.31155526 [391] -0.31176276 -0.31196870 -0.31217309 -0.31237595 -0.31257727 -0.31277708 [397] -0.31297539 -0.31317221 -0.31336755 -0.31356142 -0.31375383 > mx [1] 0.3137538 > 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/1lw011257978650.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/2km2z1257978650.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/38fe21257978650.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/4dov21257978650.tab") > > system("convert tmp/1lw011257978650.ps tmp/1lw011257978650.png") > system("convert tmp/2km2z1257978650.ps tmp/2km2z1257978650.png") > system("convert tmp/38fe21257978650.ps tmp/38fe21257978650.png") > > > proc.time() user system elapsed 0.779 0.485 1.492