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(133.52,153.2,163.63,168.45,166.26,162.31,161.56,156.59,157.97,158.68,163.55,162.89,164.95,159.82,159.05,166.76,164.55,163.22,160.68,155.24,157.6,156.56,154.82,151.11,149.65,148.99,148.53,146.7,145.11,142.7,143.59,140.96,140.77,139.81,140.58,139.59,138.05,136.06,135.98,134.75,132.22,135.37,138.84,138.83,136.55,135.63,139.14,136.09,135.97,134.51,134.54,134.08,132.86,134.48,129.08,133.13,134.78,134.13,132.43,127.84,128.12,128.94,132.38,134.99,138.05,135.83,130.12,128.16,128.6,126.12,124.2,121.65,121.57,118.38) > x <- c(1.3322,1.4369,1.4975,1.577,1.5553,1.5557,1.575,1.5527,1.4748,1.4718,1.457,1.4684,1.4227,1.3896,1.3622,1.3716,1.3419,1.3511,1.3516,1.3242,1.3074,1.2999,1.3213,1.2881,1.2611,1.2727,1.2811,1.2684,1.265,1.277,1.2271,1.202,1.1938,1.2103,1.1856,1.1786,1.2015,1.2256,1.2292,1.2037,1.2165,1.2694,1.2938,1.3201,1.3014,1.3119,1.3408,1.2991,1.249,1.2218,1.2176,1.2266,1.2138,1.2007,1.1985,1.2262,1.2646,1.2613,1.2286,1.1702,1.1692,1.1222,1.1139,1.1372,1.1663,1.1582,1.0848,1.0807,1.0773,1.0622,1.0183,1.0014,0.9811,0.9808) > #'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.8425751 0.8427382 0.8429008 0.8430628 0.8432244 0.8433854 0.8435458 [8] 0.8437058 0.8438652 0.8440240 0.8441824 0.8443402 0.8444975 0.8446542 [15] 0.8448104 0.8449661 0.8451212 0.8452758 0.8454298 0.8455834 0.8457363 [22] 0.8458888 0.8460406 0.8461920 0.8463428 0.8464931 0.8466428 0.8467919 [29] 0.8469406 0.8470886 0.8472362 0.8473832 0.8475296 0.8476755 0.8478208 [36] 0.8479656 0.8481098 0.8482535 0.8483967 0.8485392 0.8486813 0.8488227 [43] 0.8489637 0.8491040 0.8492438 0.8493831 0.8495218 0.8496599 0.8497975 [50] 0.8499345 0.8500709 0.8502068 0.8503422 0.8504769 0.8506111 0.8507448 [57] 0.8508779 0.8510104 0.8511423 0.8512737 0.8514046 0.8515348 0.8516645 [64] 0.8517936 0.8519222 0.8520502 0.8521776 0.8523044 0.8524307 0.8525564 [71] 0.8526816 0.8528061 0.8529301 0.8530536 0.8531764 0.8532987 0.8534204 [78] 0.8535415 0.8536621 0.8537821 0.8539015 0.8540203 0.8541386 0.8542562 [85] 0.8543733 0.8544899 0.8546058 0.8547212 0.8548359 0.8549501 0.8550638 [92] 0.8551768 0.8552893 0.8554012 0.8555125 0.8556232 0.8557333 0.8558429 [99] 0.8559518 0.8560602 0.8561680 0.8562752 0.8563819 0.8564879 0.8565934 [106] 0.8566983 0.8568025 0.8569062 0.8570094 0.8571119 0.8572138 0.8573152 [113] 0.8574160 0.8575161 0.8576157 0.8577147 0.8578131 0.8579110 0.8580082 [120] 0.8581048 0.8582009 0.8582963 0.8583912 0.8584855 0.8585792 0.8586723 [127] 0.8587648 0.8588567 0.8589480 0.8590387 0.8591288 0.8592184 0.8593073 [134] 0.8593957 0.8594834 0.8595706 0.8596572 0.8597431 0.8598285 0.8599133 [141] 0.8599975 0.8600811 0.8601641 0.8602465 0.8603283 0.8604095 0.8604901 [148] 0.8605701 0.8606495 0.8607284 0.8608066 0.8608842 0.8609613 0.8610377 [155] 0.8611135 0.8611888 0.8612634 0.8613375 0.8614109 0.8614838 0.8615560 [162] 0.8616277 0.8616987 0.8617692 0.8618390 0.8619083 0.8619770 0.8620450 [169] 0.8621125 0.8621794 0.8622456 0.8623113 0.8623764 0.8624408 0.8625047 [176] 0.8625680 0.8626307 0.8626927 0.8627542 0.8628151 0.8628754 0.8629351 [183] 0.8629941 0.8630526 0.8631105 0.8631678 0.8632245 0.8632806 0.8633361 [190] 0.8633909 0.8634452 0.8634989 0.8635520 0.8636045 0.8636564 0.8637077 [197] 0.8637584 0.8638085 0.8638580 0.8639069 0.8639552 0.8640029 0.8640500 [204] 0.8640966 0.8641425 0.8641878 0.8642325 0.8642766 0.8643202 0.8643631 [211] 0.8644054 0.8644472 0.8644883 0.8645288 0.8645688 0.8646081 0.8646469 [218] 0.8646851 0.8647226 0.8647596 0.8647960 0.8648317 0.8648669 0.8649015 [225] 0.8649355 0.8649689 0.8650017 0.8650339 0.8650655 0.8650965 0.8651270 [232] 0.8651568 0.8651861 0.8652147 0.8652428 0.8652702 0.8652971 0.8653234 [239] 0.8653491 0.8653742 0.8653987 0.8654226 0.8654459 0.8654687 0.8654908 [246] 0.8655124 0.8655333 0.8655537 0.8655735 0.8655927 0.8656113 0.8656293 [253] 0.8656468 0.8656636 0.8656799 0.8656956 0.8657107 0.8657252 0.8657391 [260] 0.8657524 0.8657652 0.8657774 0.8657889 0.8657999 0.8658104 0.8658202 [267] 0.8658294 0.8658381 0.8658462 0.8658537 0.8658606 0.8658670 0.8658727 [274] 0.8658779 0.8658825 0.8658865 0.8658900 0.8658928 0.8658951 0.8658968 [281] 0.8658980 0.8658985 0.8658985 0.8658979 0.8658967 0.8658950 0.8658927 [288] 0.8658898 0.8658863 0.8658823 0.8658777 0.8658725 0.8658667 0.8658604 [295] 0.8658535 0.8658460 0.8658380 0.8658294 0.8658202 0.8658105 0.8658002 [302] 0.8657893 0.8657778 0.8657658 0.8657532 0.8657401 0.8657264 0.8657121 [309] 0.8656973 0.8656819 0.8656659 0.8656494 0.8656323 0.8656147 0.8655965 [316] 0.8655777 0.8655584 0.8655385 0.8655180 0.8654970 0.8654755 0.8654534 [323] 0.8654307 0.8654075 0.8653837 0.8653594 0.8653345 0.8653090 0.8652830 [330] 0.8652565 0.8652294 0.8652018 0.8651736 0.8651448 0.8651155 0.8650857 [337] 0.8650553 0.8650243 0.8649929 0.8649608 0.8649283 0.8648951 0.8648615 [344] 0.8648273 0.8647925 0.8647572 0.8647214 0.8646850 0.8646481 0.8646107 [351] 0.8645727 0.8645342 0.8644951 0.8644555 0.8644154 0.8643747 0.8643335 [358] 0.8642917 0.8642495 0.8642067 0.8641633 0.8641195 0.8640751 0.8640301 [365] 0.8639847 0.8639387 0.8638922 0.8638451 0.8637976 0.8637495 0.8637009 [372] 0.8636517 0.8636021 0.8635519 0.8635012 0.8634499 0.8633982 0.8633459 [379] 0.8632931 0.8632398 0.8631860 0.8631317 0.8630768 0.8630215 0.8629656 [386] 0.8629092 0.8628523 0.8627948 0.8627369 0.8626785 0.8626195 0.8625601 [393] 0.8625001 0.8624396 0.8623786 0.8623171 0.8622551 0.8621926 0.8621296 [400] 0.8620661 0.8620021 > mx [1] 0.8658985 > mxli [1] 0.81 > 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/1qxda1226564365.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/23s5o1226564365.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/3obdc1226564365.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/4fwkv1226564365.tab") > > system("convert tmp/1qxda1226564365.ps tmp/1qxda1226564365.png") > system("convert tmp/23s5o1226564365.ps tmp/23s5o1226564365.png") > system("convert tmp/3obdc1226564365.ps tmp/3obdc1226564365.png") > > > proc.time() user system elapsed 1.012 0.523 1.379