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(455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430,424,433,456,459,446,441) > x <- c(139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137,135,124) > #'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.7958466 0.7959240 0.7960006 0.7960766 0.7961519 0.7962264 0.7963003 [8] 0.7963735 0.7964460 0.7965177 0.7965888 0.7966592 0.7967289 0.7967979 [15] 0.7968662 0.7969337 0.7970006 0.7970668 0.7971323 0.7971971 0.7972611 [22] 0.7973245 0.7973872 0.7974491 0.7975104 0.7975710 0.7976308 0.7976900 [29] 0.7977484 0.7978062 0.7978632 0.7979195 0.7979752 0.7980301 0.7980843 [36] 0.7981378 0.7981907 0.7982428 0.7982942 0.7983449 0.7983949 0.7984441 [43] 0.7984927 0.7985406 0.7985878 0.7986342 0.7986800 0.7987250 0.7987694 [50] 0.7988130 0.7988559 0.7988982 0.7989397 0.7989805 0.7990206 0.7990600 [57] 0.7990987 0.7991366 0.7991739 0.7992105 0.7992464 0.7992815 0.7993160 [64] 0.7993497 0.7993827 0.7994150 0.7994467 0.7994776 0.7995078 0.7995373 [71] 0.7995661 0.7995942 0.7996215 0.7996482 0.7996742 0.7996994 0.7997240 [78] 0.7997479 0.7997710 0.7997934 0.7998152 0.7998362 0.7998565 0.7998761 [85] 0.7998950 0.7999132 0.7999307 0.7999475 0.7999636 0.7999790 0.7999937 [92] 0.8000077 0.8000210 0.8000335 0.8000454 0.8000566 0.8000670 0.8000768 [99] 0.8000859 0.8000942 0.8001019 0.8001088 0.8001151 0.8001206 0.8001255 [106] 0.8001296 0.8001331 0.8001358 0.8001379 0.8001393 0.8001399 0.8001399 [113] 0.8001391 0.8001377 0.8001355 0.8001327 0.8001292 0.8001249 0.8001200 [120] 0.8001144 0.8001081 0.8001011 0.8000934 0.8000850 0.8000759 0.8000661 [127] 0.8000556 0.8000444 0.8000325 0.8000200 0.8000067 0.7999928 0.7999782 [134] 0.7999628 0.7999468 0.7999301 0.7999127 0.7998946 0.7998759 0.7998564 [141] 0.7998363 0.7998155 0.7997939 0.7997717 0.7997489 0.7997253 0.7997010 [148] 0.7996761 0.7996505 0.7996242 0.7995972 0.7995695 0.7995412 0.7995122 [155] 0.7994824 0.7994521 0.7994210 0.7993893 0.7993568 0.7993237 0.7992900 [162] 0.7992555 0.7992204 0.7991846 0.7991481 0.7991110 0.7990732 0.7990347 [169] 0.7989955 0.7989557 0.7989152 0.7988740 0.7988322 0.7987897 0.7987465 [176] 0.7987027 0.7986582 0.7986130 0.7985671 0.7985206 0.7984735 0.7984257 [183] 0.7983772 0.7983280 0.7982782 0.7982277 0.7981766 0.7981248 0.7980724 [190] 0.7980193 0.7979655 0.7979111 0.7978560 0.7978003 0.7977439 0.7976869 [197] 0.7976292 0.7975709 0.7975119 0.7974523 0.7973920 0.7973311 0.7972695 [204] 0.7972073 0.7971444 0.7970809 0.7970167 0.7969520 0.7968865 0.7968204 [211] 0.7967537 0.7966864 0.7966184 0.7965497 0.7964804 0.7964105 0.7963400 [218] 0.7962688 0.7961970 0.7961245 0.7960515 0.7959778 0.7959034 0.7958285 [225] 0.7957529 0.7956766 0.7955998 0.7955223 0.7954442 0.7953655 0.7952861 [232] 0.7952062 0.7951256 0.7950444 0.7949625 0.7948801 0.7947970 0.7947133 [239] 0.7946290 0.7945441 0.7944586 0.7943724 0.7942857 0.7941983 0.7941103 [246] 0.7940218 0.7939326 0.7938428 0.7937524 0.7936614 0.7935698 0.7934775 [253] 0.7933847 0.7932913 0.7931973 0.7931027 0.7930075 0.7929116 0.7928152 [260] 0.7927182 0.7926206 0.7925225 0.7924237 0.7923243 0.7922243 0.7921238 [267] 0.7920226 0.7919209 0.7918186 0.7917157 0.7916122 0.7915082 0.7914035 [274] 0.7912983 0.7911925 0.7910861 0.7909792 0.7908716 0.7907635 0.7906548 [281] 0.7905456 0.7904357 0.7903253 0.7902144 0.7901028 0.7899907 0.7898780 [288] 0.7897648 0.7896510 0.7895366 0.7894217 0.7893062 0.7891902 0.7890736 [295] 0.7889564 0.7888387 0.7887204 0.7886016 0.7884822 0.7883623 0.7882418 [302] 0.7881207 0.7879992 0.7878770 0.7877543 0.7876311 0.7875073 0.7873830 [309] 0.7872582 0.7871328 0.7870069 0.7868804 0.7867534 0.7866258 0.7864978 [316] 0.7863692 0.7862400 0.7861103 0.7859801 0.7858494 0.7857181 0.7855863 [323] 0.7854540 0.7853212 0.7851878 0.7850539 0.7849195 0.7847846 0.7846492 [330] 0.7845132 0.7843767 0.7842398 0.7841022 0.7839642 0.7838257 0.7836867 [337] 0.7835471 0.7834071 0.7832665 0.7831255 0.7829839 0.7828418 0.7826992 [344] 0.7825562 0.7824126 0.7822685 0.7821240 0.7819789 0.7818333 0.7816873 [351] 0.7815408 0.7813937 0.7812462 0.7810982 0.7809497 0.7808007 0.7806513 [358] 0.7805013 0.7803509 0.7802000 0.7800486 0.7798967 0.7797444 0.7795916 [365] 0.7794383 0.7792845 0.7791303 0.7789755 0.7788204 0.7786647 0.7785086 [372] 0.7783520 0.7781950 0.7780375 0.7778795 0.7777211 0.7775622 0.7774028 [379] 0.7772430 0.7770828 0.7769220 0.7767609 0.7765992 0.7764372 0.7762747 [386] 0.7761117 0.7759483 0.7757844 0.7756201 0.7754553 0.7752902 0.7751245 [393] 0.7749584 0.7747919 0.7746250 0.7744576 0.7742898 0.7741215 0.7739529 [400] 0.7737837 0.7736142 > mx [1] 0.8001399 > mxli [1] -0.9 > 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/1cb141258659320.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/2m9zv1258659320.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/3pw2u1258659320.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/4k1cc1258659320.tab") > > system("convert tmp/1cb141258659320.ps tmp/1cb141258659320.png") > system("convert tmp/2m9zv1258659320.ps tmp/2m9zv1258659320.png") > system("convert tmp/3pw2u1258659320.ps tmp/3pw2u1258659320.png") > > > proc.time() user system elapsed 0.775 0.498 1.682