R version 2.7.0 (2008-04-22) 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(93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6,135.8,143.8,147.5,136.2,156.6,123.2) > x <- c(99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.3,112.1,111.8,112.5,116.3,110.3,117.1,102.6) > #'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.7371913 0.7372453 0.7372992 0.7373529 0.7374066 0.7374601 0.7375135 [8] 0.7375669 0.7376201 0.7376731 0.7377261 0.7377790 0.7378317 0.7378844 [15] 0.7379369 0.7379893 0.7380416 0.7380938 0.7381459 0.7381979 0.7382497 [22] 0.7383015 0.7383531 0.7384046 0.7384561 0.7385074 0.7385586 0.7386096 [29] 0.7386606 0.7387115 0.7387622 0.7388128 0.7388633 0.7389138 0.7389640 [36] 0.7390142 0.7390643 0.7391143 0.7391641 0.7392139 0.7392635 0.7393130 [43] 0.7393624 0.7394117 0.7394609 0.7395099 0.7395589 0.7396077 0.7396565 [50] 0.7397051 0.7397536 0.7398020 0.7398503 0.7398985 0.7399465 0.7399945 [57] 0.7400423 0.7400901 0.7401377 0.7401852 0.7402326 0.7402799 0.7403270 [64] 0.7403741 0.7404210 0.7404679 0.7405146 0.7405612 0.7406077 0.7406541 [71] 0.7407004 0.7407466 0.7407926 0.7408386 0.7408844 0.7409301 0.7409757 [78] 0.7410212 0.7410666 0.7411119 0.7411571 0.7412021 0.7412471 0.7412919 [85] 0.7413366 0.7413813 0.7414258 0.7414701 0.7415144 0.7415586 0.7416026 [92] 0.7416466 0.7416904 0.7417341 0.7417778 0.7418213 0.7418646 0.7419079 [99] 0.7419511 0.7419941 0.7420371 0.7420799 0.7421227 0.7421653 0.7422078 [106] 0.7422502 0.7422924 0.7423346 0.7423767 0.7424186 0.7424604 0.7425022 [113] 0.7425438 0.7425853 0.7426267 0.7426680 0.7427091 0.7427502 0.7427911 [120] 0.7428320 0.7428727 0.7429133 0.7429538 0.7429942 0.7430345 0.7430747 [127] 0.7431148 0.7431547 0.7431945 0.7432343 0.7432739 0.7433134 0.7433528 [134] 0.7433921 0.7434313 0.7434704 0.7435093 0.7435482 0.7435869 0.7436255 [141] 0.7436641 0.7437025 0.7437408 0.7437789 0.7438170 0.7438550 0.7438929 [148] 0.7439306 0.7439682 0.7440058 0.7440432 0.7440805 0.7441177 0.7441548 [155] 0.7441917 0.7442286 0.7442654 0.7443020 0.7443386 0.7443750 0.7444113 [162] 0.7444475 0.7444836 0.7445196 0.7445555 0.7445912 0.7446269 0.7446624 [169] 0.7446979 0.7447332 0.7447684 0.7448035 0.7448385 0.7448734 0.7449082 [176] 0.7449429 0.7449775 0.7450119 0.7450462 0.7450805 0.7451146 0.7451486 [183] 0.7451825 0.7452163 0.7452500 0.7452836 0.7453171 0.7453504 0.7453837 [190] 0.7454168 0.7454499 0.7454828 0.7455156 0.7455483 0.7455809 0.7456134 [197] 0.7456458 0.7456780 0.7457102 0.7457422 0.7457742 0.7458060 0.7458378 [204] 0.7458694 0.7459009 0.7459323 0.7459636 0.7459948 0.7460258 0.7460568 [211] 0.7460876 0.7461184 0.7461490 0.7461796 0.7462100 0.7462403 0.7462705 [218] 0.7463006 0.7463306 0.7463605 0.7463903 0.7464199 0.7464495 0.7464789 [225] 0.7465083 0.7465375 0.7465666 0.7465957 0.7466246 0.7466534 0.7466821 [232] 0.7467106 0.7467391 0.7467675 0.7467958 0.7468239 0.7468520 0.7468799 [239] 0.7469077 0.7469354 0.7469631 0.7469906 0.7470180 0.7470453 0.7470725 [246] 0.7470995 0.7471265 0.7471534 0.7471801 0.7472068 0.7472333 0.7472598 [253] 0.7472861 0.7473123 0.7473384 0.7473644 0.7473903 0.7474161 0.7474418 [260] 0.7474674 0.7474929 0.7475182 0.7475435 0.7475686 0.7475937 0.7476186 [267] 0.7476435 0.7476682 0.7476928 0.7477173 0.7477417 0.7477660 0.7477902 [274] 0.7478143 0.7478383 0.7478622 0.7478859 0.7479096 0.7479331 0.7479566 [281] 0.7479799 0.7480032 0.7480263 0.7480493 0.7480722 0.7480951 0.7481178 [288] 0.7481404 0.7481629 0.7481852 0.7482075 0.7482297 0.7482518 0.7482737 [295] 0.7482956 0.7483174 0.7483390 0.7483606 0.7483820 0.7484033 0.7484246 [302] 0.7484457 0.7484667 0.7484876 0.7485084 0.7485291 0.7485497 0.7485702 [309] 0.7485906 0.7486109 0.7486311 0.7486511 0.7486711 0.7486910 0.7487107 [316] 0.7487304 0.7487499 0.7487694 0.7487887 0.7488079 0.7488271 0.7488461 [323] 0.7488650 0.7488838 0.7489025 0.7489212 0.7489397 0.7489581 0.7489764 [330] 0.7489945 0.7490126 0.7490306 0.7490485 0.7490663 0.7490839 0.7491015 [337] 0.7491190 0.7491363 0.7491536 0.7491707 0.7491878 0.7492047 0.7492216 [344] 0.7492383 0.7492549 0.7492715 0.7492879 0.7493042 0.7493204 0.7493366 [351] 0.7493526 0.7493685 0.7493843 0.7494000 0.7494156 0.7494311 0.7494465 [358] 0.7494618 0.7494770 0.7494921 0.7495071 0.7495219 0.7495367 0.7495514 [365] 0.7495660 0.7495804 0.7495948 0.7496091 0.7496232 0.7496373 0.7496513 [372] 0.7496651 0.7496789 0.7496925 0.7497061 0.7497195 0.7497329 0.7497461 [379] 0.7497593 0.7497723 0.7497852 0.7497981 0.7498108 0.7498234 0.7498360 [386] 0.7498484 0.7498607 0.7498730 0.7498851 0.7498971 0.7499090 0.7499208 [393] 0.7499326 0.7499442 0.7499557 0.7499671 0.7499784 0.7499896 0.7500008 [400] 0.7500118 0.7500227 > mx [1] 0.7500227 > 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/1yf581226432257.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/2t98y1226432257.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/32qmz1226432257.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/4p4i31226432257.tab") > > system("convert tmp/1yf581226432257.ps tmp/1yf581226432257.png") > system("convert tmp/2t98y1226432257.ps tmp/2t98y1226432257.png") > system("convert tmp/32qmz1226432257.ps tmp/32qmz1226432257.png") > > > proc.time() user system elapsed 1.883 0.859 1.995