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(8.3,8.2,8,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9) > x <- c(20.7,21.2,20.7,19.6,18.6,18.7,23.8,24.9,24.8,23.8,22.3,21.7,20.7,19.7,18.4,17.4,17,18,23.8,25.5,25.6,23.7,22,21.3,20.7,20.4,20.3,20.4,19.8,19.5,23.1,23.5,23.5,22.9,21.9,21.5,20.5,20.2,19.4,19.2,18.8,18.8,22.6,23.3,23,21.4,19.9,18.8,18.6,18.4,18.6,19.9,19.2,18.4,21.1,20.5,19.1,18.1,17,17.1,17.4,16.8,15.3,14.3,13.4,15.3,22.1,23.7,22.2,19.5,16.6,17.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.8021895 0.8022205 0.8022506 0.8022797 0.8023080 0.8023353 0.8023617 [8] 0.8023871 0.8024117 0.8024353 0.8024580 0.8024798 0.8025007 0.8025207 [15] 0.8025397 0.8025578 0.8025750 0.8025913 0.8026067 0.8026212 0.8026348 [22] 0.8026474 0.8026591 0.8026700 0.8026799 0.8026889 0.8026970 0.8027041 [29] 0.8027104 0.8027158 0.8027203 0.8027238 0.8027265 0.8027282 0.8027291 [36] 0.8027290 0.8027281 0.8027262 0.8027234 0.8027198 0.8027152 0.8027098 [43] 0.8027034 0.8026962 0.8026880 0.8026790 0.8026691 0.8026583 0.8026466 [50] 0.8026340 0.8026205 0.8026061 0.8025908 0.8025747 0.8025577 0.8025397 [57] 0.8025209 0.8025013 0.8024807 0.8024592 0.8024369 0.8024137 0.8023896 [64] 0.8023647 0.8023389 0.8023122 0.8022846 0.8022561 0.8022268 0.8021966 [71] 0.8021656 0.8021337 0.8021009 0.8020672 0.8020327 0.8019973 0.8019611 [78] 0.8019240 0.8018860 0.8018472 0.8018076 0.8017670 0.8017257 0.8016834 [85] 0.8016403 0.8015964 0.8015516 0.8015060 0.8014595 0.8014122 0.8013641 [92] 0.8013151 0.8012652 0.8012145 0.8011630 0.8011107 0.8010575 0.8010035 [99] 0.8009486 0.8008929 0.8008364 0.8007791 0.8007209 0.8006619 0.8006021 [106] 0.8005415 0.8004800 0.8004177 0.8003546 0.8002907 0.8002260 0.8001604 [113] 0.8000941 0.8000269 0.7999590 0.7998902 0.7998206 0.7997502 0.7996790 [120] 0.7996070 0.7995343 0.7994607 0.7993863 0.7993111 0.7992351 0.7991584 [127] 0.7990808 0.7990025 0.7989234 0.7988435 0.7987628 0.7986813 0.7985990 [134] 0.7985160 0.7984322 0.7983476 0.7982623 0.7981761 0.7980892 0.7980016 [141] 0.7979131 0.7978239 0.7977340 0.7976433 0.7975518 0.7974595 0.7973665 [148] 0.7972728 0.7971783 0.7970830 0.7969870 0.7968903 0.7967928 0.7966946 [155] 0.7965956 0.7964959 0.7963954 0.7962942 0.7961923 0.7960896 0.7959862 [162] 0.7958821 0.7957772 0.7956717 0.7955654 0.7954583 0.7953506 0.7952421 [169] 0.7951330 0.7950231 0.7949125 0.7948011 0.7946891 0.7945764 0.7944630 [176] 0.7943488 0.7942340 0.7941184 0.7940022 0.7938853 0.7937676 0.7936493 [183] 0.7935303 0.7934106 0.7932902 0.7931691 0.7930474 0.7929250 0.7928018 [190] 0.7926781 0.7925536 0.7924285 0.7923026 0.7921762 0.7920490 0.7919212 [197] 0.7917928 0.7916636 0.7915338 0.7914034 0.7912723 0.7911405 0.7910081 [204] 0.7908751 0.7907414 0.7906070 0.7904720 0.7903364 0.7902001 0.7900632 [211] 0.7899256 0.7897875 0.7896487 0.7895092 0.7893691 0.7892285 0.7890871 [218] 0.7889452 0.7888026 0.7886595 0.7885157 0.7883713 0.7882263 0.7880806 [225] 0.7879344 0.7877876 0.7876401 0.7874921 0.7873435 0.7871942 0.7870444 [232] 0.7868940 0.7867430 0.7865913 0.7864392 0.7862864 0.7861330 0.7859791 [239] 0.7858246 0.7856695 0.7855138 0.7853576 0.7852007 0.7850434 0.7848854 [246] 0.7847269 0.7845678 0.7844082 0.7842480 0.7840873 0.7839259 0.7837641 [253] 0.7836017 0.7834387 0.7832752 0.7831112 0.7829466 0.7827815 0.7826158 [260] 0.7824496 0.7822829 0.7821156 0.7819478 0.7817795 0.7816107 0.7814413 [267] 0.7812714 0.7811010 0.7809300 0.7807586 0.7805866 0.7804142 0.7802412 [274] 0.7800677 0.7798937 0.7797192 0.7795442 0.7793687 0.7791928 0.7790163 [281] 0.7788393 0.7786618 0.7784839 0.7783054 0.7781265 0.7779471 0.7777672 [288] 0.7775868 0.7774060 0.7772247 0.7770429 0.7768606 0.7766779 0.7764947 [295] 0.7763110 0.7761269 0.7759423 0.7757573 0.7755718 0.7753858 0.7751994 [302] 0.7750126 0.7748253 0.7746375 0.7744493 0.7742607 0.7740716 0.7738821 [309] 0.7736922 0.7735018 0.7733110 0.7731197 0.7729281 0.7727360 0.7725434 [316] 0.7723505 0.7721571 0.7719634 0.7717692 0.7715745 0.7713795 0.7711841 [323] 0.7709883 0.7707920 0.7705954 0.7703983 0.7702008 0.7700030 0.7698048 [330] 0.7696061 0.7694071 0.7692077 0.7690078 0.7688076 0.7686071 0.7684061 [337] 0.7682047 0.7680030 0.7678009 0.7675984 0.7673956 0.7671924 0.7669888 [344] 0.7667848 0.7665805 0.7663758 0.7661708 0.7659654 0.7657596 0.7655535 [351] 0.7653470 0.7651402 0.7649330 0.7647255 0.7645177 0.7643095 0.7641009 [358] 0.7638920 0.7636828 0.7634732 0.7632633 0.7630531 0.7628425 0.7626316 [365] 0.7624204 0.7622089 0.7619970 0.7617848 0.7615723 0.7613595 0.7611463 [372] 0.7609329 0.7607191 0.7605050 0.7602906 0.7600759 0.7598609 0.7596456 [379] 0.7594300 0.7592141 0.7589979 0.7587814 0.7585647 0.7583476 0.7581302 [386] 0.7579125 0.7576946 0.7574764 0.7572578 0.7570390 0.7568200 0.7566006 [393] 0.7563810 0.7561611 0.7559409 0.7557204 0.7554997 0.7552787 0.7550575 [400] 0.7548360 0.7546142 > mx [1] 0.802729 > mxli [1] -1.66 > 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/16osm1258128312.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/2nwxu1258128312.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/3u3bv1258128312.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/41v791258128312.tab") > > system("convert tmp/16osm1258128312.ps tmp/16osm1258128312.png") > system("convert tmp/2nwxu1258128312.ps tmp/2nwxu1258128312.png") > system("convert tmp/3u3bv1258128312.ps tmp/3u3bv1258128312.png") > > > proc.time() user system elapsed 0.791 0.509 1.326