R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(91.25,91.5,91.68,91.81,91.84,91.93,92.08,92.11,92.26,92.28,92.39,92.46,92.82,93.16,93.33,93.51,93.56,93.67,93.76,93.88,94.01,94.21,94.31,94.4,94.9,95.31,95.52,95.68,95.91,95.97,96.15,96.34,96.42,96.54,96.72,96.81,97.19,97.5,97.71,97.86,98.04,98.2,98.25,98.41,98.56,98.62,98.75,98.71,99.05,99.52,99.71,99.8,100.01,99.99,100.12,100.15,100.27,100.42,100.43,100.5,100.95,101.26,101.42,101.68,101.75,101.89,102.07,102.22,102.45,102.62,102.67,102.86,104.78,104.87,105.06,105.14,105.32,105.54,105.68,105.77,106.07,106.03,106.13,106.28,106.61,106.74,107.01,107.1,107.28,107.4,107.59,107.69,107.78) > x <- c(91.19,91.53,91.88,92.06,92.32,92.67,92.85,92.82,93.46,93.23,93.54,93.29,93.2,93.6,93.81,94.62,95.22,95.38,95.31,95.3,95.57,95.42,95.53,95.33,95.9,96.06,96.31,96.34,96.49,96.22,96.53,96.5,96.77,96.66,96.58,96.63,97.06,97.73,98.01,97.76,97.49,97.77,97.96,98.23,98.51,98.19,98.37,98.31,98.6,98.97,99.11,99.64,100.03,99.98,100.32,100.44,100.51,101,100.88,100.55,100.83,101.51,102.16,102.39,102.54,102.85,103.47,103.57,103.69,103.5,103.47,103.45,103.48,103.93,103.89,104.4,104.79,104.77,105.13,105.26,104.96,104.75,105.01,105.15,105.2,105.77,105.78,106.26,106.13,106.12,106.57,106.44,106.54) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Linearity Plot (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.9872970 0.9873158 0.9873346 0.9873533 0.9873720 0.9873907 0.9874093 [8] 0.9874279 0.9874464 0.9874649 0.9874833 0.9875017 0.9875201 0.9875384 [15] 0.9875567 0.9875749 0.9875931 0.9876113 0.9876294 0.9876474 0.9876655 [22] 0.9876835 0.9877014 0.9877193 0.9877372 0.9877550 0.9877728 0.9877905 [29] 0.9878082 0.9878259 0.9878435 0.9878611 0.9878786 0.9878961 0.9879136 [36] 0.9879310 0.9879483 0.9879657 0.9879830 0.9880002 0.9880174 0.9880346 [43] 0.9880517 0.9880688 0.9880858 0.9881028 0.9881198 0.9881367 0.9881535 [50] 0.9881704 0.9881872 0.9882039 0.9882206 0.9882373 0.9882539 0.9882705 [57] 0.9882871 0.9883036 0.9883200 0.9883364 0.9883528 0.9883692 0.9883855 [64] 0.9884017 0.9884179 0.9884341 0.9884502 0.9884663 0.9884824 0.9884984 [71] 0.9885144 0.9885303 0.9885462 0.9885620 0.9885778 0.9885936 0.9886093 [78] 0.9886250 0.9886406 0.9886562 0.9886718 0.9886873 0.9887028 0.9887182 [85] 0.9887336 0.9887489 0.9887643 0.9887795 0.9887948 0.9888099 0.9888251 [92] 0.9888402 0.9888553 0.9888703 0.9888853 0.9889002 0.9889151 0.9889300 [99] 0.9889448 0.9889596 0.9889743 0.9889890 0.9890037 0.9890183 0.9890329 [106] 0.9890474 0.9890619 0.9890763 0.9890907 0.9891051 0.9891194 0.9891337 [113] 0.9891480 0.9891622 0.9891763 0.9891905 0.9892046 0.9892186 0.9892326 [120] 0.9892466 0.9892605 0.9892744 0.9892882 0.9893020 0.9893158 0.9893295 [127] 0.9893432 0.9893568 0.9893704 0.9893839 0.9893975 0.9894109 0.9894244 [134] 0.9894377 0.9894511 0.9894644 0.9894777 0.9894909 0.9895041 0.9895172 [141] 0.9895303 0.9895434 0.9895564 0.9895694 0.9895824 0.9895953 0.9896081 [148] 0.9896210 0.9896337 0.9896465 0.9896592 0.9896718 0.9896845 0.9896970 [155] 0.9897096 0.9897221 0.9897345 0.9897469 0.9897593 0.9897717 0.9897840 [162] 0.9897962 0.9898084 0.9898206 0.9898327 0.9898448 0.9898569 0.9898689 [169] 0.9898809 0.9898928 0.9899047 0.9899165 0.9899283 0.9899401 0.9899518 [176] 0.9899635 0.9899752 0.9899868 0.9899983 0.9900099 0.9900214 0.9900328 [183] 0.9900442 0.9900556 0.9900669 0.9900782 0.9900894 0.9901006 0.9901118 [190] 0.9901229 0.9901340 0.9901451 0.9901561 0.9901670 0.9901779 0.9901888 [197] 0.9901997 0.9902105 0.9902212 0.9902320 0.9902426 0.9902533 0.9902639 [204] 0.9902744 0.9902850 0.9902955 0.9903059 0.9903163 0.9903267 0.9903370 [211] 0.9903473 0.9903575 0.9903677 0.9903779 0.9903880 0.9903981 0.9904081 [218] 0.9904181 0.9904281 0.9904380 0.9904479 0.9904577 0.9904675 0.9904773 [225] 0.9904870 0.9904967 0.9905063 0.9905159 0.9905255 0.9905350 0.9905445 [232] 0.9905539 0.9905633 0.9905727 0.9905820 0.9905913 0.9906005 0.9906097 [239] 0.9906189 0.9906280 0.9906371 0.9906461 0.9906551 0.9906641 0.9906730 [246] 0.9906819 0.9906907 0.9906996 0.9907083 0.9907170 0.9907257 0.9907344 [253] 0.9907430 0.9907515 0.9907601 0.9907686 0.9907770 0.9907854 0.9907938 [260] 0.9908021 0.9908104 0.9908186 0.9908269 0.9908350 0.9908432 0.9908512 [267] 0.9908593 0.9908673 0.9908753 0.9908832 0.9908911 0.9908990 0.9909068 [274] 0.9909146 0.9909223 0.9909300 0.9909376 0.9909453 0.9909528 0.9909604 [281] 0.9909679 0.9909753 0.9909827 0.9909901 0.9909975 0.9910048 0.9910120 [288] 0.9910193 0.9910264 0.9910336 0.9910407 0.9910478 0.9910548 0.9910618 [295] 0.9910687 0.9910756 0.9910825 0.9910893 0.9910961 0.9911029 0.9911096 [302] 0.9911163 0.9911229 0.9911295 0.9911360 0.9911426 0.9911490 0.9911555 [309] 0.9911619 0.9911682 0.9911746 0.9911808 0.9911871 0.9911933 0.9911994 [316] 0.9912056 0.9912117 0.9912177 0.9912237 0.9912297 0.9912356 0.9912415 [323] 0.9912474 0.9912532 0.9912590 0.9912647 0.9912704 0.9912760 0.9912817 [330] 0.9912872 0.9912928 0.9912983 0.9913038 0.9913092 0.9913146 0.9913199 [337] 0.9913252 0.9913305 0.9913357 0.9913409 0.9913461 0.9913512 0.9913563 [344] 0.9913613 0.9913663 0.9913713 0.9913762 0.9913811 0.9913859 0.9913907 [351] 0.9913955 0.9914002 0.9914049 0.9914095 0.9914142 0.9914187 0.9914233 [358] 0.9914278 0.9914322 0.9914366 0.9914410 0.9914454 0.9914497 0.9914539 [365] 0.9914582 0.9914624 0.9914665 0.9914706 0.9914747 0.9914787 0.9914827 [372] 0.9914867 0.9914906 0.9914945 0.9914983 0.9915021 0.9915059 0.9915096 [379] 0.9915133 0.9915170 0.9915206 0.9915241 0.9915277 0.9915312 0.9915346 [386] 0.9915381 0.9915414 0.9915448 0.9915481 0.9915514 0.9915546 0.9915578 [393] 0.9915609 0.9915641 0.9915671 0.9915702 0.9915732 0.9915761 0.9915791 [400] 0.9915820 0.9915848 > mx [1] 0.9915848 > 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/1srtz1194172349.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/2uc2n1194172349.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/3fxuj1194172349.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 > 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/4ody31194172350.tab") > > system("convert tmp/1srtz1194172349.ps tmp/1srtz1194172349.png") > system("convert tmp/2uc2n1194172349.ps tmp/2uc2n1194172349.png") > system("convert tmp/3fxuj1194172349.ps tmp/3fxuj1194172349.png") > > > proc.time() user system elapsed 1.034 0.508 1.165