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(114.9,110.9,125.5,116.8,116.8,125.5,104.2,115.1,132.8,123.3,124.8,122,117.4,117.9,137.4,114.6,124.7,129.6,109.4,120.9,134.9,136.3,133.2,127.2,122.7,120.5,137.8,119.1,124.3,134.4,121.1,122.2,127.7,137.4,132.2,129.2,124.9,124.8,128.2,134.4,118.6,132.6,123.2,112.8,138.7,137.3,122.3,136.9,117.1,115,130.4,118.7,113.7,126.2,114.4,112,127,128.7,127.5,125.7,114.8) > x <- c(94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1,104.5,105.1,95.1,88.7,86.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.7590666 0.7591810 0.7592952 0.7594092 0.7595231 0.7596367 0.7597502 [8] 0.7598635 0.7599766 0.7600896 0.7602023 0.7603149 0.7604273 0.7605395 [15] 0.7606515 0.7607633 0.7608750 0.7609865 0.7610978 0.7612089 0.7613198 [22] 0.7614305 0.7615411 0.7616515 0.7617616 0.7618717 0.7619815 0.7620911 [29] 0.7622006 0.7623098 0.7624189 0.7625278 0.7626366 0.7627451 0.7628534 [36] 0.7629616 0.7630696 0.7631774 0.7632850 0.7633924 0.7634997 0.7636067 [43] 0.7637136 0.7638203 0.7639268 0.7640331 0.7641392 0.7642452 0.7643509 [50] 0.7644565 0.7645619 0.7646671 0.7647721 0.7648770 0.7649816 0.7650861 [57] 0.7651903 0.7652944 0.7653983 0.7655020 0.7656056 0.7657089 0.7658120 [64] 0.7659150 0.7660178 0.7661204 0.7662228 0.7663250 0.7664270 0.7665289 [71] 0.7666305 0.7667320 0.7668333 0.7669344 0.7670353 0.7671360 0.7672366 [78] 0.7673369 0.7674371 0.7675370 0.7676368 0.7677364 0.7678358 0.7679351 [85] 0.7680341 0.7681329 0.7682316 0.7683301 0.7684283 0.7685264 0.7686243 [92] 0.7687221 0.7688196 0.7689169 0.7690141 0.7691110 0.7692078 0.7693044 [99] 0.7694008 0.7694970 0.7695930 0.7696889 0.7697845 0.7698800 0.7699752 [106] 0.7700703 0.7701652 0.7702599 0.7703544 0.7704487 0.7705429 0.7706368 [113] 0.7707306 0.7708241 0.7709175 0.7710107 0.7711037 0.7711965 0.7712891 [120] 0.7713815 0.7714738 0.7715658 0.7716577 0.7717494 0.7718409 0.7719322 [127] 0.7720233 0.7721142 0.7722049 0.7722954 0.7723858 0.7724760 0.7725659 [134] 0.7726557 0.7727453 0.7728347 0.7729239 0.7730129 0.7731018 0.7731904 [141] 0.7732789 0.7733671 0.7734552 0.7735431 0.7736308 0.7737183 0.7738056 [148] 0.7738927 0.7739797 0.7740664 0.7741530 0.7742393 0.7743255 0.7744115 [155] 0.7744973 0.7745829 0.7746683 0.7747536 0.7748386 0.7749234 0.7750081 [162] 0.7750926 0.7751769 0.7752610 0.7753449 0.7754286 0.7755121 0.7755954 [169] 0.7756786 0.7757615 0.7758443 0.7759269 0.7760093 0.7760915 0.7761735 [176] 0.7762553 0.7763369 0.7764183 0.7764996 0.7765807 0.7766615 0.7767422 [183] 0.7768227 0.7769030 0.7769831 0.7770630 0.7771428 0.7772223 0.7773017 [190] 0.7773808 0.7774598 0.7775386 0.7776172 0.7776956 0.7777738 0.7778519 [197] 0.7779297 0.7780074 0.7780848 0.7781621 0.7782392 0.7783161 0.7783928 [204] 0.7784693 0.7785457 0.7786218 0.7786978 0.7787735 0.7788491 0.7789245 [211] 0.7789997 0.7790747 0.7791495 0.7792241 0.7792986 0.7793728 0.7794469 [218] 0.7795208 0.7795945 0.7796680 0.7797413 0.7798144 0.7798874 0.7799601 [225] 0.7800327 0.7801050 0.7801772 0.7802492 0.7803210 0.7803927 0.7804641 [232] 0.7805353 0.7806064 0.7806773 0.7807480 0.7808184 0.7808888 0.7809589 [239] 0.7810288 0.7810986 0.7811681 0.7812375 0.7813067 0.7813757 0.7814445 [246] 0.7815131 0.7815815 0.7816498 0.7817178 0.7817857 0.7818534 0.7819209 [253] 0.7819882 0.7820553 0.7821223 0.7821890 0.7822556 0.7823220 0.7823882 [260] 0.7824542 0.7825200 0.7825857 0.7826511 0.7827164 0.7827814 0.7828463 [267] 0.7829110 0.7829756 0.7830399 0.7831041 0.7831680 0.7832318 0.7832954 [274] 0.7833588 0.7834220 0.7834851 0.7835479 0.7836106 0.7836731 0.7837354 [281] 0.7837975 0.7838594 0.7839211 0.7839827 0.7840441 0.7841053 0.7841663 [288] 0.7842271 0.7842877 0.7843482 0.7844084 0.7844685 0.7845284 0.7845881 [295] 0.7846477 0.7847070 0.7847662 0.7848252 0.7848840 0.7849426 0.7850010 [302] 0.7850593 0.7851173 0.7851752 0.7852329 0.7852904 0.7853478 0.7854049 [309] 0.7854619 0.7855187 0.7855753 0.7856317 0.7856879 0.7857440 0.7857998 [316] 0.7858555 0.7859110 0.7859664 0.7860215 0.7860765 0.7861313 0.7861859 [323] 0.7862403 0.7862945 0.7863486 0.7864025 0.7864562 0.7865097 0.7865630 [330] 0.7866162 0.7866691 0.7867219 0.7867745 0.7868270 0.7868792 0.7869313 [337] 0.7869832 0.7870349 0.7870864 0.7871377 0.7871889 0.7872399 0.7872907 [344] 0.7873413 0.7873918 0.7874421 0.7874922 0.7875421 0.7875918 0.7876414 [351] 0.7876907 0.7877399 0.7877890 0.7878378 0.7878865 0.7879350 0.7879833 [358] 0.7880314 0.7880793 0.7881271 0.7881747 0.7882221 0.7882694 0.7883164 [365] 0.7883633 0.7884100 0.7884566 0.7885029 0.7885491 0.7885951 0.7886409 [372] 0.7886866 0.7887320 0.7887773 0.7888225 0.7888674 0.7889122 0.7889568 [379] 0.7890012 0.7890454 0.7890895 0.7891334 0.7891771 0.7892206 0.7892640 [386] 0.7893072 0.7893502 0.7893930 0.7894357 0.7894782 0.7895205 0.7895626 [393] 0.7896046 0.7896464 0.7896880 0.7897294 0.7897707 0.7898118 0.7898527 [400] 0.7898935 0.7899341 > mx [1] 0.789934 > 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/1xvh91293410319.ps",horizontal=F,onefile=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/284yc1293410319.ps",horizontal=F,onefile=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/384yc1293410319.ps",horizontal=F,onefile=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/44ew21293410319.tab") > > try(system("convert tmp/1xvh91293410319.ps tmp/1xvh91293410319.png",intern=TRUE)) character(0) > try(system("convert tmp/284yc1293410319.ps tmp/284yc1293410319.png",intern=TRUE)) character(0) > try(system("convert tmp/384yc1293410319.ps tmp/384yc1293410319.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.801 0.520 1.746