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(95.9,95.3,100.4,97.3,82.3,97.0,93.5,90.9,107.8,110.9,98.1,106.5,93.4,95.7,109.0,97.6,92.7,107.5,91.7,95.7,111.4,106.0,104.8,108.7,97.3,97.1,106.1,98.6,98.5,105.5,86.2,98.3,111.3,105.0,105.7,103.5,96.9,98.1,111.7,94.7,104.2,109.7,91.3,102.6,114.2,115.8,113.5,107.1,104.5,101.9,116.0,102.0,108.1,112.9,104.5,109.1,113.4,123.9,117.7,108.3) > x <- c(72.5,72.0,98.8,75.2,81.2,88.0,54.6,68.6,101.5,93.4,84.5,91.4,64.5,64.5,117.3,73.5,79.7,102.6,57.9,73.1,102.4,82.3,89.1,84.7,81.4,67.5,113.9,83.8,73.9,103.9,67.9,62.5,125.4,79.1,106.3,96.2,94.3,85.6,117.4,88.5,124.2,119.3,76.8,70.6,122.1,109.5,119.9,102.3,79.6,78.2,103.6,77.8,99.1,105.7,84.1,88.7,108.0,98.1,101.0,82.0) > #'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.6957687 0.6960398 0.6963097 0.6965784 0.6968459 0.6971121 0.6973771 [8] 0.6976409 0.6979035 0.6981648 0.6984249 0.6986837 0.6989413 0.6991977 [15] 0.6994528 0.6997067 0.6999593 0.7002107 0.7004609 0.7007097 0.7009574 [22] 0.7012037 0.7014488 0.7016927 0.7019352 0.7021766 0.7024166 0.7026554 [29] 0.7028929 0.7031291 0.7033641 0.7035978 0.7038302 0.7040613 0.7042911 [36] 0.7045197 0.7047470 0.7049730 0.7051977 0.7054211 0.7056432 0.7058640 [43] 0.7060836 0.7063018 0.7065187 0.7067344 0.7069487 0.7071618 0.7073735 [50] 0.7075839 0.7077930 0.7080009 0.7082074 0.7084126 0.7086164 0.7088190 [57] 0.7090203 0.7092202 0.7094188 0.7096161 0.7098121 0.7100068 0.7102001 [64] 0.7103922 0.7105829 0.7107723 0.7109603 0.7111470 0.7113324 0.7115165 [71] 0.7116992 0.7118806 0.7120607 0.7122395 0.7124169 0.7125929 0.7127677 [78] 0.7129411 0.7131132 0.7132839 0.7134533 0.7136213 0.7137880 0.7139534 [85] 0.7141174 0.7142801 0.7144415 0.7146015 0.7147601 0.7149175 0.7150734 [92] 0.7152281 0.7153813 0.7155333 0.7156839 0.7158331 0.7159810 0.7161275 [99] 0.7162727 0.7164166 0.7165591 0.7167002 0.7168400 0.7169784 0.7171155 [106] 0.7172513 0.7173857 0.7175187 0.7176504 0.7177807 0.7179097 0.7180373 [113] 0.7181636 0.7182885 0.7184121 0.7185343 0.7186552 0.7187747 0.7188929 [120] 0.7190097 0.7191251 0.7192392 0.7193520 0.7194634 0.7195734 0.7196821 [127] 0.7197895 0.7198955 0.7200001 0.7201034 0.7202053 0.7203059 0.7204052 [134] 0.7205030 0.7205996 0.7206948 0.7207886 0.7208811 0.7209722 0.7210620 [141] 0.7211505 0.7212376 0.7213233 0.7214077 0.7214908 0.7215725 0.7216528 [148] 0.7217319 0.7218095 0.7218859 0.7219609 0.7220345 0.7221068 0.7221778 [155] 0.7222474 0.7223157 0.7223827 0.7224483 0.7225125 0.7225755 0.7226371 [162] 0.7226974 0.7227563 0.7228139 0.7228702 0.7229251 0.7229787 0.7230310 [169] 0.7230819 0.7231315 0.7231798 0.7232268 0.7232725 0.7233168 0.7233598 [176] 0.7234014 0.7234418 0.7234808 0.7235186 0.7235550 0.7235900 0.7236238 [183] 0.7236563 0.7236874 0.7237172 0.7237458 0.7237730 0.7237989 0.7238235 [190] 0.7238468 0.7238687 0.7238894 0.7239088 0.7239269 0.7239437 0.7239592 [197] 0.7239734 0.7239863 0.7239979 0.7240082 0.7240172 0.7240249 0.7240314 [204] 0.7240365 0.7240404 0.7240430 0.7240443 0.7240444 0.7240431 0.7240406 [211] 0.7240368 0.7240317 0.7240254 0.7240178 0.7240089 0.7239987 0.7239873 [218] 0.7239746 0.7239607 0.7239455 0.7239290 0.7239113 0.7238924 0.7238721 [225] 0.7238507 0.7238279 0.7238040 0.7237788 0.7237523 0.7237246 0.7236956 [232] 0.7236655 0.7236340 0.7236014 0.7235675 0.7235324 0.7234961 0.7234585 [239] 0.7234197 0.7233797 0.7233384 0.7232960 0.7232523 0.7232074 0.7231613 [246] 0.7231140 0.7230655 0.7230157 0.7229648 0.7229126 0.7228593 0.7228048 [253] 0.7227490 0.7226921 0.7226340 0.7225747 0.7225142 0.7224525 0.7223896 [260] 0.7223256 0.7222604 0.7221940 0.7221264 0.7220576 0.7219877 0.7219166 [267] 0.7218444 0.7217710 0.7216964 0.7216206 0.7215438 0.7214657 0.7213865 [274] 0.7213062 0.7212247 0.7211420 0.7210583 0.7209733 0.7208873 0.7208001 [281] 0.7207118 0.7206223 0.7205317 0.7204400 0.7203472 0.7202532 0.7201581 [288] 0.7200620 0.7199647 0.7198662 0.7197667 0.7196661 0.7195644 0.7194615 [295] 0.7193576 0.7192526 0.7191465 0.7190393 0.7189310 0.7188216 0.7187111 [302] 0.7185996 0.7184870 0.7183733 0.7182585 0.7181426 0.7180257 0.7179078 [309] 0.7177887 0.7176686 0.7175475 0.7174253 0.7173020 0.7171777 0.7170523 [316] 0.7169259 0.7167985 0.7166700 0.7165405 0.7164100 0.7162784 0.7161458 [323] 0.7160121 0.7158775 0.7157418 0.7156051 0.7154674 0.7153287 0.7151890 [330] 0.7150482 0.7149065 0.7147638 0.7146200 0.7144753 0.7143296 0.7141829 [337] 0.7140352 0.7138865 0.7137368 0.7135862 0.7134346 0.7132820 0.7131284 [344] 0.7129739 0.7128184 0.7126619 0.7125045 0.7123461 0.7121868 0.7120265 [351] 0.7118653 0.7117031 0.7115400 0.7113760 0.7112110 0.7110451 0.7108782 [358] 0.7107104 0.7105417 0.7103721 0.7102016 0.7100301 0.7098577 0.7096844 [365] 0.7095102 0.7093351 0.7091591 0.7089822 0.7088044 0.7086257 0.7084462 [372] 0.7082657 0.7080843 0.7079021 0.7077190 0.7075350 0.7073501 0.7071644 [379] 0.7069778 0.7067903 0.7066020 0.7064128 0.7062227 0.7060318 0.7058401 [386] 0.7056475 0.7054540 0.7052597 0.7050646 0.7048686 0.7046718 0.7044742 [393] 0.7042758 0.7040765 0.7038764 0.7036755 0.7034737 0.7032712 0.7030679 [400] 0.7028637 0.7026587 > mx [1] 0.7240444 > mxli [1] 0.07 > 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/1ow7t1228487616.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/26q5m1228487616.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/36h1e1228487616.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/4gkyg1228487616.tab") > > system("convert tmp/1ow7t1228487616.ps tmp/1ow7t1228487616.png") > system("convert tmp/26q5m1228487616.ps tmp/26q5m1228487616.png") > system("convert tmp/36h1e1228487616.ps tmp/36h1e1228487616.png") > > > proc.time() user system elapsed 1.233 0.810 1.577