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(126.51,131.02,136.51,138.04,132.92,129.61,122.96,124.04,121.29,124.56,118.53,113.14,114.15,122.17,129.23,131.19,129.12,128.28,126.83,138.13,140.52,146.83,135.14,131.84,125.7,128.98,133.25,136.76,133.24,128.54,121.08,120.23,119.08,125.75,126.89,126.6,121.89,123.44,126.46,129.49,127.78,125.29,119.02,119.96,122.86,131.89,132.73,135.01,136.71,142.73,144.43,144.93,138.75,130.22,122.19,128.4,140.43,153.5,149.33,142.97) > x <- c(150.85,147.79,141.96,148.39,147.71,150.6,151.18,152.24,157.19,154.62,157.22,159.7,160.55,149.66,151.69,154.13,151.48,153.34,155.8,158.87,156.09,156.3,156.4,154.09,161.32,160.12,155.17,154.51,151.38,152.59,153.98,154.91,153.01,155.09,155.53,161.86,166.03,164.54,164.33,163.21,159.95,164.18,167.13,166.8,166.29,168.07,167.1,163.53,168.28,169.07,165.84,163.88,157.33,161,163.54,161.21,158.92,160.18,159.9,164.46) > #'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.03821977 0.03824512 0.03827045 0.03829577 0.03832107 0.03834636 [7] 0.03837164 0.03839690 0.03842214 0.03844738 0.03847260 0.03849780 [13] 0.03852299 0.03854817 0.03857333 0.03859848 0.03862361 0.03864873 [19] 0.03867383 0.03869893 0.03872400 0.03874906 0.03877411 0.03879915 [25] 0.03882417 0.03884917 0.03887417 0.03889914 0.03892411 0.03894906 [31] 0.03897399 0.03899892 0.03902382 0.03904872 0.03907359 0.03909846 [37] 0.03912331 0.03914815 0.03917297 0.03919778 0.03922257 0.03924735 [43] 0.03927212 0.03929687 0.03932161 0.03934633 0.03937104 0.03939574 [49] 0.03942042 0.03944509 0.03946974 0.03949438 0.03951900 0.03954361 [55] 0.03956821 0.03959279 0.03961736 0.03964192 0.03966646 0.03969098 [61] 0.03971550 0.03973999 0.03976448 0.03978895 0.03981340 0.03983785 [67] 0.03986227 0.03988669 0.03991109 0.03993547 0.03995984 0.03998420 [73] 0.04000855 0.04003287 0.04005719 0.04008149 0.04010578 0.04013005 [79] 0.04015431 0.04017856 0.04020279 0.04022700 0.04025121 0.04027539 [85] 0.04029957 0.04032373 0.04034788 0.04037201 0.04039613 0.04042023 [91] 0.04044432 0.04046840 0.04049246 0.04051651 0.04054054 0.04056456 [97] 0.04058857 0.04061256 0.04063654 0.04066051 0.04068446 0.04070839 [103] 0.04073231 0.04075622 0.04078012 0.04080400 0.04082786 0.04085172 [109] 0.04087555 0.04089938 0.04092319 0.04094698 0.04097077 0.04099454 [115] 0.04101829 0.04104203 0.04106576 0.04108947 0.04111317 0.04113685 [121] 0.04116052 0.04118418 0.04120782 0.04123145 0.04125506 0.04127866 [127] 0.04130225 0.04132582 0.04134938 0.04137293 0.04139646 0.04141998 [133] 0.04144348 0.04146697 0.04149044 0.04151390 0.04153735 0.04156078 [139] 0.04158420 0.04160761 0.04163100 0.04165438 0.04167774 0.04170109 [145] 0.04172443 0.04174775 0.04177106 0.04179435 0.04181763 0.04184090 [151] 0.04186415 0.04188739 0.04191062 0.04193383 0.04195702 0.04198021 [157] 0.04200338 0.04202653 0.04204967 0.04207280 0.04209591 0.04211901 [163] 0.04214210 0.04216517 0.04218823 0.04221128 0.04223431 0.04225732 [169] 0.04228033 0.04230331 0.04232629 0.04234925 0.04237220 0.04239513 [175] 0.04241805 0.04244096 0.04246385 0.04248673 0.04250959 0.04253244 [181] 0.04255528 0.04257810 0.04260091 0.04262371 0.04264649 0.04266926 [187] 0.04269201 0.04271475 0.04273748 0.04276019 0.04278289 0.04280558 [193] 0.04282825 0.04285091 0.04287355 0.04289618 0.04291880 0.04294140 [199] 0.04296399 0.04298656 0.04300913 0.04303167 0.04305421 0.04307673 [205] 0.04309923 0.04312173 0.04314420 0.04316667 0.04318912 0.04321156 [211] 0.04323398 0.04325639 0.04327879 0.04330117 0.04332354 0.04334590 [217] 0.04336824 0.04339057 0.04341288 0.04343518 0.04345747 0.04347974 [223] 0.04350200 0.04352425 0.04354648 0.04356870 0.04359090 0.04361310 [229] 0.04363527 0.04365744 0.04367959 0.04370172 0.04372385 0.04374596 [235] 0.04376805 0.04379013 0.04381220 0.04383426 0.04385630 0.04387833 [241] 0.04390034 0.04392234 0.04394433 0.04396630 0.04398826 0.04401021 [247] 0.04403214 0.04405406 0.04407596 0.04409785 0.04411973 0.04414160 [253] 0.04416345 0.04418528 0.04420711 0.04422892 0.04425071 0.04427250 [259] 0.04429427 0.04431602 0.04433777 0.04435949 0.04438121 0.04440291 [265] 0.04442460 0.04444627 0.04446793 0.04448958 0.04451122 0.04453284 [271] 0.04455444 0.04457604 0.04459762 0.04461918 0.04464074 0.04466228 [277] 0.04468380 0.04470531 0.04472681 0.04474830 0.04476977 0.04479123 [283] 0.04481268 0.04483411 0.04485553 0.04487693 0.04489832 0.04491970 [289] 0.04494106 0.04496241 0.04498375 0.04500508 0.04502639 0.04504768 [295] 0.04506897 0.04509024 0.04511150 0.04513274 0.04515397 0.04517519 [301] 0.04519639 0.04521758 0.04523876 0.04525992 0.04528107 0.04530221 [307] 0.04532333 0.04534444 0.04536554 0.04538662 0.04540769 0.04542874 [313] 0.04544979 0.04547082 0.04549183 0.04551284 0.04553383 0.04555480 [319] 0.04557576 0.04559671 0.04561765 0.04563857 0.04565948 0.04568038 [325] 0.04570126 0.04572213 0.04574299 0.04576383 0.04578466 0.04580548 [331] 0.04582628 0.04584707 0.04586785 0.04588861 0.04590936 0.04593010 [337] 0.04595082 0.04597153 0.04599223 0.04601292 0.04603359 0.04605424 [343] 0.04607489 0.04609552 0.04611614 0.04613674 0.04615733 0.04617791 [349] 0.04619848 0.04621903 0.04623957 0.04626009 0.04628061 0.04630111 [355] 0.04632159 0.04634207 0.04636253 0.04638297 0.04640341 0.04642383 [361] 0.04644423 0.04646463 0.04648501 0.04650538 0.04652573 0.04654607 [367] 0.04656640 0.04658672 0.04660702 0.04662731 0.04664758 0.04666785 [373] 0.04668809 0.04670833 0.04672856 0.04674877 0.04676896 0.04678915 [379] 0.04680932 0.04682948 0.04684962 0.04686975 0.04688987 0.04690998 [385] 0.04693007 0.04695015 0.04697022 0.04699027 0.04701031 0.04703034 [391] 0.04705036 0.04707036 0.04709035 0.04711032 0.04713029 0.04715024 [397] 0.04717017 0.04719010 0.04721001 0.04722991 0.04724979 > mx [1] 0.04724979 > 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/1ehol1257514571.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/2j9gm1257514571.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/3re0n1257514571.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/4krzx1257514571.tab") > > system("convert tmp/1ehol1257514571.ps tmp/1ehol1257514571.png") > system("convert tmp/2j9gm1257514571.ps tmp/2j9gm1257514571.png") > system("convert tmp/3re0n1257514571.ps tmp/3re0n1257514571.png") > > > proc.time() user system elapsed 0.757 0.522 0.940