R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(0.9383,0.9217,0.9095,0.892,0.8742,0.8532,0.8607,0.9005,0.9111,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) > x <- c(467.037,460.070,447.988,442.867,436.087,431.328,484.015,509.673,512.927,502.831,470.984,471.067,476.049,474.605,470.439,461.251,454.724,455.626,516.847,525.192,522.975,518.585,509.239,512.238,519.164,517.009,509.933,509.127,500.857,506.971,569.323,579.714,577.992,565.464,547.344,554.788,562.325,560.854,555.332,543.599,536.662,542.722,593.530,610.763,612.613,611.324,594.167,595.454,590.865,589.379,584.428,573.100,567.456,569.028,620.735,628.884,628.232,612.117,595.404,597.141,593.408,590.072,579.799,574.205,572.775,572.942,619.567,625.809,619.916,587.625,565.742,557.274) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Linearity Plot (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.8770250 0.8770452 0.8770651 0.8770848 0.8771041 0.8771232 0.8771420 [8] 0.8771605 0.8771787 0.8771966 0.8772143 0.8772316 0.8772487 0.8772655 [15] 0.8772820 0.8772982 0.8773142 0.8773298 0.8773452 0.8773602 0.8773750 [22] 0.8773896 0.8774038 0.8774177 0.8774314 0.8774447 0.8774578 0.8774706 [29] 0.8774831 0.8774953 0.8775073 0.8775189 0.8775303 0.8775414 0.8775522 [36] 0.8775627 0.8775729 0.8775828 0.8775925 0.8776018 0.8776109 0.8776197 [43] 0.8776282 0.8776364 0.8776443 0.8776520 0.8776593 0.8776664 0.8776732 [50] 0.8776796 0.8776858 0.8776918 0.8776974 0.8777027 0.8777078 0.8777126 [57] 0.8777170 0.8777212 0.8777252 0.8777288 0.8777321 0.8777351 0.8777379 [64] 0.8777404 0.8777426 0.8777445 0.8777461 0.8777474 0.8777484 0.8777492 [71] 0.8777496 0.8777498 0.8777497 0.8777493 0.8777486 0.8777476 0.8777463 [78] 0.8777448 0.8777429 0.8777408 0.8777384 0.8777357 0.8777327 0.8777294 [85] 0.8777258 0.8777220 0.8777178 0.8777134 0.8777087 0.8777037 0.8776984 [92] 0.8776928 0.8776869 0.8776808 0.8776743 0.8776676 0.8776606 0.8776533 [99] 0.8776457 0.8776378 0.8776296 0.8776212 0.8776124 0.8776034 0.8775941 [106] 0.8775844 0.8775745 0.8775644 0.8775539 0.8775431 0.8775321 0.8775207 [113] 0.8775091 0.8774972 0.8774850 0.8774725 0.8774597 0.8774467 0.8774333 [120] 0.8774197 0.8774058 0.8773916 0.8773771 0.8773623 0.8773472 0.8773318 [127] 0.8773162 0.8773002 0.8772840 0.8772675 0.8772507 0.8772336 0.8772163 [134] 0.8771986 0.8771807 0.8771624 0.8771439 0.8771251 0.8771060 0.8770866 [141] 0.8770670 0.8770470 0.8770268 0.8770062 0.8769854 0.8769643 0.8769429 [148] 0.8769213 0.8768993 0.8768771 0.8768545 0.8768317 0.8768086 0.8767852 [155] 0.8767616 0.8767376 0.8767133 0.8766888 0.8766640 0.8766389 0.8766135 [162] 0.8765878 0.8765618 0.8765356 0.8765091 0.8764822 0.8764551 0.8764278 [169] 0.8764001 0.8763721 0.8763439 0.8763153 0.8762865 0.8762574 0.8762280 [176] 0.8761984 0.8761684 0.8761382 0.8761077 0.8760768 0.8760458 0.8760144 [183] 0.8759827 0.8759508 0.8759185 0.8758860 0.8758532 0.8758201 0.8757868 [190] 0.8757531 0.8757192 0.8756850 0.8756505 0.8756157 0.8755806 0.8755453 [197] 0.8755097 0.8754737 0.8754375 0.8754011 0.8753643 0.8753273 0.8752899 [204] 0.8752523 0.8752144 0.8751762 0.8751378 0.8750990 0.8750600 0.8750207 [211] 0.8749811 0.8749413 0.8749011 0.8748607 0.8748200 0.8747790 0.8747377 [218] 0.8746962 0.8746543 0.8746122 0.8745698 0.8745271 0.8744842 0.8744409 [225] 0.8743974 0.8743536 0.8743095 0.8742652 0.8742206 0.8741756 0.8741304 [232] 0.8740850 0.8740392 0.8739932 0.8739469 0.8739003 0.8738534 0.8738062 [239] 0.8737588 0.8737111 0.8736631 0.8736148 0.8735663 0.8735175 0.8734684 [246] 0.8734190 0.8733694 0.8733194 0.8732692 0.8732187 0.8731680 0.8731169 [253] 0.8730656 0.8730140 0.8729622 0.8729100 0.8728576 0.8728049 0.8727519 [260] 0.8726987 0.8726451 0.8725913 0.8725373 0.8724829 0.8724283 0.8723734 [267] 0.8723182 0.8722628 0.8722070 0.8721510 0.8720948 0.8720382 0.8719814 [274] 0.8719243 0.8718669 0.8718093 0.8717514 0.8716932 0.8716347 0.8715760 [281] 0.8715170 0.8714577 0.8713981 0.8713383 0.8712782 0.8712178 0.8711572 [288] 0.8710963 0.8710351 0.8709736 0.8709119 0.8708499 0.8707876 0.8707251 [295] 0.8706623 0.8705992 0.8705359 0.8704722 0.8704084 0.8703442 0.8702798 [302] 0.8702151 0.8701501 0.8700849 0.8700194 0.8699536 0.8698876 0.8698212 [309] 0.8697547 0.8696878 0.8696207 0.8695533 0.8694857 0.8694178 0.8693496 [316] 0.8692811 0.8692124 0.8691434 0.8690742 0.8690047 0.8689349 0.8688648 [323] 0.8687945 0.8687240 0.8686531 0.8685820 0.8685106 0.8684390 0.8683671 [330] 0.8682949 0.8682225 0.8681498 0.8680768 0.8680036 0.8679301 0.8678564 [337] 0.8677824 0.8677081 0.8676336 0.8675588 0.8674837 0.8674084 0.8673328 [344] 0.8672570 0.8671809 0.8671045 0.8670279 0.8669510 0.8668739 0.8667964 [351] 0.8667188 0.8666408 0.8665627 0.8664842 0.8664055 0.8663265 0.8662473 [358] 0.8661678 0.8660881 0.8660081 0.8659278 0.8658473 0.8657665 0.8656855 [365] 0.8656042 0.8655227 0.8654409 0.8653588 0.8652765 0.8651939 0.8651111 [372] 0.8650280 0.8649447 0.8648611 0.8647773 0.8646932 0.8646088 0.8645242 [379] 0.8644393 0.8643542 0.8642688 0.8641832 0.8640973 0.8640112 0.8639248 [386] 0.8638382 0.8637513 0.8636642 0.8635768 0.8634891 0.8634012 0.8633131 [393] 0.8632247 0.8631360 0.8630471 0.8629580 0.8628686 0.8627789 0.8626890 [400] 0.8625989 0.8625085 > mx [1] 0.8777498 > mxli [1] -1.29 > 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/1aj0x1196267597.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/2yoph1196267597.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/3md091196267597.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 > 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/4rw1s1196267597.tab") > > system("convert tmp/1aj0x1196267597.ps tmp/1aj0x1196267597.png") > system("convert tmp/2yoph1196267597.ps tmp/2yoph1196267597.png") > system("convert tmp/3md091196267597.ps tmp/3md091196267597.png") > > > proc.time() user system elapsed 1.020 0.520 1.155