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(95.9,95.3,100.4,97.3,82.3,97.0,93.5,90.9,107.8,110.9,98.1,106.5,93.4,95.7,109.0,97.6,92.7,107.5,91.7,95.7,111.4,106.0,104.8,108.7,97.3,97.1,106.1,98.6,98.5,105.5,86.2,98.3,111.3,105.0,105.7,103.5,96.9,98.1,111.7,94.7,104.2,109.7,91.3,102.6,114.2,115.8,113.5,107.1,104.5,101.9,116.0,102.0,108.1,112.9,104.5,109.1,113.4,123.9,117.7,108.3) > x <- c(93.0,99.2,112.2,112.1,103.3,108.2,90.4,72.8,111.0,117.9,111.3,110.5,94.8,100.4,132.1,114.6,101.9,130.2,84.0,86.4,122.3,120.9,110.2,112.6,102.0,105.0,130.5,115.5,103.7,130.9,89.1,93.8,123.8,111.9,118.3,116.9,103.6,116.6,141.3,107.0,125.2,136.4,91.6,95.3,132.3,130.6,131.9,118.6,114.3,111.3,126.5,112.1,119.3,142.4,101.1,97.4,129.1,136.9,129.8,123.9) > #'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.7380308 0.7383682 0.7387048 0.7390405 0.7393753 0.7397092 0.7400422 [8] 0.7403743 0.7407054 0.7410357 0.7413651 0.7416936 0.7420212 0.7423479 [15] 0.7426737 0.7429986 0.7433225 0.7436456 0.7439678 0.7442890 0.7446094 [22] 0.7449288 0.7452474 0.7455650 0.7458817 0.7461975 0.7465124 0.7468264 [29] 0.7471395 0.7474517 0.7477629 0.7480733 0.7483827 0.7486912 0.7489988 [36] 0.7493055 0.7496113 0.7499162 0.7502201 0.7505232 0.7508253 0.7511265 [43] 0.7514268 0.7517262 0.7520246 0.7523222 0.7526188 0.7529145 0.7532093 [50] 0.7535032 0.7537961 0.7540882 0.7543793 0.7546695 0.7549588 0.7552471 [57] 0.7555346 0.7558211 0.7561067 0.7563914 0.7566752 0.7569580 0.7572400 [64] 0.7575210 0.7578011 0.7580802 0.7583585 0.7586358 0.7589122 0.7591877 [71] 0.7594623 0.7597360 0.7600087 0.7602805 0.7605514 0.7608214 0.7610904 [78] 0.7613586 0.7616258 0.7618921 0.7621574 0.7624219 0.7626854 0.7629480 [85] 0.7632097 0.7634705 0.7637304 0.7639893 0.7642473 0.7645044 0.7647606 [92] 0.7650159 0.7652702 0.7655237 0.7657762 0.7660278 0.7662785 0.7665282 [99] 0.7667771 0.7670250 0.7672720 0.7675181 0.7677633 0.7680075 0.7682509 [106] 0.7684933 0.7687348 0.7689754 0.7692151 0.7694539 0.7696918 0.7699287 [113] 0.7701648 0.7703999 0.7706341 0.7708674 0.7710998 0.7713313 0.7715619 [120] 0.7717915 0.7720203 0.7722481 0.7724751 0.7727011 0.7729262 0.7731504 [127] 0.7733737 0.7735961 0.7738176 0.7740382 0.7742579 0.7744767 0.7746946 [134] 0.7749115 0.7751276 0.7753428 0.7755570 0.7757704 0.7759829 0.7761944 [141] 0.7764051 0.7766148 0.7768237 0.7770317 0.7772387 0.7774449 0.7776502 [148] 0.7778546 0.7780581 0.7782607 0.7784624 0.7786632 0.7788631 0.7790621 [155] 0.7792602 0.7794575 0.7796538 0.7798493 0.7800438 0.7802375 0.7804303 [162] 0.7806222 0.7808132 0.7810034 0.7811926 0.7813810 0.7815685 0.7817551 [169] 0.7819408 0.7821257 0.7823096 0.7824927 0.7826749 0.7828562 0.7830367 [176] 0.7832163 0.7833950 0.7835728 0.7837497 0.7839258 0.7841010 0.7842754 [183] 0.7844488 0.7846214 0.7847931 0.7849640 0.7851340 0.7853031 0.7854714 [190] 0.7856387 0.7858053 0.7859709 0.7861357 0.7862997 0.7864627 0.7866250 [197] 0.7867863 0.7869468 0.7871065 0.7872653 0.7874232 0.7875803 0.7877365 [204] 0.7878919 0.7880464 0.7882000 0.7883529 0.7885048 0.7886560 0.7888062 [211] 0.7889557 0.7891042 0.7892520 0.7893989 0.7895449 0.7896901 0.7898345 [218] 0.7899780 0.7901207 0.7902626 0.7904036 0.7905438 0.7906831 0.7908217 [225] 0.7909593 0.7910962 0.7912322 0.7913674 0.7915018 0.7916353 0.7917680 [232] 0.7918999 0.7920309 0.7921612 0.7922906 0.7924192 0.7925469 0.7926739 [239] 0.7928000 0.7929253 0.7930498 0.7931735 0.7932964 0.7934184 0.7935396 [246] 0.7936601 0.7937797 0.7938985 0.7940165 0.7941337 0.7942501 0.7943657 [253] 0.7944804 0.7945944 0.7947076 0.7948200 0.7949316 0.7950423 0.7951523 [260] 0.7952615 0.7953699 0.7954775 0.7955843 0.7956903 0.7957955 0.7958999 [267] 0.7960036 0.7961064 0.7962085 0.7963098 0.7964103 0.7965100 0.7966089 [274] 0.7967071 0.7968045 0.7969011 0.7969969 0.7970919 0.7971862 0.7972797 [281] 0.7973724 0.7974644 0.7975556 0.7976460 0.7977356 0.7978245 0.7979126 [288] 0.7980000 0.7980865 0.7981724 0.7982574 0.7983417 0.7984253 0.7985081 [295] 0.7985901 0.7986714 0.7987519 0.7988316 0.7989107 0.7989889 0.7990664 [302] 0.7991432 0.7992192 0.7992945 0.7993690 0.7994428 0.7995159 0.7995882 [309] 0.7996597 0.7997305 0.7998006 0.7998700 0.7999386 0.8000065 0.8000736 [316] 0.8001400 0.8002057 0.8002707 0.8003349 0.8003984 0.8004612 0.8005233 [323] 0.8005846 0.8006452 0.8007051 0.8007643 0.8008227 0.8008804 0.8009375 [330] 0.8009938 0.8010493 0.8011042 0.8011584 0.8012118 0.8012646 0.8013166 [337] 0.8013680 0.8014186 0.8014685 0.8015177 0.8015663 0.8016141 0.8016612 [344] 0.8017076 0.8017534 0.8017984 0.8018427 0.8018864 0.8019293 0.8019716 [351] 0.8020132 0.8020541 0.8020943 0.8021338 0.8021726 0.8022108 0.8022482 [358] 0.8022850 0.8023211 0.8023565 0.8023913 0.8024254 0.8024588 0.8024915 [365] 0.8025236 0.8025549 0.8025857 0.8026157 0.8026451 0.8026738 0.8027019 [372] 0.8027292 0.8027560 0.8027820 0.8028074 0.8028322 0.8028563 0.8028797 [379] 0.8029025 0.8029246 0.8029461 0.8029669 0.8029871 0.8030066 0.8030255 [386] 0.8030437 0.8030613 0.8030782 0.8030945 0.8031102 0.8031252 0.8031396 [393] 0.8031533 0.8031664 0.8031789 0.8031907 0.8032019 0.8032125 0.8032225 [400] 0.8032318 0.8032405 > mx [1] 0.8032405 > 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/1qxwp1228487361.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/2llk01228487361.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/3ore41228487361.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/4gocv1228487361.tab") > > system("convert tmp/1qxwp1228487361.ps tmp/1qxwp1228487361.png") > system("convert tmp/2llk01228487361.ps tmp/2llk01228487361.png") > system("convert tmp/3ore41228487361.ps tmp/3ore41228487361.png") > > > proc.time() user system elapsed 1.867 0.830 1.980