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(93.5,94.7,112.9,99.2,105.6,113,83.1,81.1,96.9,104.3,97.7,102.6,89.9,96,112.7,107.1,106.2,121,101.2,83.2,105.1,113.3,99.1,100.3,93.5,98.8,106.2,98.3,102.1,117.1,101.5,80.5,105.9,109.5,97.2,114.5,93.5,100.9,121.1,116.5,109.3,118.1,108.3,105.4,116.2,111.2,105.8,122.7,99.5,107.9,124.6,115,110.3,132.7,99.7,96.5,118.7,112.9,130.5,137.9,115,116.8,140.9,120.7,134.2,147.3,112.4,107.1,128.4,137.7,135,151,137.4,132.4,161.3,139.8,146,166.5,143.3,121,152.6,154.4,154.6,158) > x <- c(97.3,101,113.2,101,105.7,113.9,86.4,96.5,103.3,114.9,105.8,94.2,98.4,99.4,108.8,112.6,104.4,112.2,81.1,97.1,112.6,113.8,107.8,103.2,103.3,101.2,107.7,110.4,101.9,115.9,89.9,88.6,117.2,123.9,100,103.6,94.1,98.7,119.5,112.7,104.4,124.7,89.1,97,121.6,118.8,114,111.5,97.2,102.5,113.4,109.8,104.9,126.1,80,96.8,117.2,112.3,117.3,111.1,102.2,104.3,122.9,107.6,121.3,131.5,89,104.4,128.9,135.9,133.3,121.3,120.5,120.4,137.9,126.1,133.2,151.1,105,119,140.4,156.6,137.1,122.7) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = '' > par2 = '' > par1 = '' > ylab = '' > xlab = '' > main = '' > #'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.7507819 0.7511334 0.7514843 0.7518346 0.7521842 0.7525332 0.7528816 [8] 0.7532293 0.7535763 0.7539227 0.7542685 0.7546136 0.7549581 0.7553019 [15] 0.7556451 0.7559876 0.7563294 0.7566706 0.7570111 0.7573510 0.7576902 [22] 0.7580287 0.7583666 0.7587038 0.7590403 0.7593762 0.7597114 0.7600459 [29] 0.7603797 0.7607128 0.7610453 0.7613771 0.7617082 0.7620386 0.7623684 [36] 0.7626974 0.7630258 0.7633534 0.7636804 0.7640067 0.7643323 0.7646571 [43] 0.7649813 0.7653048 0.7656276 0.7659497 0.7662710 0.7665917 0.7669117 [50] 0.7672309 0.7675495 0.7678673 0.7681844 0.7685008 0.7688165 0.7691314 [57] 0.7694457 0.7697592 0.7700720 0.7703840 0.7706954 0.7710060 0.7713159 [64] 0.7716251 0.7719335 0.7722412 0.7725481 0.7728543 0.7731598 0.7734646 [71] 0.7737686 0.7740718 0.7743743 0.7746761 0.7749771 0.7752774 0.7755770 [78] 0.7758757 0.7761738 0.7764710 0.7767675 0.7770633 0.7773583 0.7776526 [85] 0.7779460 0.7782388 0.7785307 0.7788219 0.7791123 0.7794020 0.7796909 [92] 0.7799790 0.7802664 0.7805529 0.7808387 0.7811238 0.7814080 0.7816915 [99] 0.7819742 0.7822561 0.7825372 0.7828176 0.7830971 0.7833759 0.7836539 [106] 0.7839311 0.7842075 0.7844831 0.7847579 0.7850320 0.7853052 0.7855777 [113] 0.7858493 0.7861201 0.7863902 0.7866594 0.7869279 0.7871955 0.7874623 [120] 0.7877283 0.7879936 0.7882580 0.7885216 0.7887844 0.7890463 0.7893075 [127] 0.7895678 0.7898274 0.7900861 0.7903440 0.7906010 0.7908573 0.7911127 [134] 0.7913673 0.7916211 0.7918741 0.7921262 0.7923775 0.7926280 0.7928776 [141] 0.7931264 0.7933744 0.7936215 0.7938678 0.7941133 0.7943579 0.7946017 [148] 0.7948447 0.7950868 0.7953281 0.7955685 0.7958081 0.7960469 0.7962848 [155] 0.7965218 0.7967580 0.7969934 0.7972279 0.7974615 0.7976943 0.7979263 [162] 0.7981574 0.7983876 0.7986170 0.7988455 0.7990732 0.7993000 0.7995260 [169] 0.7997510 0.7999753 0.8001986 0.8004211 0.8006427 0.8008635 0.8010834 [176] 0.8013024 0.8015206 0.8017379 0.8019543 0.8021698 0.8023845 0.8025983 [183] 0.8028112 0.8030233 0.8032344 0.8034447 0.8036542 0.8038627 0.8040703 [190] 0.8042771 0.8044830 0.8046880 0.8048921 0.8050954 0.8052977 0.8054992 [197] 0.8056998 0.8058994 0.8060982 0.8062962 0.8064932 0.8066893 0.8068845 [204] 0.8070789 0.8072723 0.8074649 0.8076565 0.8078473 0.8080371 0.8082261 [211] 0.8084142 0.8086013 0.8087876 0.8089730 0.8091574 0.8093410 0.8095236 [218] 0.8097054 0.8098862 0.8100662 0.8102452 0.8104233 0.8106005 0.8107768 [225] 0.8109522 0.8111267 0.8113003 0.8114730 0.8116447 0.8118156 0.8119855 [232] 0.8121545 0.8123226 0.8124898 0.8126560 0.8128214 0.8129858 0.8131493 [239] 0.8133119 0.8134736 0.8136344 0.8137942 0.8139531 0.8141111 0.8142682 [246] 0.8144243 0.8145795 0.8147338 0.8148872 0.8150396 0.8151912 0.8153417 [253] 0.8154914 0.8156402 0.8157880 0.8159348 0.8160808 0.8162258 0.8163699 [260] 0.8165131 0.8166553 0.8167966 0.8169370 0.8170764 0.8172149 0.8173525 [267] 0.8174891 0.8176248 0.8177596 0.8178934 0.8180263 0.8181583 0.8182893 [274] 0.8184194 0.8185485 0.8186767 0.8188040 0.8189303 0.8190557 0.8191801 [281] 0.8193036 0.8194262 0.8195478 0.8196685 0.8197883 0.8199071 0.8200249 [288] 0.8201419 0.8202578 0.8203729 0.8204869 0.8206001 0.8207123 0.8208235 [295] 0.8209339 0.8210432 0.8211516 0.8212591 0.8213656 0.8214712 0.8215759 [302] 0.8216795 0.8217823 0.8218841 0.8219849 0.8220848 0.8221838 0.8222818 [309] 0.8223788 0.8224749 0.8225701 0.8226643 0.8227575 0.8228499 0.8229412 [316] 0.8230316 0.8231211 0.8232096 0.8232971 0.8233837 0.8234694 0.8235541 [323] 0.8236379 0.8237207 0.8238025 0.8238834 0.8239634 0.8240424 0.8241204 [330] 0.8241975 0.8242736 0.8243488 0.8244231 0.8244964 0.8245687 0.8246401 [337] 0.8247105 0.8247800 0.8248485 0.8249161 0.8249827 0.8250484 0.8251131 [344] 0.8251768 0.8252397 0.8253015 0.8253624 0.8254224 0.8254814 0.8255394 [351] 0.8255965 0.8256527 0.8257079 0.8257621 0.8258154 0.8258677 0.8259191 [358] 0.8259696 0.8260190 0.8260676 0.8261151 0.8261618 0.8262074 0.8262522 [365] 0.8262959 0.8263388 0.8263806 0.8264216 0.8264615 0.8265006 0.8265386 [372] 0.8265757 0.8266119 0.8266471 0.8266814 0.8267147 0.8267471 0.8267785 [379] 0.8268090 0.8268385 0.8268671 0.8268948 0.8269214 0.8269472 0.8269720 [386] 0.8269958 0.8270187 0.8270407 0.8270617 0.8270817 0.8271008 0.8271190 [393] 0.8271362 0.8271525 0.8271678 0.8271822 0.8271957 0.8272082 0.8272197 [400] 0.8272303 0.8272400 > mx [1] 0.82724 > 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/1ynqw1226515576.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/2uov01226515576.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/3xr281226515576.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/4ax1i1226515576.tab") > > system("convert tmp/1ynqw1226515576.ps tmp/1ynqw1226515576.png") > system("convert tmp/2uov01226515576.ps tmp/2uov01226515576.png") > system("convert tmp/3xr281226515576.ps tmp/3xr281226515576.png") > > > proc.time() user system elapsed 1.209 0.817 2.014