R version 2.7.2 (2008-08-25) 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(123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.4) > x <- c(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.3,100.4) > #'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.6870422 0.6871100 0.6871772 0.6872437 0.6873095 0.6873746 0.6874391 [8] 0.6875030 0.6875661 0.6876286 0.6876904 0.6877515 0.6878120 0.6878718 [15] 0.6879310 0.6879894 0.6880472 0.6881043 0.6881608 0.6882166 0.6882717 [22] 0.6883261 0.6883799 0.6884330 0.6884854 0.6885371 0.6885882 0.6886386 [29] 0.6886883 0.6887373 0.6887857 0.6888334 0.6888804 0.6889267 0.6889724 [36] 0.6890174 0.6890617 0.6891053 0.6891482 0.6891905 0.6892321 0.6892730 [43] 0.6893132 0.6893528 0.6893917 0.6894299 0.6894674 0.6895042 0.6895404 [50] 0.6895759 0.6896106 0.6896448 0.6896782 0.6897109 0.6897430 0.6897744 [57] 0.6898051 0.6898351 0.6898645 0.6898931 0.6899211 0.6899484 0.6899750 [64] 0.6900009 0.6900262 0.6900507 0.6900746 0.6900978 0.6901203 0.6901421 [71] 0.6901633 0.6901837 0.6902035 0.6902226 0.6902410 0.6902587 0.6902758 [78] 0.6902921 0.6903078 0.6903228 0.6903371 0.6903507 0.6903636 0.6903758 [85] 0.6903874 0.6903983 0.6904085 0.6904180 0.6904268 0.6904349 0.6904424 [92] 0.6904491 0.6904552 0.6904606 0.6904653 0.6904693 0.6904727 0.6904753 [99] 0.6904773 0.6904786 0.6904792 0.6904791 0.6904783 0.6904769 0.6904747 [106] 0.6904719 0.6904684 0.6904642 0.6904593 0.6904538 0.6904475 0.6904406 [113] 0.6904330 0.6904247 0.6904157 0.6904060 0.6903957 0.6903847 0.6903730 [120] 0.6903606 0.6903475 0.6903337 0.6903193 0.6903041 0.6902883 0.6902719 [127] 0.6902547 0.6902368 0.6902183 0.6901991 0.6901792 0.6901586 0.6901373 [134] 0.6901154 0.6900928 0.6900695 0.6900455 0.6900208 0.6899955 0.6899695 [141] 0.6899428 0.6899154 0.6898874 0.6898586 0.6898292 0.6897991 0.6897684 [148] 0.6897369 0.6897048 0.6896720 0.6896385 0.6896044 0.6895696 0.6895341 [155] 0.6894979 0.6894611 0.6894235 0.6893853 0.6893465 0.6893069 0.6892667 [162] 0.6892258 0.6891843 0.6891420 0.6890991 0.6890556 0.6890113 0.6889664 [169] 0.6889208 0.6888745 0.6888276 0.6887800 0.6887318 0.6886828 0.6886332 [176] 0.6885830 0.6885320 0.6884804 0.6884282 0.6883752 0.6883216 0.6882674 [183] 0.6882124 0.6881568 0.6881006 0.6880437 0.6879861 0.6879279 0.6878689 [190] 0.6878094 0.6877492 0.6876883 0.6876267 0.6875645 0.6875017 0.6874381 [197] 0.6873739 0.6873091 0.6872436 0.6871775 0.6871107 0.6870432 0.6869751 [204] 0.6869063 0.6868369 0.6867668 0.6866961 0.6866247 0.6865526 0.6864800 [211] 0.6864066 0.6863326 0.6862580 0.6861827 0.6861068 0.6860302 0.6859530 [218] 0.6858751 0.6857966 0.6857174 0.6856376 0.6855572 0.6854761 0.6853943 [225] 0.6853119 0.6852289 0.6851453 0.6850610 0.6849760 0.6848904 0.6848042 [232] 0.6847174 0.6846299 0.6845417 0.6844530 0.6843636 0.6842735 0.6841828 [239] 0.6840915 0.6839996 0.6839070 0.6838138 0.6837200 0.6836255 0.6835304 [246] 0.6834347 0.6833384 0.6832414 0.6831438 0.6830456 0.6829467 0.6828473 [253] 0.6827472 0.6826465 0.6825451 0.6824432 0.6823406 0.6822374 0.6821335 [260] 0.6820291 0.6819240 0.6818184 0.6817121 0.6816052 0.6814977 0.6813895 [267] 0.6812808 0.6811714 0.6810615 0.6809509 0.6808397 0.6807279 0.6806155 [274] 0.6805025 0.6803888 0.6802746 0.6801598 0.6800444 0.6799283 0.6798117 [281] 0.6796944 0.6795766 0.6794581 0.6793391 0.6792195 0.6790992 0.6789784 [288] 0.6788569 0.6787349 0.6786123 0.6784891 0.6783653 0.6782409 0.6781159 [295] 0.6779903 0.6778641 0.6777374 0.6776100 0.6774821 0.6773536 0.6772245 [302] 0.6770948 0.6769645 0.6768337 0.6767023 0.6765702 0.6764377 0.6763045 [309] 0.6761707 0.6760364 0.6759015 0.6757660 0.6756300 0.6754934 0.6753562 [316] 0.6752184 0.6750801 0.6749412 0.6748017 0.6746617 0.6745211 0.6743799 [323] 0.6742382 0.6740959 0.6739530 0.6738096 0.6736656 0.6735211 0.6733760 [330] 0.6732303 0.6730841 0.6729373 0.6727900 0.6726421 0.6724937 0.6723447 [337] 0.6721951 0.6720450 0.6718944 0.6717432 0.6715915 0.6714392 0.6712864 [344] 0.6711330 0.6709791 0.6708246 0.6706696 0.6705141 0.6703580 0.6702014 [351] 0.6700443 0.6698866 0.6697284 0.6695696 0.6694103 0.6692505 0.6690902 [358] 0.6689293 0.6687679 0.6686059 0.6684435 0.6682805 0.6681169 0.6679529 [365] 0.6677883 0.6676233 0.6674577 0.6672915 0.6671249 0.6669577 0.6667901 [372] 0.6666219 0.6664532 0.6662839 0.6661142 0.6659440 0.6657732 0.6656019 [379] 0.6654302 0.6652579 0.6650851 0.6649118 0.6647380 0.6645637 0.6643889 [386] 0.6642136 0.6640378 0.6638616 0.6636848 0.6635075 0.6633297 0.6631514 [393] 0.6629727 0.6627934 0.6626136 0.6624334 0.6622527 0.6620715 0.6618898 [400] 0.6617076 0.6615249 > mx [1] 0.6904792 > mxli [1] -1 > 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/1czob1226610162.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/2r17y1226610162.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/3c56u1226610162.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/4x6291226610162.tab") > > system("convert tmp/1czob1226610162.ps tmp/1czob1226610162.png") > system("convert tmp/2r17y1226610162.ps tmp/2r17y1226610162.png") > system("convert tmp/3c56u1226610162.ps tmp/3c56u1226610162.png") > > > proc.time() user system elapsed 1.004 0.498 1.285