R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(94.3,99.4,115.7,116.8,99.8,96,115.9,109.1,117.3,109.8,112.8,110.7,100,113.3,122.4,112.5,104.2,92.5,117.2,109.3,106.1,118.8,105.3,106,102,112.9,116.5,114.8,100.5,85.4,114.6,109.9,100.7,115.5,100.7,99,102.3,108.8,105.9,113.2,95.7,80.9,113.9,98.1,102.8,104.7,95.9,94.6,101.6,103.9,110.3,114.1,96.8,87.4,111.4,97.4,102.9,112.7,97,95.1) > x <- c(85,96.1,113.6,116.8,102.7,106.8,124.2,117.8,121.6,117.9,111.4,109.8,92.6,104.9,120.3,109.1,93.1,87.3,106.9,102.1,102.4,113.3,100.6,103.5,93.7,102.6,108.1,105.9,87.1,81.8,103.8,95.8,92.7,101.1,88,92.8,89.7,95.6,95.2,96.9,79.2,73.5,99.7,87.8,91.3,93.9,90,89.8,88.9,104.2,110.8,110.5,87.1,89.2,96.5,95.4,101,107.6,93.8,93.8) > #'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.8328777 0.8328883 0.8328984 0.8329079 0.8329169 0.8329253 0.8329332 [8] 0.8329405 0.8329473 0.8329535 0.8329592 0.8329643 0.8329689 0.8329729 [15] 0.8329764 0.8329794 0.8329818 0.8329836 0.8329849 0.8329857 0.8329859 [22] 0.8329856 0.8329847 0.8329833 0.8329814 0.8329789 0.8329758 0.8329723 [29] 0.8329682 0.8329635 0.8329583 0.8329526 0.8329463 0.8329395 0.8329322 [36] 0.8329243 0.8329159 0.8329070 0.8328975 0.8328875 0.8328769 0.8328659 [43] 0.8328542 0.8328421 0.8328294 0.8328162 0.8328025 0.8327882 0.8327734 [50] 0.8327581 0.8327423 0.8327259 0.8327090 0.8326915 0.8326736 0.8326551 [57] 0.8326361 0.8326166 0.8325965 0.8325759 0.8325548 0.8325332 0.8325111 [64] 0.8324884 0.8324652 0.8324415 0.8324173 0.8323926 0.8323673 0.8323415 [71] 0.8323153 0.8322884 0.8322611 0.8322333 0.8322049 0.8321761 0.8321467 [78] 0.8321168 0.8320864 0.8320555 0.8320241 0.8319922 0.8319597 0.8319268 [85] 0.8318933 0.8318593 0.8318249 0.8317899 0.8317544 0.8317184 0.8316819 [92] 0.8316449 0.8316074 0.8315694 0.8315309 0.8314919 0.8314524 0.8314124 [99] 0.8313719 0.8313309 0.8312894 0.8312474 0.8312049 0.8311620 0.8311185 [106] 0.8310745 0.8310300 0.8309851 0.8309396 0.8308937 0.8308472 0.8308003 [113] 0.8307529 0.8307050 0.8306566 0.8306077 0.8305583 0.8305084 0.8304581 [120] 0.8304073 0.8303559 0.8303041 0.8302519 0.8301991 0.8301458 0.8300921 [127] 0.8300379 0.8299832 0.8299280 0.8298724 0.8298163 0.8297597 0.8297026 [134] 0.8296450 0.8295870 0.8295285 0.8294695 0.8294101 0.8293502 0.8292898 [141] 0.8292289 0.8291676 0.8291058 0.8290435 0.8289808 0.8289175 0.8288539 [148] 0.8287897 0.8287251 0.8286601 0.8285945 0.8285285 0.8284621 0.8283951 [155] 0.8283278 0.8282599 0.8281916 0.8281228 0.8280536 0.8279840 0.8279138 [162] 0.8278432 0.8277722 0.8277007 0.8276287 0.8275563 0.8274835 0.8274102 [169] 0.8273364 0.8272622 0.8271875 0.8271124 0.8270369 0.8269609 0.8268844 [176] 0.8268075 0.8267302 0.8266524 0.8265741 0.8264955 0.8264164 0.8263368 [183] 0.8262568 0.8261764 0.8260955 0.8260142 0.8259324 0.8258502 0.8257676 [190] 0.8256845 0.8256010 0.8255171 0.8254327 0.8253479 0.8252627 0.8251771 [197] 0.8250910 0.8250044 0.8249175 0.8248301 0.8247423 0.8246541 0.8245654 [204] 0.8244763 0.8243868 0.8242969 0.8242066 0.8241158 0.8240246 0.8239330 [211] 0.8238409 0.8237485 0.8236556 0.8235623 0.8234686 0.8233745 0.8232799 [218] 0.8231850 0.8230896 0.8229938 0.8228976 0.8228010 0.8227040 0.8226066 [225] 0.8225087 0.8224105 0.8223118 0.8222127 0.8221133 0.8220134 0.8219131 [232] 0.8218124 0.8217113 0.8216099 0.8215080 0.8214057 0.8213030 0.8211999 [239] 0.8210964 0.8209925 0.8208882 0.8207835 0.8206784 0.8205730 0.8204671 [246] 0.8203608 0.8202542 0.8201471 0.8200397 0.8199319 0.8198236 0.8197150 [253] 0.8196060 0.8194967 0.8193869 0.8192767 0.8191662 0.8190552 0.8189439 [260] 0.8188322 0.8187202 0.8186077 0.8184949 0.8183816 0.8182681 0.8181541 [267] 0.8180397 0.8179250 0.8178099 0.8176944 0.8175785 0.8174623 0.8173457 [274] 0.8172287 0.8171114 0.8169937 0.8168756 0.8167571 0.8166383 0.8165191 [281] 0.8163995 0.8162796 0.8161593 0.8160386 0.8159176 0.8157962 0.8156745 [288] 0.8155524 0.8154299 0.8153071 0.8151839 0.8150603 0.8149364 0.8148121 [295] 0.8146875 0.8145625 0.8144372 0.8143115 0.8141855 0.8140591 0.8139323 [302] 0.8138052 0.8136778 0.8135500 0.8134218 0.8132933 0.8131645 0.8130353 [309] 0.8129058 0.8127759 0.8126457 0.8125151 0.8123842 0.8122529 0.8121213 [316] 0.8119894 0.8118571 0.8117245 0.8115916 0.8114583 0.8113246 0.8111907 [323] 0.8110564 0.8109217 0.8107868 0.8106515 0.8105158 0.8103799 0.8102436 [330] 0.8101069 0.8099700 0.8098327 0.8096951 0.8095571 0.8094189 0.8092803 [337] 0.8091413 0.8090021 0.8088625 0.8087226 0.8085824 0.8084419 0.8083010 [344] 0.8081599 0.8080184 0.8078766 0.8077344 0.8075920 0.8074492 0.8073061 [351] 0.8071628 0.8070190 0.8068750 0.8067307 0.8065860 0.8064411 0.8062958 [358] 0.8061503 0.8060044 0.8058582 0.8057117 0.8055649 0.8054178 0.8052703 [365] 0.8051226 0.8049746 0.8048263 0.8046776 0.8045287 0.8043795 0.8042299 [372] 0.8040801 0.8039300 0.8037795 0.8036288 0.8034778 0.8033265 0.8031748 [379] 0.8030229 0.8028707 0.8027182 0.8025655 0.8024124 0.8022590 0.8021053 [386] 0.8019514 0.8017972 0.8016426 0.8014878 0.8013327 0.8011773 0.8010217 [393] 0.8008657 0.8007095 0.8005530 0.8003961 0.8002391 0.8000817 0.7999241 [400] 0.7997661 0.7996079 > mx [1] 0.8329859 > mxli [1] -1.8 > 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/1glxt1257792052.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/253y91257792052.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/3d7u61257792052.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/4k8ua1257792052.tab") > > system("convert tmp/1glxt1257792052.ps tmp/1glxt1257792052.png") > system("convert tmp/253y91257792052.ps tmp/253y91257792052.png") > system("convert tmp/3d7u61257792052.ps tmp/3d7u61257792052.png") > > > proc.time() user system elapsed 0.769 0.488 0.984