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(1530.9,2220.6,2161.5,1863.6,1955.1,1907.4,1889.4,2246.3,2213,1965,2285.6,1983.8,1872.4,2371.4,2287,2198.2,2330.4,2014.4,2066.1,2355.8,2232.5,2091.7,2376.5,1931.9,2025.7,2404.9,2316.1,2368.1,2282.5,2158.6,2174.8,2594.1,2281.4,2547.9,2606.3,2190.8,2262.3,2423.8,2520.4,2482.9,2215.9,2441.9,2333.8,2670.2,2431,2559.3,2661.4,2404.6,2378.3,2489.2,2959,2713.5,2341.3,2833.2,2849.7,2871.7,3058.3,2855.1,3083.6,2828.3) > x <- c(1846.5,2796.3,2895.6,2472.2,2584.4,2630.4,2663.1,3176.2,2856.7,2551.4,3088.7,2628.3,2226.2,3023.6,3077.9,3084.1,2990.3,2949.6,3014.7,3517.7,3121.2,3067.4,3174.6,2676.3,2424,3195.1,3146.6,3506.7,3528.5,3365.1,3153,3843.3,3123.2,3361.1,3481.9,2970.5,2537,3257.6,3301.3,3391.6,2933.6,3283.2,3139.7,3486.4,3202.2,3294.4,3550.3,3279.3,2678.6,3451.4,3977.1,3814.8,3310.5,3971.8,4051.9,4057.6,4391.4,3628.9,4092.2,3822.5) > #'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.8325373 0.8330602 0.8335817 0.8341018 0.8346204 0.8351375 0.8356532 [8] 0.8361675 0.8366803 0.8371916 0.8377014 0.8382098 0.8387167 0.8392221 [15] 0.8397260 0.8402285 0.8407294 0.8412289 0.8417268 0.8422233 0.8427182 [22] 0.8432117 0.8437036 0.8441940 0.8446829 0.8451703 0.8456561 0.8461404 [29] 0.8466232 0.8471044 0.8475842 0.8480623 0.8485390 0.8490140 0.8494876 [36] 0.8499596 0.8504300 0.8508989 0.8513662 0.8518319 0.8522961 0.8527587 [43] 0.8532198 0.8536793 0.8541372 0.8545935 0.8550483 0.8555014 0.8559530 [50] 0.8564030 0.8568514 0.8572982 0.8577435 0.8581871 0.8586291 0.8590696 [57] 0.8595084 0.8599456 0.8603813 0.8608153 0.8612477 0.8616785 0.8621077 [64] 0.8625353 0.8629613 0.8633856 0.8638084 0.8642295 0.8646490 0.8650668 [71] 0.8654831 0.8658977 0.8663107 0.8667221 0.8671318 0.8675400 0.8679464 [78] 0.8683513 0.8687545 0.8691561 0.8695560 0.8699544 0.8703510 0.8707461 [85] 0.8711395 0.8715312 0.8719214 0.8723098 0.8726967 0.8730819 0.8734654 [92] 0.8738473 0.8742276 0.8746062 0.8749832 0.8753585 0.8757322 0.8761042 [99] 0.8764746 0.8768434 0.8772105 0.8775759 0.8779397 0.8783018 0.8786623 [106] 0.8790212 0.8793784 0.8797339 0.8800878 0.8804401 0.8807907 0.8811396 [113] 0.8814869 0.8818326 0.8821766 0.8825190 0.8828597 0.8831987 0.8835362 [120] 0.8838719 0.8842060 0.8845385 0.8848694 0.8851985 0.8855261 0.8858520 [127] 0.8861762 0.8864988 0.8868198 0.8871391 0.8874568 0.8877728 0.8880872 [134] 0.8883999 0.8887111 0.8890205 0.8893284 0.8896346 0.8899391 0.8902421 [141] 0.8905434 0.8908430 0.8911410 0.8914374 0.8917322 0.8920254 0.8923169 [148] 0.8926067 0.8928950 0.8931816 0.8934666 0.8937500 0.8940318 0.8943119 [155] 0.8945905 0.8948674 0.8951427 0.8954164 0.8956884 0.8959589 0.8962277 [162] 0.8964950 0.8967606 0.8970246 0.8972870 0.8975478 0.8978070 0.8980647 [169] 0.8983207 0.8985751 0.8988279 0.8990791 0.8993288 0.8995768 0.8998233 [176] 0.9000681 0.9003114 0.9005531 0.9007933 0.9010318 0.9012688 0.9015042 [183] 0.9017380 0.9019702 0.9022009 0.9024300 0.9026575 0.9028835 0.9031079 [190] 0.9033308 0.9035521 0.9037718 0.9039900 0.9042066 0.9044217 0.9046352 [197] 0.9048472 0.9050577 0.9052666 0.9054739 0.9056798 0.9058840 0.9060868 [204] 0.9062880 0.9064877 0.9066859 0.9068826 0.9070777 0.9072713 0.9074634 [211] 0.9076540 0.9078430 0.9080306 0.9082167 0.9084012 0.9085842 0.9087658 [218] 0.9089458 0.9091244 0.9093014 0.9094770 0.9096511 0.9098237 0.9099948 [225] 0.9101644 0.9103326 0.9104993 0.9106645 0.9108282 0.9109905 0.9111513 [232] 0.9113106 0.9114685 0.9116249 0.9117799 0.9119334 0.9120855 0.9122361 [239] 0.9123853 0.9125330 0.9126793 0.9128242 0.9129676 0.9131096 0.9132502 [246] 0.9133893 0.9135271 0.9136634 0.9137983 0.9139317 0.9140638 0.9141944 [253] 0.9143237 0.9144515 0.9145780 0.9147030 0.9148267 0.9149490 0.9150698 [260] 0.9151893 0.9153074 0.9154242 0.9155395 0.9156535 0.9157661 0.9158773 [267] 0.9159872 0.9160957 0.9162028 0.9163086 0.9164131 0.9165161 0.9166179 [274] 0.9167183 0.9168173 0.9169150 0.9170114 0.9171064 0.9172001 0.9172925 [281] 0.9173835 0.9174733 0.9175617 0.9176488 0.9177346 0.9178190 0.9179022 [288] 0.9179840 0.9180646 0.9181439 0.9182218 0.9182985 0.9183739 0.9184480 [295] 0.9185208 0.9185923 0.9186626 0.9187315 0.9187993 0.9188657 0.9189309 [302] 0.9189948 0.9190574 0.9191188 0.9191790 0.9192379 0.9192955 0.9193519 [309] 0.9194071 0.9194610 0.9195137 0.9195651 0.9196154 0.9196644 0.9197121 [316] 0.9197587 0.9198040 0.9198482 0.9198911 0.9199328 0.9199733 0.9200126 [323] 0.9200507 0.9200876 0.9201233 0.9201578 0.9201911 0.9202233 0.9202543 [330] 0.9202841 0.9203127 0.9203401 0.9203664 0.9203915 0.9204155 0.9204383 [337] 0.9204599 0.9204804 0.9204997 0.9205179 0.9205349 0.9205508 0.9205656 [344] 0.9205792 0.9205917 0.9206031 0.9206133 0.9206224 0.9206304 0.9206373 [351] 0.9206430 0.9206477 0.9206512 0.9206537 0.9206550 0.9206553 0.9206544 [358] 0.9206524 0.9206494 0.9206453 0.9206401 0.9206338 0.9206264 0.9206179 [365] 0.9206084 0.9205978 0.9205862 0.9205735 0.9205597 0.9205449 0.9205290 [372] 0.9205120 0.9204940 0.9204750 0.9204549 0.9204338 0.9204117 0.9203885 [379] 0.9203643 0.9203390 0.9203127 0.9202855 0.9202571 0.9202278 0.9201975 [386] 0.9201661 0.9201338 0.9201004 0.9200661 0.9200307 0.9199943 0.9199570 [393] 0.9199187 0.9198793 0.9198390 0.9197977 0.9197555 0.9197122 0.9196680 [400] 0.9196228 0.9195767 > mx [1] 0.9206553 > mxli [1] 1.55 > 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/110jd1226571397.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/2u5ib1226571397.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/3ub761226571397.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/4hupn1226571397.tab") > > system("convert tmp/110jd1226571397.ps tmp/110jd1226571397.png") > system("convert tmp/2u5ib1226571397.ps tmp/2u5ib1226571397.png") > system("convert tmp/3ub761226571397.ps tmp/3ub761226571397.png") > > > proc.time() user system elapsed 1.020 0.521 1.807