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(91.46,90.24,93.90,96.34,93.90,86.59,75.61,70.73,74.39,84.15,89.02,87.80,74.39,70.73,74.39,78.05,82.93,82.93,79.27,75.61,76.83,78.05,80.49,81.71,78.05,82.93,85.37,84.15,86.59,87.80,86.59,85.37,84.15,81.71,80.49,84.15,89.02,96.34,100.00,100.00,100.00,98.78,96.34,93.90,93.90,92.68,91.46,91.46,86.59,91.46,91.46,95.12,95.12,95.12,92.68,91.46,93.90,98.78,97.56,92.68,80.49,79.27,82.93,91.46,97.56,100.00,98.78,96.34,96.34,92.68,91.46,92.68,89.02,91.46,92.68,91.46,92.68,95.12,96.34,95.12,91.46,80.49,76.83,76.83,73.17,76.83,78.05,76.83,76.83,78.05,81.71,81.71,82.93,75.61,70.73,68.29,65.85,69.51,70.73,67.07,65.85,65.85,65.85,67.07,68.29,69.51,70.73,65.85,59.76,63.41,67.07,71.95,76.83,79.27,78.05,78.05,80.49,82.93,87.80) > x <- c(90.70,89.53,90.70,90.70,89.53,87.21,82.56,80.23,82.56,84.88,87.21,84.88,80.23,76.74,77.91,77.91,80.23,82.56,83.72,82.56,81.40,79.07,81.40,84.88,88.37,93.02,94.19,91.86,90.70,90.70,91.86,93.02,93.02,93.02,93.02,94.19,97.67,100.00,98.84,98.84,98.84,98.84,98.84,98.84,98.84,98.84,97.67,98.84,98.84,100.00,97.67,98.84,97.67,96.51,96.51,96.51,100.00,103.49,103.49,100.00,93.02,90.70,90.70,96.51,98.84,100.00,98.84,97.67,96.51,95.35,94.19,94.19,94.19,94.19,94.19,95.35,95.35,94.19,91.86,90.70,88.37,88.37,88.37,88.37,86.05,84.88,84.88,86.05,86.05,86.05,86.05,84.88,82.56,76.74,72.09,72.09,75.58,76.74,75.58,72.09,70.93,72.09,74.42,77.91,79.07,79.07,81.40,79.07,80.23,80.23,81.40,80.23,81.40,83.72,87.21,89.53,91.86,94.19,97.67) > #'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.8666208 0.8666971 0.8667733 0.8668492 0.8669249 0.8670003 0.8670755 [8] 0.8671505 0.8672253 0.8672998 0.8673741 0.8674481 0.8675219 0.8675955 [15] 0.8676689 0.8677420 0.8678149 0.8678876 0.8679600 0.8680322 0.8681042 [22] 0.8681760 0.8682475 0.8683188 0.8683898 0.8684606 0.8685312 0.8686016 [29] 0.8686717 0.8687416 0.8688113 0.8688807 0.8689499 0.8690189 0.8690876 [36] 0.8691561 0.8692244 0.8692924 0.8693603 0.8694278 0.8694952 0.8695623 [43] 0.8696292 0.8696959 0.8697623 0.8698285 0.8698945 0.8699602 0.8700257 [50] 0.8700910 0.8701560 0.8702208 0.8702854 0.8703498 0.8704139 0.8704778 [57] 0.8705415 0.8706049 0.8706681 0.8707310 0.8707938 0.8708563 0.8709186 [64] 0.8709806 0.8710424 0.8711040 0.8711654 0.8712265 0.8712874 0.8713481 [71] 0.8714085 0.8714687 0.8715287 0.8715884 0.8716479 0.8717072 0.8717663 [78] 0.8718251 0.8718837 0.8719420 0.8720002 0.8720581 0.8721157 0.8721732 [85] 0.8722304 0.8722874 0.8723441 0.8724007 0.8724570 0.8725130 0.8725689 [92] 0.8726245 0.8726798 0.8727350 0.8727899 0.8728446 0.8728991 0.8729533 [99] 0.8730073 0.8730611 0.8731146 0.8731679 0.8732210 0.8732739 0.8733265 [106] 0.8733789 0.8734311 0.8734830 0.8735347 0.8735862 0.8736375 0.8736885 [113] 0.8737393 0.8737899 0.8738402 0.8738904 0.8739402 0.8739899 0.8740393 [120] 0.8740886 0.8741375 0.8741863 0.8742348 0.8742831 0.8743312 0.8743790 [127] 0.8744266 0.8744740 0.8745212 0.8745681 0.8746148 0.8746613 0.8747075 [134] 0.8747536 0.8747993 0.8748449 0.8748903 0.8749354 0.8749803 0.8750249 [141] 0.8750694 0.8751136 0.8751576 0.8752013 0.8752449 0.8752882 0.8753312 [148] 0.8753741 0.8754167 0.8754591 0.8755013 0.8755433 0.8755850 0.8756265 [155] 0.8756678 0.8757088 0.8757496 0.8757902 0.8758306 0.8758708 0.8759107 [162] 0.8759504 0.8759899 0.8760291 0.8760682 0.8761070 0.8761455 0.8761839 [169] 0.8762220 0.8762599 0.8762976 0.8763351 0.8763723 0.8764093 0.8764461 [176] 0.8764827 0.8765190 0.8765551 0.8765910 0.8766267 0.8766622 0.8766974 [183] 0.8767324 0.8767672 0.8768017 0.8768361 0.8768702 0.8769041 0.8769378 [190] 0.8769712 0.8770044 0.8770374 0.8770702 0.8771028 0.8771351 0.8771672 [197] 0.8771991 0.8772308 0.8772623 0.8772935 0.8773245 0.8773553 0.8773859 [204] 0.8774162 0.8774463 0.8774763 0.8775059 0.8775354 0.8775647 0.8775937 [211] 0.8776225 0.8776511 0.8776795 0.8777076 0.8777355 0.8777632 0.8777907 [218] 0.8778180 0.8778451 0.8778719 0.8778985 0.8779249 0.8779511 0.8779771 [225] 0.8780028 0.8780283 0.8780536 0.8780787 0.8781036 0.8781282 0.8781527 [232] 0.8781769 0.8782009 0.8782247 0.8782482 0.8782716 0.8782947 0.8783176 [239] 0.8783403 0.8783628 0.8783851 0.8784071 0.8784290 0.8784506 0.8784720 [246] 0.8784932 0.8785142 0.8785349 0.8785555 0.8785758 0.8785959 0.8786158 [253] 0.8786355 0.8786549 0.8786742 0.8786932 0.8787120 0.8787306 0.8787490 [260] 0.8787672 0.8787852 0.8788029 0.8788205 0.8788378 0.8788549 0.8788718 [267] 0.8788885 0.8789050 0.8789212 0.8789373 0.8789531 0.8789687 0.8789841 [274] 0.8789993 0.8790143 0.8790291 0.8790437 0.8790580 0.8790722 0.8790861 [281] 0.8790998 0.8791133 0.8791266 0.8791397 0.8791526 0.8791652 0.8791777 [288] 0.8791899 0.8792020 0.8792138 0.8792254 0.8792368 0.8792480 0.8792590 [295] 0.8792698 0.8792803 0.8792907 0.8793008 0.8793108 0.8793205 0.8793300 [302] 0.8793394 0.8793485 0.8793574 0.8793661 0.8793746 0.8793828 0.8793909 [309] 0.8793988 0.8794064 0.8794139 0.8794211 0.8794282 0.8794350 0.8794416 [316] 0.8794480 0.8794542 0.8794602 0.8794660 0.8794716 0.8794770 0.8794822 [323] 0.8794872 0.8794920 0.8794965 0.8795009 0.8795051 0.8795090 0.8795128 [330] 0.8795163 0.8795197 0.8795228 0.8795258 0.8795285 0.8795310 0.8795334 [337] 0.8795355 0.8795374 0.8795391 0.8795407 0.8795420 0.8795431 0.8795440 [344] 0.8795447 0.8795452 0.8795455 0.8795456 0.8795455 0.8795452 0.8795447 [351] 0.8795441 0.8795432 0.8795421 0.8795408 0.8795393 0.8795376 0.8795357 [358] 0.8795336 0.8795313 0.8795288 0.8795261 0.8795232 0.8795201 0.8795168 [365] 0.8795133 0.8795096 0.8795058 0.8795017 0.8794974 0.8794929 0.8794882 [372] 0.8794834 0.8794783 0.8794730 0.8794676 0.8794619 0.8794561 0.8794500 [379] 0.8794438 0.8794373 0.8794307 0.8794238 0.8794168 0.8794096 0.8794022 [386] 0.8793946 0.8793867 0.8793787 0.8793705 0.8793622 0.8793536 0.8793448 [393] 0.8793358 0.8793266 0.8793173 0.8793077 0.8792980 0.8792880 0.8792779 [400] 0.8792676 0.8792571 > mx [1] 0.8795456 > mxli [1] 1.46 > 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/166br1258136773.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/2h4ta1258136773.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/3jv8f1258136773.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/42gxa1258136773.tab") > > system("convert tmp/166br1258136773.ps tmp/166br1258136773.png") > system("convert tmp/2h4ta1258136773.ps tmp/2h4ta1258136773.png") > system("convert tmp/3jv8f1258136773.ps tmp/3jv8f1258136773.png") > > > proc.time() user system elapsed 0.840 0.532 1.940