R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(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,142.6,153.4,163.4,167.3,154.8,165.7,144.7,120.9,152.8,160.2,128.3,150.5,117,116,133.3,116.4,104,126.6,92.9,83.6,112.8,113.2,118.5,125.5,91.3,105.4,121.3,106.9,109.4,132.6,96.8,100.3,119.2) > x <- c(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,125.8,139.3,134.9,149.2,132.3,149,117.2,119.6,152,149.4,127.3,114.1,102.1,107.7,104.4,102.1,96,109.3,90,83.9,112,114.3,103.6,91.7,80.8,87.2,109.2,102.7,95.1,117.5,85.1,92.1,113.5) > #'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.8619529 0.8621095 0.8622655 0.8624209 0.8625756 0.8627297 0.8628831 [8] 0.8630358 0.8631880 0.8633394 0.8634903 0.8636404 0.8637899 0.8639388 [15] 0.8640870 0.8642346 0.8643814 0.8645277 0.8646732 0.8648181 0.8649623 [22] 0.8651059 0.8652488 0.8653910 0.8655326 0.8656735 0.8658137 0.8659532 [29] 0.8660921 0.8662303 0.8663678 0.8665046 0.8666408 0.8667763 0.8669111 [36] 0.8670452 0.8671786 0.8673113 0.8674433 0.8675747 0.8677054 0.8678353 [43] 0.8679646 0.8680932 0.8682211 0.8683483 0.8684748 0.8686006 0.8687257 [50] 0.8688501 0.8689738 0.8690968 0.8692190 0.8693406 0.8694615 0.8695817 [57] 0.8697011 0.8698199 0.8699379 0.8700552 0.8701719 0.8702878 0.8704029 [64] 0.8705174 0.8706312 0.8707442 0.8708565 0.8709681 0.8710790 0.8711891 [71] 0.8712985 0.8714072 0.8715152 0.8716225 0.8717290 0.8718348 0.8719398 [78] 0.8720442 0.8721478 0.8722507 0.8723528 0.8724542 0.8725549 0.8726548 [85] 0.8727540 0.8728524 0.8729502 0.8730471 0.8731434 0.8732389 0.8733336 [92] 0.8734276 0.8735209 0.8736134 0.8737052 0.8737962 0.8738865 0.8739761 [99] 0.8740649 0.8741529 0.8742402 0.8743267 0.8744125 0.8744975 0.8745818 [106] 0.8746654 0.8747481 0.8748301 0.8749114 0.8749919 0.8750716 0.8751506 [113] 0.8752289 0.8753063 0.8753830 0.8754590 0.8755342 0.8756086 0.8756823 [120] 0.8757552 0.8758273 0.8758987 0.8759693 0.8760391 0.8761082 0.8761765 [127] 0.8762440 0.8763108 0.8763768 0.8764420 0.8765065 0.8765701 0.8766331 [134] 0.8766952 0.8767566 0.8768172 0.8768770 0.8769361 0.8769943 0.8770518 [141] 0.8771086 0.8771645 0.8772197 0.8772741 0.8773277 0.8773806 0.8774327 [148] 0.8774840 0.8775345 0.8775842 0.8776332 0.8776814 0.8777288 0.8777754 [155] 0.8778212 0.8778663 0.8779105 0.8779540 0.8779968 0.8780387 0.8780798 [162] 0.8781202 0.8781598 0.8781986 0.8782366 0.8782738 0.8783103 0.8783460 [169] 0.8783809 0.8784149 0.8784483 0.8784808 0.8785125 0.8785435 0.8785737 [176] 0.8786031 0.8786317 0.8786595 0.8786865 0.8787128 0.8787382 0.8787629 [183] 0.8787868 0.8788099 0.8788322 0.8788537 0.8788744 0.8788944 0.8789136 [190] 0.8789319 0.8789495 0.8789663 0.8789824 0.8789976 0.8790120 0.8790257 [197] 0.8790386 0.8790507 0.8790620 0.8790725 0.8790822 0.8790911 0.8790993 [204] 0.8791066 0.8791132 0.8791190 0.8791240 0.8791282 0.8791317 0.8791343 [211] 0.8791362 0.8791373 0.8791375 0.8791370 0.8791358 0.8791337 0.8791309 [218] 0.8791272 0.8791228 0.8791176 0.8791116 0.8791049 0.8790973 0.8790890 [225] 0.8790798 0.8790699 0.8790593 0.8790478 0.8790356 0.8790225 0.8790087 [232] 0.8789941 0.8789788 0.8789626 0.8789457 0.8789280 0.8789095 0.8788902 [239] 0.8788702 0.8788493 0.8788277 0.8788054 0.8787822 0.8787583 0.8787336 [246] 0.8787081 0.8786818 0.8786548 0.8786270 0.8785984 0.8785690 0.8785389 [253] 0.8785080 0.8784763 0.8784439 0.8784107 0.8783767 0.8783419 0.8783064 [260] 0.8782701 0.8782331 0.8781952 0.8781566 0.8781173 0.8780772 0.8780363 [267] 0.8779946 0.8779522 0.8779090 0.8778650 0.8778203 0.8777749 0.8777286 [274] 0.8776816 0.8776339 0.8775854 0.8775361 0.8774861 0.8774353 0.8773837 [281] 0.8773314 0.8772784 0.8772246 0.8771700 0.8771147 0.8770586 0.8770018 [288] 0.8769443 0.8768859 0.8768269 0.8767671 0.8767065 0.8766452 0.8765831 [295] 0.8765203 0.8764568 0.8763925 0.8763275 0.8762617 0.8761952 0.8761279 [302] 0.8760599 0.8759912 0.8759217 0.8758515 0.8757806 0.8757089 0.8756365 [309] 0.8755633 0.8754895 0.8754148 0.8753395 0.8752634 0.8751866 0.8751091 [316] 0.8750309 0.8749519 0.8748722 0.8747917 0.8747106 0.8746287 0.8745461 [323] 0.8744628 0.8743788 0.8742940 0.8742085 0.8741224 0.8740355 0.8739478 [330] 0.8738595 0.8737705 0.8736807 0.8735903 0.8734991 0.8734072 0.8733146 [337] 0.8732213 0.8731273 0.8730326 0.8729372 0.8728411 0.8727443 0.8726468 [344] 0.8725486 0.8724497 0.8723501 0.8722498 0.8721488 0.8720471 0.8719448 [351] 0.8718417 0.8717380 0.8716335 0.8715284 0.8714226 0.8713161 0.8712089 [358] 0.8711011 0.8709925 0.8708833 0.8707734 0.8706628 0.8705516 0.8704396 [365] 0.8703270 0.8702138 0.8700998 0.8699852 0.8698699 0.8697540 0.8696373 [372] 0.8695201 0.8694021 0.8692835 0.8691642 0.8690443 0.8689237 0.8688024 [379] 0.8686805 0.8685580 0.8684348 0.8683109 0.8681864 0.8680612 0.8679354 [386] 0.8678089 0.8676818 0.8675540 0.8674256 0.8672966 0.8671669 0.8670366 [393] 0.8669056 0.8667740 0.8666418 0.8665089 0.8663754 0.8662413 0.8661065 [400] 0.8659712 0.8658351 > mx [1] 0.8791375 > mxli [1] 0.12 > 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/rcomp/tmp/12uif1292966170.ps",horizontal=F,onefile=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/rcomp/tmp/22uif1292966170.ps",horizontal=F,onefile=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/rcomp/tmp/3v3z01292966170.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4ymy61292966170.tab") > > try(system("convert tmp/12uif1292966170.ps tmp/12uif1292966170.png",intern=TRUE)) character(0) > try(system("convert tmp/22uif1292966170.ps tmp/22uif1292966170.png",intern=TRUE)) character(0) > try(system("convert tmp/3v3z01292966170.ps tmp/3v3z01292966170.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.000 0.580 1.539