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(153,142,138,142,129,138,142,122,128,135,139,166,116,153,139,150,161,112,113,133,130,131,142,161,148,167,142,132,203,158,85,149,155,162,160,187,185,159,126,116,214,135,170,144,119,134,154,125,177,133,151,176,154,167,204,102,121,167,121,249,185) > x <- c(100,100,100,100,101.1,101.35,101.45,101.49,101.68,101.92,102.04,102.55,104.02,105.41,105.48,105.54,105.16,105.16,105.16,105.16,105.16,105.17,105.17,105.54,106.9,107.27,107.31,107.39,107.41,107.46,113.14,117,119.28,119.39,119.5,119.67,119.67,119.73,119.77,119.77,119.78,119.78,119.78,121.28,122.44,122.72,122.75,122.8,122.81,122.83,122.83,122.83,122.84,122.85,123.61,124.74,125.1,125.29,125.45,125.51,125.55) > #'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.2746680 0.2746753 0.2746827 0.2746900 0.2746973 0.2747046 0.2747119 [8] 0.2747192 0.2747265 0.2747337 0.2747410 0.2747482 0.2747554 0.2747627 [15] 0.2747699 0.2747770 0.2747842 0.2747914 0.2747985 0.2748056 0.2748128 [22] 0.2748199 0.2748270 0.2748340 0.2748411 0.2748482 0.2748552 0.2748622 [29] 0.2748693 0.2748763 0.2748833 0.2748902 0.2748972 0.2749042 0.2749111 [36] 0.2749180 0.2749249 0.2749318 0.2749387 0.2749456 0.2749525 0.2749593 [43] 0.2749662 0.2749730 0.2749798 0.2749866 0.2749934 0.2750002 0.2750070 [50] 0.2750137 0.2750205 0.2750272 0.2750339 0.2750406 0.2750473 0.2750540 [57] 0.2750606 0.2750673 0.2750739 0.2750806 0.2750872 0.2750938 0.2751004 [64] 0.2751070 0.2751135 0.2751201 0.2751266 0.2751331 0.2751397 0.2751462 [71] 0.2751526 0.2751591 0.2751656 0.2751720 0.2751785 0.2751849 0.2751913 [78] 0.2751977 0.2752041 0.2752105 0.2752169 0.2752232 0.2752296 0.2752359 [85] 0.2752422 0.2752485 0.2752548 0.2752611 0.2752674 0.2752736 0.2752799 [92] 0.2752861 0.2752923 0.2752985 0.2753047 0.2753109 0.2753171 0.2753232 [99] 0.2753294 0.2753355 0.2753416 0.2753477 0.2753538 0.2753599 0.2753660 [106] 0.2753720 0.2753781 0.2753841 0.2753901 0.2753961 0.2754021 0.2754081 [113] 0.2754141 0.2754201 0.2754260 0.2754319 0.2754379 0.2754438 0.2754497 [120] 0.2754556 0.2754614 0.2754673 0.2754731 0.2754790 0.2754848 0.2754906 [127] 0.2754964 0.2755022 0.2755080 0.2755138 0.2755195 0.2755253 0.2755310 [134] 0.2755367 0.2755424 0.2755481 0.2755538 0.2755594 0.2755651 0.2755707 [141] 0.2755764 0.2755820 0.2755876 0.2755932 0.2755988 0.2756044 0.2756099 [148] 0.2756155 0.2756210 0.2756265 0.2756320 0.2756375 0.2756430 0.2756485 [155] 0.2756540 0.2756594 0.2756649 0.2756703 0.2756757 0.2756811 0.2756865 [162] 0.2756919 0.2756972 0.2757026 0.2757079 0.2757133 0.2757186 0.2757239 [169] 0.2757292 0.2757345 0.2757398 0.2757450 0.2757503 0.2757555 0.2757607 [176] 0.2757659 0.2757711 0.2757763 0.2757815 0.2757867 0.2757918 0.2757970 [183] 0.2758021 0.2758072 0.2758123 0.2758174 0.2758225 0.2758276 0.2758326 [190] 0.2758377 0.2758427 0.2758477 0.2758527 0.2758577 0.2758627 0.2758677 [197] 0.2758726 0.2758776 0.2758825 0.2758875 0.2758924 0.2758973 0.2759022 [204] 0.2759071 0.2759119 0.2759168 0.2759216 0.2759265 0.2759313 0.2759361 [211] 0.2759409 0.2759457 0.2759505 0.2759552 0.2759600 0.2759647 0.2759694 [218] 0.2759742 0.2759789 0.2759836 0.2759882 0.2759929 0.2759976 0.2760022 [225] 0.2760069 0.2760115 0.2760161 0.2760207 0.2760253 0.2760299 0.2760344 [232] 0.2760390 0.2760435 0.2760480 0.2760526 0.2760571 0.2760616 0.2760661 [239] 0.2760705 0.2760750 0.2760794 0.2760839 0.2760883 0.2760927 0.2760971 [246] 0.2761015 0.2761059 0.2761103 0.2761146 0.2761190 0.2761233 0.2761276 [253] 0.2761319 0.2761362 0.2761405 0.2761448 0.2761491 0.2761533 0.2761576 [260] 0.2761618 0.2761660 0.2761702 0.2761744 0.2761786 0.2761828 0.2761869 [267] 0.2761911 0.2761952 0.2761993 0.2762035 0.2762076 0.2762117 0.2762157 [274] 0.2762198 0.2762239 0.2762279 0.2762320 0.2762360 0.2762400 0.2762440 [281] 0.2762480 0.2762520 0.2762559 0.2762599 0.2762638 0.2762678 0.2762717 [288] 0.2762756 0.2762795 0.2762834 0.2762873 0.2762911 0.2762950 0.2762988 [295] 0.2763027 0.2763065 0.2763103 0.2763141 0.2763179 0.2763217 0.2763254 [302] 0.2763292 0.2763329 0.2763367 0.2763404 0.2763441 0.2763478 0.2763515 [309] 0.2763551 0.2763588 0.2763625 0.2763661 0.2763697 0.2763733 0.2763769 [316] 0.2763805 0.2763841 0.2763877 0.2763913 0.2763948 0.2763984 0.2764019 [323] 0.2764054 0.2764089 0.2764124 0.2764159 0.2764194 0.2764228 0.2764263 [330] 0.2764297 0.2764332 0.2764366 0.2764400 0.2764434 0.2764468 0.2764501 [337] 0.2764535 0.2764568 0.2764602 0.2764635 0.2764668 0.2764701 0.2764734 [344] 0.2764767 0.2764800 0.2764833 0.2764865 0.2764898 0.2764930 0.2764962 [351] 0.2764994 0.2765026 0.2765058 0.2765090 0.2765121 0.2765153 0.2765184 [358] 0.2765216 0.2765247 0.2765278 0.2765309 0.2765340 0.2765371 0.2765401 [365] 0.2765432 0.2765462 0.2765493 0.2765523 0.2765553 0.2765583 0.2765613 [372] 0.2765643 0.2765672 0.2765702 0.2765731 0.2765761 0.2765790 0.2765819 [379] 0.2765848 0.2765877 0.2765906 0.2765934 0.2765963 0.2765991 0.2766020 [386] 0.2766048 0.2766076 0.2766104 0.2766132 0.2766160 0.2766188 0.2766215 [393] 0.2766243 0.2766270 0.2766298 0.2766325 0.2766352 0.2766379 0.2766406 [400] 0.2766432 0.2766459 > mx [1] 0.2766459 > 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/1to1w1258139296.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/2fdxq1258139296.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/3a17h1258139296.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/4hn8m1258139296.tab") > > system("convert tmp/1to1w1258139296.ps tmp/1to1w1258139296.png") > system("convert tmp/2fdxq1258139296.ps tmp/2fdxq1258139296.png") > system("convert tmp/3a17h1258139296.ps tmp/3a17h1258139296.png") > > > proc.time() user system elapsed 0.804 0.525 1.049