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(24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68) > x <- c(0.9554,0.9922,0.9778,0.9808,0.9811,1.0014,1.0183,1.0622,1.0773,1.0807,1.0848,1.1582,1.1663,1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511) > #'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.6598391 0.6599192 0.6599990 0.6600788 0.6601583 0.6602377 0.6603169 [8] 0.6603960 0.6604749 0.6605537 0.6606323 0.6607107 0.6607890 0.6608671 [15] 0.6609450 0.6610228 0.6611004 0.6611779 0.6612552 0.6613323 0.6614093 [22] 0.6614860 0.6615627 0.6616391 0.6617155 0.6617916 0.6618676 0.6619434 [29] 0.6620190 0.6620945 0.6621698 0.6622449 0.6623199 0.6623947 0.6624694 [36] 0.6625438 0.6626181 0.6626923 0.6627663 0.6628401 0.6629137 0.6629872 [43] 0.6630605 0.6631336 0.6632066 0.6632794 0.6633520 0.6634244 0.6634967 [50] 0.6635688 0.6636408 0.6637125 0.6637841 0.6638556 0.6639268 0.6639979 [57] 0.6640688 0.6641396 0.6642101 0.6642805 0.6643508 0.6644208 0.6644907 [64] 0.6645604 0.6646300 0.6646993 0.6647685 0.6648375 0.6649064 0.6649750 [71] 0.6650435 0.6651118 0.6651800 0.6652480 0.6653158 0.6653834 0.6654508 [78] 0.6655181 0.6655852 0.6656521 0.6657188 0.6657854 0.6658518 0.6659180 [85] 0.6659840 0.6660499 0.6661156 0.6661811 0.6662464 0.6663115 0.6663765 [92] 0.6664413 0.6665059 0.6665703 0.6666346 0.6666987 0.6667626 0.6668263 [99] 0.6668898 0.6669532 0.6670164 0.6670794 0.6671422 0.6672048 0.6672673 [106] 0.6673295 0.6673916 0.6674536 0.6675153 0.6675768 0.6676382 0.6676994 [113] 0.6677604 0.6678212 0.6678819 0.6679423 0.6680026 0.6680627 0.6681226 [120] 0.6681823 0.6682419 0.6683013 0.6683604 0.6684194 0.6684782 0.6685369 [127] 0.6685953 0.6686536 0.6687116 0.6687695 0.6688272 0.6688848 0.6689421 [134] 0.6689992 0.6690562 0.6691130 0.6691696 0.6692260 0.6692822 0.6693382 [141] 0.6693941 0.6694498 0.6695052 0.6695605 0.6696156 0.6696705 0.6697253 [148] 0.6697798 0.6698342 0.6698883 0.6699423 0.6699961 0.6700497 0.6701031 [155] 0.6701563 0.6702094 0.6702622 0.6703149 0.6703673 0.6704196 0.6704717 [162] 0.6705236 0.6705753 0.6706269 0.6706782 0.6707293 0.6707803 0.6708310 [169] 0.6708816 0.6709320 0.6709822 0.6710322 0.6710820 0.6711316 0.6711810 [176] 0.6712303 0.6712793 0.6713282 0.6713768 0.6714253 0.6714736 0.6715217 [183] 0.6715696 0.6716173 0.6716648 0.6717121 0.6717592 0.6718062 0.6718529 [190] 0.6718994 0.6719458 0.6719920 0.6720379 0.6720837 0.6721293 0.6721747 [197] 0.6722199 0.6722649 0.6723097 0.6723543 0.6723987 0.6724429 0.6724869 [204] 0.6725308 0.6725744 0.6726179 0.6726611 0.6727042 0.6727470 0.6727897 [211] 0.6728321 0.6728744 0.6729165 0.6729584 0.6730001 0.6730416 0.6730828 [218] 0.6731239 0.6731648 0.6732056 0.6732461 0.6732864 0.6733265 0.6733664 [225] 0.6734061 0.6734457 0.6734850 0.6735241 0.6735631 0.6736018 0.6736403 [232] 0.6736787 0.6737168 0.6737548 0.6737925 0.6738301 0.6738674 0.6739046 [239] 0.6739416 0.6739783 0.6740149 0.6740513 0.6740874 0.6741234 0.6741592 [246] 0.6741947 0.6742301 0.6742653 0.6743003 0.6743350 0.6743696 0.6744040 [253] 0.6744382 0.6744722 0.6745059 0.6745395 0.6745729 0.6746061 0.6746391 [260] 0.6746719 0.6747044 0.6747368 0.6747690 0.6748010 0.6748328 0.6748644 [267] 0.6748958 0.6749270 0.6749579 0.6749887 0.6750193 0.6750497 0.6750799 [274] 0.6751099 0.6751397 0.6751692 0.6751986 0.6752278 0.6752568 0.6752856 [281] 0.6753142 0.6753425 0.6753707 0.6753987 0.6754265 0.6754540 0.6754814 [288] 0.6755086 0.6755356 0.6755623 0.6755889 0.6756153 0.6756414 0.6756674 [295] 0.6756932 0.6757187 0.6757441 0.6757692 0.6757942 0.6758190 0.6758435 [302] 0.6758679 0.6758920 0.6759160 0.6759397 0.6759633 0.6759866 0.6760097 [309] 0.6760327 0.6760554 0.6760779 0.6761003 0.6761224 0.6761443 0.6761661 [316] 0.6761876 0.6762089 0.6762300 0.6762509 0.6762717 0.6762922 0.6763125 [323] 0.6763326 0.6763525 0.6763722 0.6763917 0.6764110 0.6764301 0.6764490 [330] 0.6764677 0.6764862 0.6765044 0.6765225 0.6765404 0.6765581 0.6765755 [337] 0.6765928 0.6766099 0.6766267 0.6766434 0.6766599 0.6766761 0.6766922 [344] 0.6767080 0.6767237 0.6767391 0.6767544 0.6767694 0.6767843 0.6767989 [351] 0.6768133 0.6768275 0.6768416 0.6768554 0.6768690 0.6768824 0.6768957 [358] 0.6769087 0.6769215 0.6769341 0.6769465 0.6769587 0.6769707 0.6769825 [365] 0.6769941 0.6770055 0.6770167 0.6770276 0.6770384 0.6770490 0.6770594 [372] 0.6770696 0.6770795 0.6770893 0.6770989 0.6771082 0.6771174 0.6771264 [379] 0.6771351 0.6771437 0.6771520 0.6771602 0.6771681 0.6771758 0.6771834 [386] 0.6771907 0.6771979 0.6772048 0.6772115 0.6772181 0.6772244 0.6772305 [393] 0.6772364 0.6772422 0.6772477 0.6772530 0.6772581 0.6772630 0.6772677 [400] 0.6772722 0.6772765 > mx [1] 0.6772765 > 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/17f6i1226441419.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/2pvhc1226441419.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/3vbqy1226441419.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/4m5sx1226441419.tab") > > system("convert tmp/17f6i1226441419.ps tmp/17f6i1226441419.png") > system("convert tmp/2pvhc1226441419.ps tmp/2pvhc1226441419.png") > system("convert tmp/3vbqy1226441419.ps tmp/3vbqy1226441419.png") > > > proc.time() user system elapsed 0.991 0.488 1.134