R version 2.8.1 (2008-12-22) 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(2.81,2.77,2.61,2.53,2.55,2.18,2.08,2.06,2.07,2.05,2.02,2.01,2.01,2,2,2,2,2,2.01,2.01,2.02,2.02,2.04,2.06,2.06,2.05,2.05,2.05,2.05,2.05,2.05,2.05,2.06,2.06,2.06,2.27,2.3,2.31,2.52,2.58,2.58,2.72,2.8,2.98,3.03,3.22,3.31,3.47,3.56,3.55,3.72,3.82,3.82,3.97,4.05,4.07,4.17,4.13,4.15,4.19,4.18) > x <- c(1.2,1.6,1.7,1.5,0.9,1.5,1.4,1.6,1.7,1.4,1.8,1.7,1.4,1.2,1,1.7,2.4,2,2.1,2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5) > #'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.09895419 -0.09907790 -0.09920019 -0.09932105 -0.09944047 -0.09955845 [7] -0.09967497 -0.09979003 -0.09990363 -0.10001576 -0.10012641 -0.10023557 [13] -0.10034325 -0.10044942 -0.10055410 -0.10065727 -0.10075892 -0.10085905 [19] -0.10095765 -0.10105472 -0.10115026 -0.10124424 -0.10133668 -0.10142756 [25] -0.10151688 -0.10160463 -0.10169081 -0.10177541 -0.10185843 -0.10193986 [31] -0.10201969 -0.10209792 -0.10217455 -0.10224956 -0.10232296 -0.10239474 [37] -0.10246489 -0.10253341 -0.10260029 -0.10266553 -0.10272913 -0.10279107 [43] -0.10285136 -0.10290999 -0.10296695 -0.10302225 -0.10307587 -0.10312780 [49] -0.10317806 -0.10322663 -0.10327350 -0.10331868 -0.10336216 -0.10340393 [55] -0.10344400 -0.10348235 -0.10351898 -0.10355390 -0.10358708 -0.10361854 [61] -0.10364827 -0.10367626 -0.10370251 -0.10372702 -0.10374978 -0.10377079 [67] -0.10379004 -0.10380754 -0.10382327 -0.10383725 -0.10384945 -0.10385989 [73] -0.10386855 -0.10387543 -0.10388054 -0.10388386 -0.10388540 -0.10388515 [79] -0.10388311 -0.10387928 -0.10387365 -0.10386623 -0.10385700 -0.10384597 [85] -0.10383313 -0.10381849 -0.10380204 -0.10378377 -0.10376369 -0.10374179 [91] -0.10371808 -0.10369255 -0.10366519 -0.10363601 -0.10360500 -0.10357217 [97] -0.10353751 -0.10350102 -0.10346270 -0.10342254 -0.10338055 -0.10333672 [103] -0.10329106 -0.10324356 -0.10319421 -0.10314303 -0.10309001 -0.10303515 [109] -0.10297844 -0.10291988 -0.10285949 -0.10279725 -0.10273316 -0.10266722 [115] -0.10259944 -0.10252981 -0.10245833 -0.10238501 -0.10230984 -0.10223281 [121] -0.10215394 -0.10207322 -0.10199065 -0.10190624 -0.10181997 -0.10173185 [127] -0.10164189 -0.10155008 -0.10145642 -0.10136091 -0.10126356 -0.10116436 [133] -0.10106332 -0.10096042 -0.10085569 -0.10074911 -0.10064069 -0.10053042 [139] -0.10041832 -0.10030437 -0.10018859 -0.10007097 -0.09995151 -0.09983021 [145] -0.09970708 -0.09958212 -0.09945532 -0.09932670 -0.09919624 -0.09906396 [151] -0.09892986 -0.09879392 -0.09865617 -0.09851659 -0.09837520 -0.09823199 [157] -0.09808696 -0.09794012 -0.09779147 -0.09764101 -0.09748874 -0.09733467 [163] -0.09717879 -0.09702112 -0.09686164 -0.09670037 -0.09653731 -0.09637245 [169] -0.09620581 -0.09603738 -0.09586717 -0.09569518 -0.09552140 -0.09534586 [175] -0.09516854 -0.09498945 -0.09480859 -0.09462597 -0.09444159 -0.09425546 [181] -0.09406756 -0.09387792 -0.09368653 -0.09349339 -0.09329851 -0.09310189 [187] -0.09290353 -0.09270345 -0.09250163 -0.09229809 -0.09209283 -0.09188585 [193] -0.09167715 -0.09146675 -0.09125464 -0.09104082 -0.09082530 -0.09060809 [199] -0.09038919 -0.09016859 -0.08994632 -0.08972236 -0.08949673 -0.08926942 [205] -0.08904044 -0.08880981 -0.08857751 -0.08834355 -0.08810794 -0.08787069 [211] -0.08763179 -0.08739125 -0.08714908 -0.08690528 -0.08665985 -0.08641280 [217] -0.08616413 -0.08591385 -0.08566196 -0.08540847 -0.08515338 -0.08489670 [223] -0.08463843 -0.08437857 -0.08411713 -0.08385411 -0.08358953 -0.08332338 [229] -0.08305567 -0.08278640 -0.08251558 -0.08224321 -0.08196931 -0.08169386 [235] -0.08141689 -0.08113839 -0.08085836 -0.08057682 -0.08029377 -0.08000922 [241] -0.07972316 -0.07943561 -0.07914656 -0.07885603 -0.07856402 -0.07827054 [247] -0.07797558 -0.07767917 -0.07738129 -0.07708196 -0.07678118 -0.07647896 [253] -0.07617530 -0.07587021 -0.07556369 -0.07525575 -0.07494640 -0.07463563 [259] -0.07432346 -0.07400989 -0.07369493 -0.07337858 -0.07306085 -0.07274174 [265] -0.07242126 -0.07209941 -0.07177621 -0.07145165 -0.07112574 -0.07079849 [271] -0.07046990 -0.07013998 -0.06980874 -0.06947618 -0.06914230 -0.06880711 [277] -0.06847062 -0.06813284 -0.06779376 -0.06745340 -0.06711176 -0.06676884 [283] -0.06642466 -0.06607922 -0.06573252 -0.06538457 -0.06503538 -0.06468495 [289] -0.06433329 -0.06398040 -0.06362629 -0.06327097 -0.06291444 -0.06255671 [295] -0.06219778 -0.06183766 -0.06147635 -0.06111387 -0.06075021 -0.06038539 [301] -0.06001941 -0.05965228 -0.05928399 -0.05891456 -0.05854400 -0.05817231 [307] -0.05779949 -0.05742556 -0.05705051 -0.05667436 -0.05629710 -0.05591876 [313] -0.05553932 -0.05515880 -0.05477721 -0.05439455 -0.05401082 -0.05362604 [319] -0.05324020 -0.05285332 -0.05246541 -0.05207645 -0.05168647 -0.05129547 [325] -0.05090346 -0.05051043 -0.05011641 -0.04972138 -0.04932537 -0.04892837 [331] -0.04853039 -0.04813144 -0.04773153 -0.04733065 -0.04692882 -0.04652604 [337] -0.04612232 -0.04571767 -0.04531208 -0.04490557 -0.04449814 -0.04408980 [343] -0.04368056 -0.04327041 -0.04285938 -0.04244745 -0.04203464 -0.04162096 [349] -0.04120641 -0.04079100 -0.04037472 -0.03995760 -0.03953963 -0.03912082 [355] -0.03870118 -0.03828071 -0.03785942 -0.03743732 -0.03701441 -0.03659069 [361] -0.03616617 -0.03574087 -0.03531478 -0.03488791 -0.03446026 -0.03403185 [367] -0.03360268 -0.03317275 -0.03274207 -0.03231065 -0.03187849 -0.03144559 [373] -0.03101198 -0.03057764 -0.03014258 -0.02970682 -0.02927036 -0.02883320 [379] -0.02839535 -0.02795681 -0.02751759 -0.02707770 -0.02663715 -0.02619593 [385] -0.02575405 -0.02531153 -0.02486836 -0.02442455 -0.02398011 -0.02353504 [391] -0.02308935 -0.02264304 -0.02219613 -0.02174861 -0.02130049 -0.02085178 [397] -0.02040248 -0.01995260 -0.01950215 -0.01905112 -0.01859953 > mx [1] 0.1038854 > mxli [1] -1.24 > 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/rcomp/tmp/1om2j1258051698.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/rcomp/tmp/2sv7i1258051698.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/rcomp/tmp/32l6w1258051698.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4r3m91258051698.tab") > > system("convert tmp/1om2j1258051698.ps tmp/1om2j1258051698.png") > system("convert tmp/2sv7i1258051698.ps tmp/2sv7i1258051698.png") > system("convert tmp/32l6w1258051698.ps tmp/32l6w1258051698.png") > > > proc.time() user system elapsed 0.930 0.770 1.368