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(78.4,114.6,113.3,117.0,99.6,99.4,101.9,115.2,108.5,113.8,121.0,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98.0,106.6,90.1,96.9,125.9,112.0,100.0,123.9,79.8,83.4,113.6,112.9,104.0,109.9,99.0,106.3,128.9,111.1,102.9,130.0,87.0,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137.0,91.0,90.5,122.4,123.3,124.3,120.0,118.1,119.0,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128.0,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > x <- c(97.8,107.4,117.5,105.6,97.4,99.5,98.0,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117.0,103.8,100.8,110.6,104.0,112.6,107.3,98.9,109.8,104.9,102.2,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.0,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128.0,129.6,125.8,119.5,115.7,113.6,129.7,112.0,116.8,127.0,112.1,114.2,121.1,131.6,125.0,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.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.6797271 0.6797685 0.6798099 0.6798511 0.6798922 0.6799331 0.6799739 [8] 0.6800146 0.6800551 0.6800956 0.6801359 0.6801760 0.6802160 0.6802559 [15] 0.6802957 0.6803353 0.6803748 0.6804142 0.6804534 0.6804925 0.6805315 [22] 0.6805703 0.6806090 0.6806476 0.6806861 0.6807244 0.6807625 0.6808006 [29] 0.6808385 0.6808763 0.6809139 0.6809514 0.6809888 0.6810261 0.6810632 [36] 0.6811002 0.6811370 0.6811737 0.6812103 0.6812468 0.6812831 0.6813193 [43] 0.6813553 0.6813912 0.6814270 0.6814627 0.6814982 0.6815336 0.6815688 [50] 0.6816039 0.6816389 0.6816738 0.6817085 0.6817431 0.6817775 0.6818118 [57] 0.6818460 0.6818800 0.6819140 0.6819477 0.6819814 0.6820149 0.6820483 [64] 0.6820815 0.6821146 0.6821476 0.6821804 0.6822131 0.6822457 0.6822781 [71] 0.6823104 0.6823426 0.6823746 0.6824065 0.6824382 0.6824699 0.6825013 [78] 0.6825327 0.6825639 0.6825950 0.6826259 0.6826568 0.6826874 0.6827180 [85] 0.6827484 0.6827786 0.6828088 0.6828388 0.6828686 0.6828984 0.6829280 [92] 0.6829574 0.6829867 0.6830159 0.6830450 0.6830739 0.6831027 0.6831313 [99] 0.6831598 0.6831882 0.6832164 0.6832445 0.6832725 0.6833003 0.6833280 [106] 0.6833555 0.6833830 0.6834102 0.6834374 0.6834644 0.6834913 0.6835180 [113] 0.6835446 0.6835711 0.6835974 0.6836236 0.6836496 0.6836756 0.6837013 [120] 0.6837270 0.6837525 0.6837779 0.6838031 0.6838282 0.6838531 0.6838780 [127] 0.6839027 0.6839272 0.6839516 0.6839759 0.6840000 0.6840240 0.6840479 [134] 0.6840716 0.6840952 0.6841187 0.6841420 0.6841652 0.6841882 0.6842111 [141] 0.6842339 0.6842565 0.6842790 0.6843014 0.6843236 0.6843457 0.6843676 [148] 0.6843894 0.6844111 0.6844326 0.6844540 0.6844753 0.6844964 0.6845173 [155] 0.6845382 0.6845589 0.6845795 0.6845999 0.6846202 0.6846403 0.6846604 [162] 0.6846802 0.6847000 0.6847196 0.6847391 0.6847584 0.6847776 0.6847966 [169] 0.6848155 0.6848343 0.6848530 0.6848715 0.6848898 0.6849081 0.6849261 [176] 0.6849441 0.6849619 0.6849796 0.6849971 0.6850145 0.6850318 0.6850489 [183] 0.6850659 0.6850827 0.6850994 0.6851160 0.6851324 0.6851487 0.6851649 [190] 0.6851809 0.6851968 0.6852125 0.6852281 0.6852436 0.6852589 0.6852741 [197] 0.6852892 0.6853041 0.6853189 0.6853335 0.6853480 0.6853624 0.6853766 [204] 0.6853907 0.6854046 0.6854184 0.6854321 0.6854456 0.6854590 0.6854723 [211] 0.6854854 0.6854984 0.6855112 0.6855239 0.6855365 0.6855489 0.6855612 [218] 0.6855733 0.6855854 0.6855972 0.6856090 0.6856206 0.6856320 0.6856433 [225] 0.6856545 0.6856656 0.6856765 0.6856872 0.6856979 0.6857084 0.6857187 [232] 0.6857289 0.6857390 0.6857489 0.6857587 0.6857684 0.6857779 0.6857873 [239] 0.6857966 0.6858057 0.6858146 0.6858235 0.6858322 0.6858407 0.6858492 [246] 0.6858574 0.6858656 0.6858736 0.6858815 0.6858892 0.6858968 0.6859042 [253] 0.6859115 0.6859187 0.6859258 0.6859327 0.6859394 0.6859460 0.6859525 [260] 0.6859589 0.6859651 0.6859712 0.6859771 0.6859829 0.6859886 0.6859941 [267] 0.6859995 0.6860047 0.6860098 0.6860148 0.6860196 0.6860243 0.6860289 [274] 0.6860333 0.6860376 0.6860417 0.6860457 0.6860496 0.6860533 0.6860569 [281] 0.6860604 0.6860637 0.6860669 0.6860699 0.6860728 0.6860756 0.6860782 [288] 0.6860807 0.6860831 0.6860853 0.6860874 0.6860893 0.6860911 0.6860928 [295] 0.6860943 0.6860957 0.6860970 0.6860981 0.6860991 0.6860999 0.6861006 [302] 0.6861012 0.6861016 0.6861019 0.6861021 0.6861021 0.6861020 0.6861017 [309] 0.6861014 0.6861008 0.6861002 0.6860994 0.6860984 0.6860974 0.6860962 [316] 0.6860948 0.6860933 0.6860917 0.6860900 0.6860881 0.6860860 0.6860839 [323] 0.6860816 0.6860791 0.6860766 0.6860738 0.6860710 0.6860680 0.6860649 [330] 0.6860616 0.6860582 0.6860547 0.6860511 0.6860473 0.6860433 0.6860392 [337] 0.6860350 0.6860307 0.6860262 0.6860216 0.6860168 0.6860119 0.6860069 [344] 0.6860018 0.6859965 0.6859910 0.6859855 0.6859798 0.6859739 0.6859680 [351] 0.6859618 0.6859556 0.6859492 0.6859427 0.6859361 0.6859293 0.6859223 [358] 0.6859153 0.6859081 0.6859008 0.6858933 0.6858857 0.6858780 0.6858701 [365] 0.6858621 0.6858540 0.6858457 0.6858373 0.6858288 0.6858201 0.6858113 [372] 0.6858023 0.6857932 0.6857840 0.6857747 0.6857652 0.6857556 0.6857458 [379] 0.6857359 0.6857259 0.6857158 0.6857055 0.6856951 0.6856845 0.6856738 [386] 0.6856630 0.6856520 0.6856410 0.6856297 0.6856184 0.6856069 0.6855952 [393] 0.6855835 0.6855716 0.6855596 0.6855474 0.6855351 0.6855227 0.6855101 [400] 0.6854974 0.6854846 > mx [1] 0.6861021 > mxli [1] 1.05 > 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/1odus1226503007.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/2yrut1226503007.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/3rsp31226503007.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/4q3sd1226503007.tab") > > system("convert tmp/1odus1226503007.ps tmp/1odus1226503007.png") > system("convert tmp/2yrut1226503007.ps tmp/2yrut1226503007.png") > system("convert tmp/3rsp31226503007.ps tmp/3rsp31226503007.png") > > > proc.time() user system elapsed 1.865 0.825 1.992