R version 2.8.0 (2008-10-20) 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(98.8,100.5,110.4,96.4,101.9,106.2,81,94.7,101,109.4,102.3,90.7,96.2,96.1,106,103.1,102,104.7,86,92.1,106.9,112.6,101.7,92,97.4,97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3) > x <- c(128.7,136.9,156.9,109.1,122.3,123.9,90.9,77.9,120.3,118.9,125.5,98.9,102.9,105.9,117.6,113.6,115.9,118.9,77.6,81.2,123.1,136.6,112.1,95.1,96.3,105.7,115.8,105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.7,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105) > #'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.7054213 0.7059139 0.7064048 0.7068941 0.7073817 0.7078677 0.7083520 [8] 0.7088347 0.7093158 0.7097951 0.7102728 0.7107488 0.7112231 0.7116958 [15] 0.7121667 0.7126360 0.7131035 0.7135694 0.7140335 0.7144959 0.7149566 [22] 0.7154156 0.7158728 0.7163283 0.7167821 0.7172341 0.7176844 0.7181330 [29] 0.7185797 0.7190248 0.7194680 0.7199095 0.7203492 0.7207872 0.7212234 [36] 0.7216577 0.7220903 0.7225212 0.7229502 0.7233774 0.7238028 0.7242264 [43] 0.7246482 0.7250682 0.7254864 0.7259027 0.7263172 0.7267299 0.7271408 [50] 0.7275498 0.7279570 0.7283624 0.7287659 0.7291676 0.7295674 0.7299653 [57] 0.7303614 0.7307557 0.7311481 0.7315386 0.7319272 0.7323140 0.7326989 [64] 0.7330819 0.7334631 0.7338424 0.7342198 0.7345952 0.7349689 0.7353406 [71] 0.7357104 0.7360783 0.7364443 0.7368085 0.7371707 0.7375310 0.7378894 [78] 0.7382459 0.7386005 0.7389531 0.7393039 0.7396527 0.7399996 0.7403446 [85] 0.7406876 0.7410288 0.7413680 0.7417052 0.7420406 0.7423740 0.7427055 [92] 0.7430350 0.7433626 0.7436882 0.7440120 0.7443337 0.7446536 0.7449714 [99] 0.7452874 0.7456014 0.7459134 0.7462235 0.7465316 0.7468378 0.7471420 [106] 0.7474443 0.7477446 0.7480430 0.7483394 0.7486338 0.7489263 0.7492168 [113] 0.7495054 0.7497920 0.7500766 0.7503593 0.7506400 0.7509188 0.7511956 [120] 0.7514704 0.7517433 0.7520142 0.7522831 0.7525500 0.7528150 0.7530781 [127] 0.7533391 0.7535982 0.7538553 0.7541105 0.7543637 0.7546149 0.7548642 [134] 0.7551115 0.7553568 0.7556002 0.7558415 0.7560810 0.7563184 0.7565539 [141] 0.7567875 0.7570190 0.7572486 0.7574763 0.7577019 0.7579257 0.7581474 [148] 0.7583672 0.7585850 0.7588009 0.7590148 0.7592268 0.7594367 0.7596448 [155] 0.7598509 0.7600550 0.7602572 0.7604574 0.7606556 0.7608519 0.7610463 [162] 0.7612387 0.7614292 0.7616177 0.7618043 0.7619889 0.7621716 0.7623523 [169] 0.7625312 0.7627080 0.7628830 0.7630559 0.7632270 0.7633961 0.7635633 [176] 0.7637286 0.7638919 0.7640533 0.7642128 0.7643704 0.7645260 0.7646797 [183] 0.7648315 0.7649814 0.7651294 0.7652755 0.7654196 0.7655618 0.7657022 [190] 0.7658406 0.7659771 0.7661118 0.7662445 0.7663753 0.7665043 0.7666313 [197] 0.7667565 0.7668797 0.7670011 0.7671206 0.7672382 0.7673540 0.7674678 [204] 0.7675798 0.7676900 0.7677982 0.7679046 0.7680091 0.7681118 0.7682126 [211] 0.7683115 0.7684086 0.7685039 0.7685973 0.7686888 0.7687785 0.7688664 [218] 0.7689524 0.7690366 0.7691190 0.7691995 0.7692782 0.7693551 0.7694302 [225] 0.7695034 0.7695749 0.7696445 0.7697123 0.7697783 0.7698425 0.7699050 [232] 0.7699656 0.7700244 0.7700814 0.7701367 0.7701901 0.7702418 0.7702917 [239] 0.7703398 0.7703862 0.7704308 0.7704736 0.7705147 0.7705540 0.7705916 [246] 0.7706274 0.7706614 0.7706937 0.7707243 0.7707532 0.7707803 0.7708056 [253] 0.7708293 0.7708512 0.7708714 0.7708899 0.7709067 0.7709217 0.7709351 [260] 0.7709468 0.7709567 0.7709650 0.7709716 0.7709765 0.7709797 0.7709812 [267] 0.7709810 0.7709792 0.7709757 0.7709706 0.7709638 0.7709553 0.7709452 [274] 0.7709334 0.7709200 0.7709049 0.7708882 0.7708699 0.7708499 0.7708283 [281] 0.7708051 0.7707803 0.7707538 0.7707258 0.7706961 0.7706648 0.7706320 [288] 0.7705975 0.7705615 0.7705238 0.7704846 0.7704438 0.7704014 0.7703575 [295] 0.7703120 0.7702649 0.7702163 0.7701661 0.7701144 0.7700611 0.7700063 [302] 0.7699499 0.7698920 0.7698326 0.7697717 0.7697092 0.7696452 0.7695797 [309] 0.7695127 0.7694442 0.7693742 0.7693027 0.7692297 0.7691553 0.7690793 [316] 0.7690019 0.7689230 0.7688426 0.7687607 0.7686774 0.7685926 0.7685064 [323] 0.7684188 0.7683296 0.7682391 0.7681471 0.7680537 0.7679588 0.7678626 [330] 0.7677649 0.7676658 0.7675653 0.7674634 0.7673600 0.7672553 0.7671492 [337] 0.7670417 0.7669329 0.7668226 0.7667110 0.7665980 0.7664836 0.7663679 [344] 0.7662508 0.7661324 0.7660126 0.7658915 0.7657690 0.7656452 0.7655201 [351] 0.7653936 0.7652658 0.7651367 0.7650063 0.7648746 0.7647416 0.7646072 [358] 0.7644716 0.7643347 0.7641965 0.7640570 0.7639163 0.7637743 0.7636310 [365] 0.7634864 0.7633406 0.7631935 0.7630452 0.7628956 0.7627448 0.7625927 [372] 0.7624395 0.7622849 0.7621292 0.7619723 0.7618141 0.7616547 0.7614941 [379] 0.7613323 0.7611693 0.7610051 0.7608398 0.7606732 0.7605055 0.7603365 [386] 0.7601665 0.7599952 0.7598228 0.7596492 0.7594745 0.7592986 0.7591216 [393] 0.7589434 0.7587641 0.7585837 0.7584022 0.7582195 0.7580357 0.7578508 [400] 0.7576647 0.7574776 > mx [1] 0.7709812 > mxli [1] 0.65 > 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/1y1ky1257954085.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/2mwti1257954085.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/3cqmz1257954085.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/4rof51257954085.tab") > system("convert tmp/1y1ky1257954085.ps tmp/1y1ky1257954085.png") > system("convert tmp/2mwti1257954085.ps tmp/2mwti1257954085.png") > system("convert tmp/3cqmz1257954085.ps tmp/3cqmz1257954085.png") > > > proc.time() user system elapsed 1.271 0.853 1.435