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(104.8,105.6,118.3,89.9,90.2,107,64.5,92.6,95.8,94.3,91.2,86.3,77.6,82.5,97.7,83.3,84.2,92.8,77.4,72.5,88.8,93.4,92.6,90.7,81.6,84.1,88.1,85.3,82.9,84.8,71.2,68.9,94.3,97.6,85.6,91.9,75.8,79.8,99,88.5,86.7,97.9,94.3,72.9,91.8,93.2,86.5,98.9,77.2,79.4,90.4,81.4,85.8,103.6,73.6,75.7,99.2,88.7,94.6,98.7,84.2,87.7,103.3,88.2,93.4,106.3,73.1,78.6,101.6,101.4,98.5,99) > x <- c(97.3,101,113.2,101,105.7,113.9,86.4,96.5,103.3,114.9,105.8,94.2,98.4,99.4,108.8,112.6,104.4,112.2,81.1,97.1,112.6,113.8,107.8,103.2,103.3,101.2,107.7,110.4,101.9,115.9,89.9,88.6,117.2,123.9,100,103.6,94.1,98.7,119.5,112.7,104.4,124.7,89.1,97,121.6,118.8,114,111.5,97.2,102.5,113.4,109.8,104.9,126.1,80,96.8,117.2,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) > #'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.6902525 0.6903437 0.6904344 0.6905246 0.6906144 0.6907037 0.6907925 [8] 0.6908808 0.6909687 0.6910561 0.6911430 0.6912294 0.6913154 0.6914009 [15] 0.6914859 0.6915704 0.6916545 0.6917380 0.6918211 0.6919038 0.6919859 [22] 0.6920676 0.6921488 0.6922295 0.6923097 0.6923895 0.6924688 0.6925476 [29] 0.6926259 0.6927037 0.6927811 0.6928580 0.6929344 0.6930103 0.6930858 [36] 0.6931607 0.6932352 0.6933092 0.6933828 0.6934558 0.6935284 0.6936004 [43] 0.6936721 0.6937432 0.6938138 0.6938840 0.6939537 0.6940229 0.6940916 [50] 0.6941598 0.6942276 0.6942948 0.6943616 0.6944279 0.6944938 0.6945591 [57] 0.6946240 0.6946883 0.6947522 0.6948156 0.6948786 0.6949410 0.6950030 [64] 0.6950645 0.6951255 0.6951860 0.6952460 0.6953056 0.6953646 0.6954232 [71] 0.6954813 0.6955389 0.6955961 0.6956527 0.6957089 0.6957646 0.6958198 [78] 0.6958745 0.6959287 0.6959825 0.6960357 0.6960885 0.6961408 0.6961926 [85] 0.6962440 0.6962948 0.6963452 0.6963950 0.6964444 0.6964933 0.6965418 [92] 0.6965897 0.6966372 0.6966842 0.6967307 0.6967767 0.6968222 0.6968672 [99] 0.6969118 0.6969559 0.6969995 0.6970426 0.6970852 0.6971273 0.6971690 [106] 0.6972102 0.6972509 0.6972911 0.6973308 0.6973701 0.6974088 0.6974471 [113] 0.6974849 0.6975222 0.6975590 0.6975954 0.6976313 0.6976666 0.6977015 [120] 0.6977360 0.6977699 0.6978034 0.6978363 0.6978688 0.6979008 0.6979324 [127] 0.6979634 0.6979940 0.6980240 0.6980537 0.6980828 0.6981114 0.6981396 [134] 0.6981673 0.6981944 0.6982212 0.6982474 0.6982732 0.6982984 0.6983232 [141] 0.6983476 0.6983714 0.6983948 0.6984176 0.6984400 0.6984620 0.6984834 [148] 0.6985044 0.6985248 0.6985449 0.6985644 0.6985834 0.6986020 0.6986201 [155] 0.6986377 0.6986549 0.6986715 0.6986877 0.6987034 0.6987187 0.6987334 [162] 0.6987477 0.6987615 0.6987748 0.6987877 0.6988001 0.6988120 0.6988234 [169] 0.6988344 0.6988448 0.6988548 0.6988644 0.6988734 0.6988820 0.6988901 [176] 0.6988978 0.6989049 0.6989116 0.6989179 0.6989236 0.6989289 0.6989337 [183] 0.6989380 0.6989419 0.6989453 0.6989482 0.6989506 0.6989526 0.6989541 [190] 0.6989552 0.6989557 0.6989559 0.6989555 0.6989547 0.6989534 0.6989516 [197] 0.6989493 0.6989466 0.6989435 0.6989398 0.6989357 0.6989311 0.6989261 [204] 0.6989206 0.6989146 0.6989082 0.6989013 0.6988939 0.6988861 0.6988778 [211] 0.6988691 0.6988599 0.6988502 0.6988400 0.6988294 0.6988184 0.6988068 [218] 0.6987949 0.6987824 0.6987695 0.6987561 0.6987423 0.6987280 0.6987133 [225] 0.6986980 0.6986824 0.6986663 0.6986497 0.6986326 0.6986151 0.6985972 [232] 0.6985788 0.6985599 0.6985406 0.6985208 0.6985006 0.6984799 0.6984588 [239] 0.6984372 0.6984151 0.6983926 0.6983697 0.6983463 0.6983224 0.6982981 [246] 0.6982733 0.6982481 0.6982225 0.6981963 0.6981698 0.6981428 0.6981153 [253] 0.6980874 0.6980591 0.6980303 0.6980010 0.6979713 0.6979412 0.6979106 [260] 0.6978795 0.6978481 0.6978161 0.6977838 0.6977510 0.6977177 0.6976840 [267] 0.6976499 0.6976153 0.6975803 0.6975448 0.6975089 0.6974725 0.6974357 [274] 0.6973985 0.6973609 0.6973228 0.6972842 0.6972452 0.6972058 0.6971660 [281] 0.6971257 0.6970849 0.6970438 0.6970022 0.6969601 0.6969177 0.6968748 [288] 0.6968314 0.6967877 0.6967435 0.6966988 0.6966538 0.6966083 0.6965624 [295] 0.6965160 0.6964692 0.6964220 0.6963744 0.6963263 0.6962778 0.6962289 [302] 0.6961795 0.6961298 0.6960796 0.6960289 0.6959779 0.6959264 0.6958745 [309] 0.6958222 0.6957694 0.6957163 0.6956627 0.6956087 0.6955543 0.6954994 [316] 0.6954441 0.6953884 0.6953323 0.6952758 0.6952189 0.6951615 0.6951037 [323] 0.6950455 0.6949869 0.6949279 0.6948685 0.6948086 0.6947483 0.6946877 [330] 0.6946266 0.6945651 0.6945031 0.6944408 0.6943781 0.6943149 0.6942514 [337] 0.6941874 0.6941231 0.6940583 0.6939931 0.6939275 0.6938615 0.6937951 [344] 0.6937283 0.6936611 0.6935934 0.6935254 0.6934570 0.6933882 0.6933189 [351] 0.6932493 0.6931793 0.6931089 0.6930380 0.6929668 0.6928952 0.6928231 [358] 0.6927507 0.6926779 0.6926047 0.6925311 0.6924571 0.6923827 0.6923079 [365] 0.6922327 0.6921571 0.6920811 0.6920048 0.6919280 0.6918509 0.6917733 [372] 0.6916954 0.6916171 0.6915384 0.6914593 0.6913798 0.6913000 0.6912197 [379] 0.6911391 0.6910581 0.6909767 0.6908949 0.6908127 0.6907302 0.6906472 [386] 0.6905639 0.6904802 0.6903962 0.6903117 0.6902269 0.6901417 0.6900561 [393] 0.6899701 0.6898838 0.6897971 0.6897100 0.6896225 0.6895347 0.6894464 [400] 0.6893578 0.6892689 > mx [1] 0.6989559 > mxli [1] -0.09 > 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/freestat/rcomp/tmp/109ws1226311950.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/freestat/rcomp/tmp/23l8f1226311950.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/freestat/rcomp/tmp/3y8ii1226311950.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4tjpu1226311950.tab") > > system("convert tmp/109ws1226311950.ps tmp/109ws1226311950.png") > system("convert tmp/23l8f1226311950.ps tmp/23l8f1226311950.png") > system("convert tmp/3y8ii1226311950.ps tmp/3y8ii1226311950.png") > > > proc.time() user system elapsed 1.545 0.827 2.269