R version 2.7.0 (2008-04-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(13.92,13.22,13.31,12.91,13.19,12.92,13.43,13.72,13.97,14.91,14.46,14.12,14.23,15.04,14.80,14.49,15.14,14.34,15.12,15.14,14.34,14.36,14.91,15.56,16.50,15.57,15.14,15.19,15.07,14.48,14.27,14.72,14.65,14.38,13.95,14.85,14.87,14.83,15.03,15.47,16.21,16.55,17.04,17.22,17.47,17.75,17.84,18.47,18.38,18.55,18.39,18.88,20.21,19.67,20.09,18.78,19.74,20.64,20.34,21.75,22.10,22.81,22.91,22.46,21.78,25.05,23.70,23.02,24.34,24.15,25.85,26.42,26.54,26.36,26.99,27.52,26.63,26.26,24.86,26.84,26.57,24.67,27.24,27.77,27.61,27.27,28.46,26.97,29.95,29.88,29.67,31.19,30.24,30.03,31.02,30.45,31.70,32.10,32.32,32.18,33.43,33.07,35.32,35.17,35.29,37.89,38.32,37.07,39.77,39.20,40.46,44.95,41.69,41.88,45.86) > x <- c(13.92,13.22,13.31,12.91,13.19,12.92,13.43,13.72,13.97,14.91,14.46,14.12,14.23,15.04,14.80,14.49,15.14,14.34,15.12,15.14,14.34,14.36,14.91,15.56,16.50,15.57,15.14,15.19,15.07,14.48,14.27,14.72,14.65,14.38,13.95,14.85,14.87,14.83,15.03,15.47,16.21,16.55,17.04,17.22,17.47,17.75,17.84,18.47,18.38,18.55,18.39,18.88,20.21,19.67,20.09,18.78,19.74,20.64,20.34,21.75,22.10,22.81,22.91,22.46,21.78,25.05,23.70,23.02,24.34,24.15,25.85,26.42,26.54,26.36,26.99,27.52,26.63,26.26,24.86,26.84,26.57,24.67,27.24,27.77,27.61,27.27,28.46,26.97,29.95,29.88,29.67,31.19,30.24,30.03,31.02,30.45,31.70,32.10,32.32,32.18,33.43,33.07,35.32,35.17,35.29,37.89,38.32,37.07,39.77,39.20,40.46,44.95,41.69,41.88,45.86) > #'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.9120341 0.9124763 0.9129183 0.9133601 0.9138018 0.9142433 0.9146846 [8] 0.9151257 0.9155666 0.9160074 0.9164479 0.9168882 0.9173283 0.9177682 [15] 0.9182078 0.9186472 0.9190863 0.9195253 0.9199639 0.9204023 0.9208404 [22] 0.9212783 0.9217158 0.9221531 0.9225901 0.9230268 0.9234632 0.9238992 [29] 0.9243350 0.9247704 0.9252055 0.9256402 0.9260746 0.9265087 0.9269424 [36] 0.9273757 0.9278086 0.9282412 0.9286733 0.9291051 0.9295364 0.9299674 [43] 0.9303979 0.9308280 0.9312577 0.9316869 0.9321157 0.9325440 0.9329719 [50] 0.9333993 0.9338262 0.9342526 0.9346785 0.9351039 0.9355288 0.9359532 [57] 0.9363771 0.9368004 0.9372232 0.9376454 0.9380671 0.9384882 0.9389087 [64] 0.9393286 0.9397480 0.9401667 0.9405849 0.9410024 0.9414193 0.9418355 [71] 0.9422511 0.9426661 0.9430804 0.9434940 0.9439070 0.9443192 0.9447308 [78] 0.9451416 0.9455518 0.9459612 0.9463699 0.9467778 0.9471850 0.9475915 [85] 0.9479971 0.9484020 0.9488061 0.9492094 0.9496119 0.9500136 0.9504144 [92] 0.9508144 0.9512136 0.9516119 0.9520094 0.9524060 0.9528017 0.9531965 [99] 0.9535904 0.9539834 0.9543754 0.9547666 0.9551568 0.9555460 0.9559343 [106] 0.9563216 0.9567079 0.9570932 0.9574776 0.9578609 0.9582432 0.9586244 [113] 0.9590047 0.9593838 0.9597619 0.9601390 0.9605149 0.9608898 0.9612635 [120] 0.9616361 0.9620076 0.9623780 0.9627472 0.9631153 0.9634822 0.9638479 [127] 0.9642124 0.9645757 0.9649379 0.9652987 0.9656584 0.9660168 0.9663740 [134] 0.9667299 0.9670845 0.9674378 0.9677899 0.9681406 0.9684900 0.9688381 [141] 0.9691848 0.9695302 0.9698742 0.9702169 0.9705582 0.9708980 0.9712365 [148] 0.9715735 0.9719092 0.9722433 0.9725761 0.9729073 0.9732371 0.9735654 [155] 0.9738922 0.9742175 0.9745413 0.9748636 0.9751843 0.9755034 0.9758210 [162] 0.9761371 0.9764515 0.9767644 0.9770756 0.9773852 0.9776932 0.9779996 [169] 0.9783043 0.9786073 0.9789087 0.9792083 0.9795063 0.9798026 0.9800971 [176] 0.9803900 0.9806811 0.9809704 0.9812580 0.9815438 0.9818278 0.9821100 [183] 0.9823904 0.9826690 0.9829457 0.9832207 0.9834937 0.9837649 0.9840343 [190] 0.9843017 0.9845673 0.9848309 0.9850927 0.9853525 0.9856103 0.9858662 [197] 0.9861202 0.9863722 0.9866222 0.9868702 0.9871162 0.9873602 0.9876022 [204] 0.9878422 0.9880800 0.9883159 0.9885497 0.9887814 0.9890110 0.9892385 [211] 0.9894639 0.9896872 0.9899084 0.9901274 0.9903443 0.9905590 0.9907716 [218] 0.9909820 0.9911902 0.9913962 0.9915999 0.9918015 0.9920009 0.9921980 [225] 0.9923928 0.9925854 0.9927758 0.9929639 0.9931496 0.9933331 0.9935143 [232] 0.9936932 0.9938698 0.9940440 0.9942159 0.9943854 0.9945526 0.9947174 [239] 0.9948798 0.9950399 0.9951976 0.9953528 0.9955057 0.9956561 0.9958042 [246] 0.9959497 0.9960929 0.9962336 0.9963718 0.9965075 0.9966408 0.9967716 [253] 0.9969000 0.9970258 0.9971491 0.9972699 0.9973882 0.9975039 0.9976171 [260] 0.9977278 0.9978359 0.9979415 0.9980445 0.9981449 0.9982428 0.9983381 [267] 0.9984307 0.9985208 0.9986083 0.9986932 0.9987754 0.9988551 0.9989321 [274] 0.9990065 0.9990782 0.9991473 0.9992137 0.9992775 0.9993386 0.9993971 [281] 0.9994529 0.9995060 0.9995564 0.9996041 0.9996492 0.9996915 0.9997311 [288] 0.9997681 0.9998023 0.9998338 0.9998626 0.9998886 0.9999120 0.9999326 [295] 0.9999504 0.9999656 0.9999780 0.9999876 0.9999945 0.9999986 1.0000000 [302] 0.9999986 0.9999945 0.9999876 0.9999779 0.9999654 0.9999502 0.9999322 [309] 0.9999115 0.9998879 0.9998616 0.9998325 0.9998006 0.9997659 0.9997284 [316] 0.9996881 0.9996451 0.9995992 0.9995506 0.9994991 0.9994449 0.9993879 [323] 0.9993280 0.9992654 0.9992000 0.9991318 0.9990607 0.9989869 0.9989103 [330] 0.9988309 0.9987486 0.9986636 0.9985758 0.9984852 0.9983918 0.9982956 [337] 0.9981966 0.9980948 0.9979902 0.9978828 0.9977727 0.9976597 0.9975440 [344] 0.9974255 0.9973042 0.9971801 0.9970532 0.9969236 0.9967911 0.9966560 [351] 0.9965180 0.9963773 0.9962338 0.9960875 0.9959385 0.9957868 0.9956323 [358] 0.9954750 0.9953150 0.9951523 0.9949868 0.9948186 0.9946476 0.9944740 [365] 0.9942976 0.9941185 0.9939367 0.9937521 0.9935649 0.9933750 0.9931823 [372] 0.9929870 0.9927890 0.9925884 0.9923850 0.9921790 0.9919703 0.9917590 [379] 0.9915450 0.9913283 0.9911091 0.9908871 0.9906626 0.9904354 0.9902057 [386] 0.9899733 0.9897383 0.9895007 0.9892605 0.9890177 0.9887724 0.9885245 [393] 0.9882740 0.9880210 0.9877654 0.9875072 0.9872466 0.9869834 0.9867177 [400] 0.9864495 0.9861787 > mx [1] 1 > mxli [1] 1 > 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/1gd9p1226434692.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/22vn81226434692.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/3hw0f1226434692.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/4wpf61226434692.tab") > > system("convert tmp/1gd9p1226434692.ps tmp/1gd9p1226434692.png") > system("convert tmp/22vn81226434692.ps tmp/22vn81226434692.png") > system("convert tmp/3hw0f1226434692.ps tmp/3hw0f1226434692.png") > > > proc.time() user system elapsed 1.896 0.864 2.030