R version 2.7.2 (2008-08-25) 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(12055,12113,9617,12646,13581,12162,10970,11880,11888,12927,12300,12093,12381,12197,9455,13168,13428,11981,11885,11692,12234,14341,13131,12421,14286,12865,11160,14316,14389,14014,13419,12770,13316,15333,14243,13824,14963,13203,12199,15509,14200,15170,14058,13786,14148,16542,13588,15582,15803,14131,12923,15612,16034,16037,14038,15331,15038,17402,14993,16044,16930,15921,14417,15961,17852,16484,14216,17430,17840,17629) > x <- c(15107,15024,12083,15761,16943,15070,13660,14769,14725,15998,15371,14957,15470,15102,11704,16284,16727,14969,14861,14583,15306,17904,16379,15420,17871,15913,13867,17823,17872,17422,16705,15991,16584,19124,17839,17209,18587,16258,15142,19202,17747,19090,18040,17516,17752,21073,17170,19440,19795,17575,16165,19465,19932,19961,17343,18924,18574,21351,18595,19823,20844,19640,17735,19814,22239,20682,17819,21872,22117,21866) > #'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.9561217 0.9564136 0.9567045 0.9569943 0.9572831 0.9575708 0.9578575 [8] 0.9581431 0.9584276 0.9587111 0.9589936 0.9592750 0.9595553 0.9598346 [15] 0.9601128 0.9603900 0.9606661 0.9609411 0.9612151 0.9614880 0.9617599 [22] 0.9620307 0.9623005 0.9625692 0.9628368 0.9631034 0.9633689 0.9636334 [29] 0.9638967 0.9641591 0.9644204 0.9646806 0.9649397 0.9651978 0.9654548 [36] 0.9657108 0.9659657 0.9662196 0.9664723 0.9667241 0.9669747 0.9672243 [43] 0.9674729 0.9677204 0.9679668 0.9682121 0.9684564 0.9686997 0.9689418 [50] 0.9691830 0.9694230 0.9696620 0.9698999 0.9701368 0.9703726 0.9706074 [57] 0.9708411 0.9710737 0.9713053 0.9715358 0.9717653 0.9719937 0.9722210 [64] 0.9724473 0.9726725 0.9728967 0.9731198 0.9733419 0.9735629 0.9737829 [71] 0.9740017 0.9742196 0.9744364 0.9746521 0.9748668 0.9750804 0.9752930 [78] 0.9755045 0.9757150 0.9759244 0.9761327 0.9763401 0.9765463 0.9767515 [85] 0.9769557 0.9771588 0.9773609 0.9775619 0.9777619 0.9779609 0.9781587 [92] 0.9783556 0.9785514 0.9787461 0.9789399 0.9791325 0.9793242 0.9795147 [99] 0.9797043 0.9798928 0.9800803 0.9802667 0.9804521 0.9806365 0.9808198 [106] 0.9810021 0.9811833 0.9813636 0.9815427 0.9817209 0.9818980 0.9820741 [113] 0.9822492 0.9824232 0.9825962 0.9827682 0.9829392 0.9831091 0.9832780 [120] 0.9834459 0.9836128 0.9837786 0.9839434 0.9841072 0.9842700 0.9844318 [127] 0.9845925 0.9847523 0.9849110 0.9850687 0.9852254 0.9853810 0.9855357 [134] 0.9856894 0.9858420 0.9859936 0.9861443 0.9862939 0.9864425 0.9865901 [141] 0.9867367 0.9868824 0.9870270 0.9871706 0.9873132 0.9874548 0.9875954 [148] 0.9877350 0.9878737 0.9880113 0.9881480 0.9882836 0.9884183 0.9885519 [155] 0.9886846 0.9888163 0.9889471 0.9890768 0.9892055 0.9893333 0.9894601 [162] 0.9895859 0.9897107 0.9898346 0.9899575 0.9900794 0.9902003 0.9903203 [169] 0.9904393 0.9905573 0.9906744 0.9907904 0.9909056 0.9910197 0.9911329 [176] 0.9912452 0.9913564 0.9914668 0.9915761 0.9916845 0.9917920 0.9918985 [183] 0.9920040 0.9921086 0.9922122 0.9923149 0.9924167 0.9925175 0.9926174 [190] 0.9927163 0.9928142 0.9929113 0.9930074 0.9931025 0.9931968 0.9932901 [197] 0.9933824 0.9934738 0.9935643 0.9936539 0.9937425 0.9938303 0.9939170 [204] 0.9940029 0.9940879 0.9941719 0.9942550 0.9943372 0.9944185 0.9944988 [211] 0.9945783 0.9946568 0.9947344 0.9948111 0.9948870 0.9949619 0.9950359 [218] 0.9951090 0.9951812 0.9952525 0.9953229 0.9953924 0.9954610 0.9955287 [225] 0.9955955 0.9956615 0.9957265 0.9957907 0.9958539 0.9959163 0.9959778 [232] 0.9960385 0.9960982 0.9961571 0.9962151 0.9962722 0.9963284 0.9963838 [239] 0.9964383 0.9964919 0.9965447 0.9965966 0.9966476 0.9966978 0.9967471 [246] 0.9967956 0.9968431 0.9968899 0.9969358 0.9969808 0.9970250 0.9970683 [253] 0.9971108 0.9971524 0.9971932 0.9972332 0.9972723 0.9973105 0.9973479 [260] 0.9973845 0.9974203 0.9974552 0.9974893 0.9975226 0.9975550 0.9975866 [267] 0.9976173 0.9976473 0.9976764 0.9977047 0.9977322 0.9977589 0.9977847 [274] 0.9978098 0.9978340 0.9978574 0.9978800 0.9979018 0.9979228 0.9979430 [281] 0.9979624 0.9979810 0.9979987 0.9980157 0.9980319 0.9980473 0.9980619 [288] 0.9980757 0.9980887 0.9981009 0.9981124 0.9981230 0.9981329 0.9981420 [295] 0.9981503 0.9981578 0.9981646 0.9981706 0.9981758 0.9981802 0.9981839 [302] 0.9981868 0.9981889 0.9981903 0.9981909 0.9981907 0.9981898 0.9981881 [309] 0.9981857 0.9981825 0.9981785 0.9981738 0.9981684 0.9981622 0.9981552 [316] 0.9981475 0.9981391 0.9981299 0.9981200 0.9981093 0.9980979 0.9980858 [323] 0.9980729 0.9980593 0.9980450 0.9980300 0.9980142 0.9979977 0.9979804 [330] 0.9979625 0.9979438 0.9979244 0.9979043 0.9978834 0.9978619 0.9978396 [337] 0.9978167 0.9977930 0.9977686 0.9977435 0.9977177 0.9976912 0.9976640 [344] 0.9976361 0.9976075 0.9975782 0.9975482 0.9975175 0.9974861 0.9974541 [351] 0.9974213 0.9973879 0.9973537 0.9973189 0.9972834 0.9972473 0.9972104 [358] 0.9971729 0.9971347 0.9970958 0.9970563 0.9970160 0.9969752 0.9969336 [365] 0.9968914 0.9968485 0.9968050 0.9967607 0.9967159 0.9966704 0.9966242 [372] 0.9965773 0.9965299 0.9964817 0.9964329 0.9963835 0.9963334 0.9962827 [379] 0.9962313 0.9961793 0.9961267 0.9960734 0.9960194 0.9959649 0.9959097 [386] 0.9958539 0.9957974 0.9957403 0.9956826 0.9956243 0.9955653 0.9955057 [393] 0.9954455 0.9953847 0.9953233 0.9952612 0.9951985 0.9951352 0.9950713 [400] 0.9950068 0.9949417 > mx [1] 0.9981909 > mxli [1] 1.04 > 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/1yjmh1226252366.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/2wrjd1226252366.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/3yee01226252366.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/40ruq1226252366.tab") > > system("convert tmp/1yjmh1226252366.ps tmp/1yjmh1226252366.png") > system("convert tmp/2wrjd1226252366.ps tmp/2wrjd1226252366.png") > system("convert tmp/3yee01226252366.ps tmp/3yee01226252366.png") > > > proc.time() user system elapsed 0.983 0.504 2.145