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(91,120.7,127.9,112.4,93.1,107.5,107.3,114.8,120.8,112.2,123.3,100.6,86.7,123.6,125.3,111.1,98.4,102.3,105,128.2,124.7,116.1,131.2,97.7,88.8,132.8,113.9,112.6,104.3,107.5,106,117.3,123.1,114.3,132,92.3,93.7,121.3,113.6,116.3,98.3,111.9,109.3,133.2,118,131.6,134.1,96.7,99.8,128.3,134.9,130.7,107.3,121.6,120.6,140.5,124.8,129.9,159.4,111,110.1,132.7,135,118.6,94,117.9,114.7,113.6,130.6,117.1,123.2,106.1,87.9) > x <- c(66.9,108.8,113.2,105.5,77.8,102.1,97,95.5,99.3,86.4,92.4,85.7,61.9,104.9,107.9,95.6,79.8,94.8,93.7,108.1,96.9,88.8,106.7,86.8,69.8,110.9,105.4,99.2,84.4,87.2,91.9,97.9,94.5,85,100.3,78.7,65.8,104.8,96,103.3,82.9,91.4,94.5,109.3,92.1,99.3,109.6,87.5,73.1,110.7,111.6,110.7,84,101.6,102.1,113.9,99,100.4,109.5,93.1,77,108,119.9,105.9,78.2,100.3,102.2,97,101.3,89.2,93.3,88.5,62.2) > #'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.7968349 0.7971200 0.7974045 0.7976885 0.7979718 0.7982545 0.7985366 [8] 0.7988182 0.7990991 0.7993794 0.7996591 0.7999381 0.8002166 0.8004945 [15] 0.8007717 0.8010483 0.8013243 0.8015997 0.8018744 0.8021485 0.8024220 [22] 0.8026949 0.8029671 0.8032387 0.8035097 0.8037800 0.8040497 0.8043187 [29] 0.8045871 0.8048549 0.8051220 0.8053885 0.8056543 0.8059195 0.8061840 [36] 0.8064478 0.8067110 0.8069736 0.8072355 0.8074967 0.8077573 0.8080172 [43] 0.8082765 0.8085350 0.8087930 0.8090502 0.8093068 0.8095627 0.8098179 [50] 0.8100724 0.8103263 0.8105795 0.8108320 0.8110839 0.8113350 0.8115855 [57] 0.8118353 0.8120844 0.8123328 0.8125805 0.8128275 0.8130738 0.8133195 [64] 0.8135644 0.8138087 0.8140522 0.8142951 0.8145372 0.8147787 0.8150194 [71] 0.8152594 0.8154988 0.8157374 0.8159753 0.8162125 0.8164490 0.8166848 [78] 0.8169198 0.8171542 0.8173878 0.8176207 0.8178529 0.8180844 0.8183152 [85] 0.8185452 0.8187745 0.8190031 0.8192310 0.8194581 0.8196845 0.8199102 [92] 0.8201351 0.8203593 0.8205828 0.8208056 0.8210276 0.8212488 0.8214694 [99] 0.8216892 0.8219082 0.8221266 0.8223441 0.8225610 0.8227771 0.8229924 [106] 0.8232070 0.8234209 0.8236340 0.8238463 0.8240579 0.8242688 0.8244789 [113] 0.8246883 0.8248969 0.8251047 0.8253118 0.8255182 0.8257238 0.8259286 [120] 0.8261327 0.8263360 0.8265385 0.8267403 0.8269414 0.8271416 0.8273411 [127] 0.8275399 0.8277379 0.8279351 0.8281315 0.8283272 0.8285221 0.8287162 [134] 0.8289096 0.8291022 0.8292941 0.8294851 0.8296754 0.8298649 0.8300537 [141] 0.8302417 0.8304289 0.8306153 0.8308009 0.8309858 0.8311699 0.8313532 [148] 0.8315358 0.8317175 0.8318985 0.8320787 0.8322582 0.8324368 0.8326147 [155] 0.8327917 0.8329680 0.8331436 0.8333183 0.8334923 0.8336654 0.8338378 [162] 0.8340094 0.8341802 0.8343503 0.8345195 0.8346880 0.8348556 0.8350225 [169] 0.8351886 0.8353539 0.8355184 0.8356822 0.8358451 0.8360073 0.8361686 [176] 0.8363292 0.8364890 0.8366480 0.8368062 0.8369636 0.8371202 0.8372761 [183] 0.8374311 0.8375854 0.8377388 0.8378915 0.8380434 0.8381945 0.8383447 [190] 0.8384942 0.8386429 0.8387909 0.8389380 0.8390843 0.8392298 0.8393746 [197] 0.8395185 0.8396617 0.8398040 0.8399456 0.8400864 0.8402263 0.8403655 [204] 0.8405039 0.8406415 0.8407783 0.8409143 0.8410495 0.8411840 0.8413176 [211] 0.8414504 0.8415825 0.8417137 0.8418442 0.8419738 0.8421027 0.8422308 [218] 0.8423580 0.8424845 0.8426102 0.8427351 0.8428592 0.8429825 0.8431051 [225] 0.8432268 0.8433477 0.8434679 0.8435872 0.8437058 0.8438236 0.8439406 [232] 0.8440568 0.8441722 0.8442868 0.8444006 0.8445136 0.8446259 0.8447373 [239] 0.8448480 0.8449579 0.8450669 0.8451752 0.8452828 0.8453895 0.8454954 [246] 0.8456006 0.8457049 0.8458085 0.8459113 0.8460133 0.8461145 0.8462150 [253] 0.8463146 0.8464135 0.8465116 0.8466089 0.8467054 0.8468012 0.8468961 [260] 0.8469903 0.8470837 0.8471763 0.8472682 0.8473592 0.8474495 0.8475390 [267] 0.8476277 0.8477157 0.8478028 0.8478892 0.8479749 0.8480597 0.8481438 [274] 0.8482271 0.8483096 0.8483913 0.8484723 0.8485525 0.8486320 0.8487106 [281] 0.8487885 0.8488657 0.8489420 0.8490176 0.8490924 0.8491665 0.8492398 [288] 0.8493123 0.8493841 0.8494551 0.8495253 0.8495948 0.8496635 0.8497315 [295] 0.8497987 0.8498651 0.8499308 0.8499957 0.8500598 0.8501232 0.8501859 [302] 0.8502478 0.8503089 0.8503693 0.8504289 0.8504878 0.8505459 0.8506033 [309] 0.8506599 0.8507158 0.8507709 0.8508253 0.8508789 0.8509318 0.8509839 [316] 0.8510353 0.8510860 0.8511359 0.8511851 0.8512335 0.8512812 0.8513282 [323] 0.8513744 0.8514198 0.8514646 0.8515086 0.8515519 0.8515944 0.8516362 [330] 0.8516773 0.8517176 0.8517572 0.8517961 0.8518343 0.8518717 0.8519084 [337] 0.8519444 0.8519796 0.8520142 0.8520480 0.8520810 0.8521134 0.8521450 [344] 0.8521760 0.8522062 0.8522357 0.8522645 0.8522925 0.8523199 0.8523465 [351] 0.8523724 0.8523976 0.8524221 0.8524459 0.8524690 0.8524914 0.8525131 [358] 0.8525341 0.8525543 0.8525739 0.8525928 0.8526109 0.8526284 0.8526451 [365] 0.8526612 0.8526766 0.8526913 0.8527053 0.8527186 0.8527312 0.8527431 [372] 0.8527543 0.8527648 0.8527747 0.8527838 0.8527923 0.8528001 0.8528072 [379] 0.8528136 0.8528194 0.8528245 0.8528289 0.8528326 0.8528356 0.8528380 [386] 0.8528397 0.8528407 0.8528410 0.8528407 0.8528397 0.8528380 0.8528357 [393] 0.8528327 0.8528290 0.8528247 0.8528197 0.8528141 0.8528078 0.8528008 [400] 0.8527932 0.8527849 > mx [1] 0.852841 > mxli [1] 1.87 > 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/1j0751226567341.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/2lul41226567341.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/38vi01226567341.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/43ssr1226567341.tab") > > system("convert tmp/1j0751226567341.ps tmp/1j0751226567341.png") > system("convert tmp/2lul41226567341.ps tmp/2lul41226567341.png") > system("convert tmp/38vi01226567341.ps tmp/38vi01226567341.png") > > > proc.time() user system elapsed 1.209 0.805 1.315