R version 2.8.0 (2008-10-20) 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(109.86,108.68,113.38,117.12,116.23,114.75,115.81,115.86,117.8,117.11,116.31,118.38,121.57,121.65,124.2,126.12,128.6,128.16,130.12,135.83,138.05,134.99,132.38,128.94,128.12,127.84,132.43,134.13,134.78,133.13,129.08,134.48,132.86,134.08,134.54,134.51,135.97,136.09,139.14,135.63,136.55,138.83,138.84,135.37,132.22,134.75,135.98,136.06,138.05,139.59,140.58,139.81,140.77,140.96,143.59,142.7,145.11,146.7,148.53,148.99,149.65,151.11,154.82,156.56,157.6,155.24,160.68,163.22,164.55,166.76,159.05,159.82,164.95,162.89) > x <- c(0.9059,0.8883,0.8924,0.8833,0.87,0.8758,0.8858,0.917,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,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684) > #'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.8503200 0.8505140 0.8507078 0.8509014 0.8510948 0.8512881 0.8514812 [8] 0.8516741 0.8518669 0.8520595 0.8522519 0.8524442 0.8526362 0.8528281 [15] 0.8530199 0.8532114 0.8534028 0.8535940 0.8537850 0.8539759 0.8541665 [22] 0.8543570 0.8545473 0.8547375 0.8549274 0.8551172 0.8553067 0.8554961 [29] 0.8556853 0.8558744 0.8560632 0.8562518 0.8564403 0.8566286 0.8568167 [36] 0.8570046 0.8571922 0.8573798 0.8575671 0.8577542 0.8579411 0.8581279 [43] 0.8583144 0.8585007 0.8586869 0.8588728 0.8590586 0.8592441 0.8594294 [50] 0.8596146 0.8597995 0.8599843 0.8601688 0.8603531 0.8605373 0.8607212 [57] 0.8609049 0.8610884 0.8612717 0.8614548 0.8616377 0.8618203 0.8620028 [64] 0.8621850 0.8623671 0.8625489 0.8627305 0.8629119 0.8630931 0.8632740 [71] 0.8634548 0.8636353 0.8638156 0.8639957 0.8641756 0.8643552 0.8645346 [78] 0.8647138 0.8648928 0.8650716 0.8652501 0.8654284 0.8656065 0.8657843 [85] 0.8659619 0.8661393 0.8663165 0.8664934 0.8666701 0.8668466 0.8670228 [92] 0.8671988 0.8673746 0.8675501 0.8677254 0.8679005 0.8680753 0.8682499 [99] 0.8684243 0.8685984 0.8687722 0.8689459 0.8691193 0.8692924 0.8694653 [106] 0.8696380 0.8698104 0.8699825 0.8701545 0.8703261 0.8704976 0.8706688 [113] 0.8708397 0.8710104 0.8711808 0.8713510 0.8715209 0.8716906 0.8718600 [120] 0.8720292 0.8721981 0.8723667 0.8725351 0.8727032 0.8728711 0.8730388 [127] 0.8732061 0.8733732 0.8735401 0.8737066 0.8738730 0.8740390 0.8742048 [134] 0.8743703 0.8745356 0.8747006 0.8748653 0.8750297 0.8751939 0.8753578 [141] 0.8755215 0.8756849 0.8758480 0.8760108 0.8761734 0.8763357 0.8764977 [148] 0.8766594 0.8768209 0.8769821 0.8771430 0.8773036 0.8774639 0.8776240 [155] 0.8777838 0.8779433 0.8781025 0.8782615 0.8784201 0.8785785 0.8787366 [162] 0.8788944 0.8790519 0.8792092 0.8793661 0.8795228 0.8796791 0.8798352 [169] 0.8799910 0.8801465 0.8803017 0.8804566 0.8806112 0.8807656 0.8809196 [176] 0.8810733 0.8812268 0.8813799 0.8815327 0.8816853 0.8818375 0.8819895 [183] 0.8821411 0.8822925 0.8824435 0.8825943 0.8827447 0.8828948 0.8830446 [190] 0.8831942 0.8833434 0.8834923 0.8836409 0.8837892 0.8839372 0.8840849 [197] 0.8842322 0.8843793 0.8845260 0.8846724 0.8848186 0.8849644 0.8851099 [204] 0.8852550 0.8853999 0.8855444 0.8856886 0.8858326 0.8859761 0.8861194 [211] 0.8862624 0.8864050 0.8865473 0.8866893 0.8868309 0.8869723 0.8871133 [218] 0.8872540 0.8873944 0.8875344 0.8876741 0.8878135 0.8879526 0.8880913 [225] 0.8882297 0.8883678 0.8885055 0.8886429 0.8887800 0.8889167 0.8890532 [232] 0.8891892 0.8893250 0.8894604 0.8895955 0.8897302 0.8898646 0.8899987 [239] 0.8901324 0.8902658 0.8903988 0.8905315 0.8906639 0.8907959 0.8909276 [246] 0.8910590 0.8911899 0.8913206 0.8914509 0.8915809 0.8917105 0.8918398 [253] 0.8919687 0.8920973 0.8922255 0.8923534 0.8924809 0.8926081 0.8927349 [260] 0.8928614 0.8929875 0.8931133 0.8932387 0.8933638 0.8934885 0.8936128 [267] 0.8937368 0.8938605 0.8939838 0.8941067 0.8942293 0.8943515 0.8944734 [274] 0.8945949 0.8947160 0.8948368 0.8949572 0.8950772 0.8951969 0.8953163 [281] 0.8954352 0.8955538 0.8956721 0.8957899 0.8959074 0.8960246 0.8961413 [288] 0.8962577 0.8963738 0.8964894 0.8966047 0.8967197 0.8968342 0.8969484 [295] 0.8970622 0.8971757 0.8972887 0.8974014 0.8975137 0.8976257 0.8977373 [302] 0.8978485 0.8979593 0.8980697 0.8981798 0.8982895 0.8983988 0.8985077 [309] 0.8986163 0.8987245 0.8988323 0.8989397 0.8990467 0.8991534 0.8992596 [316] 0.8993655 0.8994710 0.8995762 0.8996809 0.8997852 0.8998892 0.8999928 [323] 0.9000960 0.9001988 0.9003012 0.9004033 0.9005049 0.9006062 0.9007070 [330] 0.9008075 0.9009076 0.9010073 0.9011066 0.9012055 0.9013040 0.9014022 [337] 0.9014999 0.9015973 0.9016942 0.9017908 0.9018869 0.9019827 0.9020781 [344] 0.9021731 0.9022676 0.9023618 0.9024556 0.9025490 0.9026420 0.9027346 [351] 0.9028268 0.9029186 0.9030099 0.9031009 0.9031915 0.9032817 0.9033715 [358] 0.9034609 0.9035499 0.9036385 0.9037266 0.9038144 0.9039018 0.9039887 [365] 0.9040753 0.9041614 0.9042472 0.9043325 0.9044175 0.9045020 0.9045861 [372] 0.9046698 0.9047531 0.9048360 0.9049185 0.9050006 0.9050822 0.9051635 [379] 0.9052443 0.9053248 0.9054048 0.9054844 0.9055636 0.9056424 0.9057208 [386] 0.9057987 0.9058763 0.9059534 0.9060301 0.9061064 0.9061823 0.9062578 [393] 0.9063328 0.9064075 0.9064817 0.9065555 0.9066289 0.9067019 0.9067744 [400] 0.9068466 0.9069183 > mx [1] 0.9069183 > 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/freestat/rcomp/tmp/1s1ol1226607080.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/freestat/rcomp/tmp/26u161226607080.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/freestat/rcomp/tmp/3ve4z1226607080.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4827c1226607080.tab") > > system("convert tmp/1s1ol1226607080.ps tmp/1s1ol1226607080.png") > system("convert tmp/26u161226607080.ps tmp/26u161226607080.png") > system("convert tmp/3ve4z1226607080.ps tmp/3ve4z1226607080.png") > > > proc.time() user system elapsed 1.244 0.824 1.351