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(119.5,125,145,105.3,116.9,120.1,88.9,78.4,114.6,113.3,117,99.6,99.4,101.9,115.2,108.5,113.8,121,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6) > x <- c(103.1,100.6,103.1,95.5,90.5,90.9,88.8,90.7,94.3,104.6,111.1,110.8,107.2,99,99,91,96.2,96.9,96.2,100.1,99,115.4,106.9,107.1,99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.3,112.1) > #'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.5739284 0.5739597 0.5739910 0.5740222 0.5740534 0.5740845 0.5741156 [8] 0.5741466 0.5741775 0.5742083 0.5742391 0.5742699 0.5743005 0.5743311 [15] 0.5743617 0.5743922 0.5744226 0.5744529 0.5744832 0.5745135 0.5745436 [22] 0.5745738 0.5746038 0.5746338 0.5746637 0.5746936 0.5747234 0.5747531 [29] 0.5747828 0.5748124 0.5748419 0.5748714 0.5749008 0.5749302 0.5749594 [36] 0.5749887 0.5750178 0.5750469 0.5750760 0.5751050 0.5751339 0.5751627 [43] 0.5751915 0.5752202 0.5752489 0.5752775 0.5753060 0.5753345 0.5753629 [50] 0.5753913 0.5754195 0.5754478 0.5754759 0.5755040 0.5755320 0.5755600 [57] 0.5755879 0.5756157 0.5756435 0.5756712 0.5756989 0.5757265 0.5757540 [64] 0.5757814 0.5758088 0.5758362 0.5758634 0.5758906 0.5759178 0.5759449 [71] 0.5759719 0.5759988 0.5760257 0.5760525 0.5760793 0.5761060 0.5761326 [78] 0.5761592 0.5761857 0.5762121 0.5762385 0.5762648 0.5762911 0.5763173 [85] 0.5763434 0.5763694 0.5763954 0.5764214 0.5764472 0.5764730 0.5764988 [92] 0.5765244 0.5765500 0.5765756 0.5766011 0.5766265 0.5766518 0.5766771 [99] 0.5767024 0.5767275 0.5767526 0.5767777 0.5768026 0.5768275 0.5768524 [106] 0.5768771 0.5769019 0.5769265 0.5769511 0.5769756 0.5770001 0.5770245 [113] 0.5770488 0.5770731 0.5770973 0.5771214 0.5771455 0.5771695 0.5771934 [120] 0.5772173 0.5772411 0.5772649 0.5772885 0.5773122 0.5773357 0.5773592 [127] 0.5773826 0.5774060 0.5774293 0.5774525 0.5774757 0.5774988 0.5775218 [134] 0.5775448 0.5775677 0.5775906 0.5776134 0.5776361 0.5776587 0.5776813 [141] 0.5777038 0.5777263 0.5777487 0.5777710 0.5777933 0.5778155 0.5778376 [148] 0.5778597 0.5778817 0.5779037 0.5779255 0.5779474 0.5779691 0.5779908 [155] 0.5780124 0.5780340 0.5780554 0.5780769 0.5780982 0.5781195 0.5781408 [162] 0.5781619 0.5781830 0.5782041 0.5782250 0.5782459 0.5782668 0.5782876 [169] 0.5783083 0.5783289 0.5783495 0.5783700 0.5783905 0.5784109 0.5784312 [176] 0.5784514 0.5784716 0.5784918 0.5785118 0.5785318 0.5785518 0.5785716 [183] 0.5785914 0.5786112 0.5786309 0.5786505 0.5786700 0.5786895 0.5787089 [190] 0.5787283 0.5787475 0.5787668 0.5787859 0.5788050 0.5788240 0.5788430 [197] 0.5788619 0.5788807 0.5788995 0.5789182 0.5789368 0.5789554 0.5789739 [204] 0.5789923 0.5790107 0.5790290 0.5790472 0.5790654 0.5790835 0.5791016 [211] 0.5791196 0.5791375 0.5791553 0.5791731 0.5791909 0.5792085 0.5792261 [218] 0.5792436 0.5792611 0.5792785 0.5792958 0.5793131 0.5793303 0.5793474 [225] 0.5793645 0.5793815 0.5793985 0.5794153 0.5794322 0.5794489 0.5794656 [232] 0.5794822 0.5794988 0.5795152 0.5795317 0.5795480 0.5795643 0.5795805 [239] 0.5795967 0.5796128 0.5796288 0.5796448 0.5796607 0.5796765 0.5796923 [246] 0.5797080 0.5797236 0.5797392 0.5797547 0.5797702 0.5797855 0.5798009 [253] 0.5798161 0.5798313 0.5798464 0.5798615 0.5798764 0.5798914 0.5799062 [260] 0.5799210 0.5799357 0.5799504 0.5799650 0.5799795 0.5799940 0.5800084 [267] 0.5800227 0.5800370 0.5800512 0.5800654 0.5800794 0.5800934 0.5801074 [274] 0.5801213 0.5801351 0.5801488 0.5801625 0.5801761 0.5801897 0.5802032 [281] 0.5802166 0.5802300 0.5802432 0.5802565 0.5802696 0.5802827 0.5802958 [288] 0.5803087 0.5803216 0.5803345 0.5803473 0.5803600 0.5803726 0.5803852 [295] 0.5803977 0.5804101 0.5804225 0.5804348 0.5804471 0.5804593 0.5804714 [302] 0.5804835 0.5804954 0.5805074 0.5805192 0.5805310 0.5805428 0.5805544 [309] 0.5805660 0.5805776 0.5805890 0.5806004 0.5806118 0.5806231 0.5806343 [316] 0.5806454 0.5806565 0.5806675 0.5806785 0.5806894 0.5807002 0.5807109 [323] 0.5807216 0.5807322 0.5807428 0.5807533 0.5807637 0.5807741 0.5807844 [330] 0.5807946 0.5808048 0.5808149 0.5808250 0.5808349 0.5808448 0.5808547 [337] 0.5808645 0.5808742 0.5808838 0.5808934 0.5809030 0.5809124 0.5809218 [344] 0.5809311 0.5809404 0.5809496 0.5809587 0.5809678 0.5809768 0.5809857 [351] 0.5809946 0.5810034 0.5810122 0.5810208 0.5810295 0.5810380 0.5810465 [358] 0.5810549 0.5810633 0.5810716 0.5810798 0.5810880 0.5810961 0.5811041 [365] 0.5811121 0.5811200 0.5811278 0.5811356 0.5811433 0.5811509 0.5811585 [372] 0.5811660 0.5811735 0.5811809 0.5811882 0.5811954 0.5812026 0.5812098 [379] 0.5812168 0.5812238 0.5812308 0.5812376 0.5812444 0.5812512 0.5812579 [386] 0.5812645 0.5812710 0.5812775 0.5812839 0.5812903 0.5812966 0.5813028 [393] 0.5813090 0.5813150 0.5813211 0.5813270 0.5813330 0.5813388 0.5813446 [400] 0.5813503 0.5813559 > mx [1] 0.5813559 > 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/rcomp/tmp/1tei01226422522.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/25qqq1226422522.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/3f7xc1226422522.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/4klff1226422522.tab") > > system("convert tmp/1tei01226422522.ps tmp/1tei01226422522.png") > system("convert tmp/25qqq1226422522.ps tmp/25qqq1226422522.png") > system("convert tmp/3f7xc1226422522.ps tmp/3f7xc1226422522.png") > > > proc.time() user system elapsed 1.004 0.501 1.149