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(17471,14968,15449,17582,18501,17291,16465,17109,18438,16944,16362,16965,18937,17842,16187,17655,19194,18400,17436,19526,21304,18947,18786,24304,23724,23823,21433,23900,25432,23619,23761,23844,26374,24406,24752,26005,27758,25534,26415,28217,29101,27715,27622,29065,31450,29571,30996,30937,34106,32851,36114,34383,38077,35638,35254,36683,38977,34951,34177,35299,36419) > x <- c(10030,9536,9953,9775,9843,9461,9230,8956,9608,9482,9962,9766,10312,10032,10411,10438,10803,10365,10488,9698,10087,9769,10381,10117,10775,10735,11601,10749,11227,10904,11418,10429,10755,9566,6849,7210,8472,9334,9523,9622,10215,10752,11766,11816,12730,13481,14905,14571,15308,15870,15950,16350,17086,17668,17947,18322,18696,18772,18947,19142,19724) > #'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.6733303 0.6742660 0.6751991 0.6761295 0.6770571 0.6779820 0.6789041 [8] 0.6798235 0.6807401 0.6816539 0.6825649 0.6834731 0.6843786 0.6852811 [15] 0.6861809 0.6870778 0.6879718 0.6888630 0.6897514 0.6906368 0.6915194 [22] 0.6923990 0.6932758 0.6941496 0.6950206 0.6958885 0.6967536 0.6976157 [29] 0.6984749 0.6993311 0.7001843 0.7010345 0.7018818 0.7027261 0.7035674 [36] 0.7044056 0.7052409 0.7060731 0.7069024 0.7077285 0.7085517 0.7093718 [43] 0.7101889 0.7110029 0.7118138 0.7126217 0.7134265 0.7142282 0.7150269 [50] 0.7158224 0.7166149 0.7174043 0.7181906 0.7189737 0.7197538 0.7205307 [57] 0.7213045 0.7220752 0.7228428 0.7236072 0.7243686 0.7251267 0.7258817 [64] 0.7266336 0.7273824 0.7281279 0.7288704 0.7296096 0.7303458 0.7310787 [71] 0.7318085 0.7325351 0.7332586 0.7339788 0.7346960 0.7354099 0.7361206 [78] 0.7368282 0.7375326 0.7382338 0.7389319 0.7396267 0.7403184 0.7410069 [85] 0.7416922 0.7423743 0.7430532 0.7437289 0.7444015 0.7450708 0.7457370 [92] 0.7464000 0.7470597 0.7477163 0.7483698 0.7490200 0.7496670 0.7503109 [99] 0.7509515 0.7515890 0.7522233 0.7528544 0.7534823 0.7541071 0.7547286 [106] 0.7553470 0.7559622 0.7565743 0.7571831 0.7577888 0.7583913 0.7589907 [113] 0.7595869 0.7601799 0.7607698 0.7613565 0.7619400 0.7625204 0.7630976 [120] 0.7636717 0.7642427 0.7648105 0.7653751 0.7659367 0.7664951 0.7670503 [127] 0.7676024 0.7681515 0.7686973 0.7692401 0.7697798 0.7703163 0.7708498 [134] 0.7713801 0.7719074 0.7724315 0.7729526 0.7734705 0.7739854 0.7744972 [141] 0.7750060 0.7755117 0.7760143 0.7765138 0.7770103 0.7775038 0.7779942 [148] 0.7784816 0.7789659 0.7794472 0.7799255 0.7804007 0.7808730 0.7813422 [155] 0.7818084 0.7822717 0.7827319 0.7831891 0.7836434 0.7840947 0.7845430 [162] 0.7849884 0.7854308 0.7858702 0.7863067 0.7867403 0.7871709 0.7875986 [169] 0.7880233 0.7884452 0.7888641 0.7892802 0.7896933 0.7901035 0.7905109 [176] 0.7909154 0.7913170 0.7917157 0.7921116 0.7925046 0.7928948 0.7932821 [183] 0.7936666 0.7940483 0.7944272 0.7948032 0.7951765 0.7955469 0.7959145 [190] 0.7962794 0.7966415 0.7970008 0.7973574 0.7977112 0.7980622 0.7984105 [197] 0.7987561 0.7990989 0.7994390 0.7997764 0.8001111 0.8004431 0.8007725 [204] 0.8010991 0.8014230 0.8017443 0.8020629 0.8023789 0.8026922 0.8030029 [211] 0.8033110 0.8036164 0.8039192 0.8042194 0.8045170 0.8048120 0.8051044 [218] 0.8053943 0.8056815 0.8059663 0.8062484 0.8065280 0.8068051 0.8070797 [225] 0.8073517 0.8076212 0.8078882 0.8081527 0.8084147 0.8086742 0.8089312 [232] 0.8091858 0.8094379 0.8096876 0.8099348 0.8101796 0.8104220 0.8106619 [239] 0.8108994 0.8111346 0.8113673 0.8115976 0.8118256 0.8120512 0.8122744 [246] 0.8124953 0.8127138 0.8129299 0.8131438 0.8133553 0.8135645 0.8137714 [253] 0.8139760 0.8141783 0.8143783 0.8145761 0.8147715 0.8149648 0.8151557 [260] 0.8153444 0.8155309 0.8157152 0.8158972 0.8160770 0.8162547 0.8164301 [267] 0.8166033 0.8167744 0.8169433 0.8171100 0.8172746 0.8174370 0.8175973 [274] 0.8177554 0.8179115 0.8180654 0.8182172 0.8183669 0.8185145 0.8186600 [281] 0.8188035 0.8189449 0.8190842 0.8192215 0.8193567 0.8194899 0.8196211 [288] 0.8197502 0.8198773 0.8200025 0.8201256 0.8202467 0.8203659 0.8204831 [295] 0.8205983 0.8207116 0.8208229 0.8209323 0.8210397 0.8211452 0.8212488 [302] 0.8213505 0.8214503 0.8215482 0.8216442 0.8217383 0.8218305 0.8219209 [309] 0.8220094 0.8220961 0.8221809 0.8222639 0.8223451 0.8224244 0.8225019 [316] 0.8225777 0.8226516 0.8227238 0.8227941 0.8228627 0.8229295 0.8229946 [323] 0.8230579 0.8231195 0.8231793 0.8232374 0.8232937 0.8233484 0.8234014 [330] 0.8234526 0.8235022 0.8235500 0.8235962 0.8236407 0.8236836 0.8237248 [337] 0.8237643 0.8238022 0.8238385 0.8238732 0.8239062 0.8239376 0.8239674 [344] 0.8239956 0.8240222 0.8240472 0.8240706 0.8240925 0.8241128 0.8241316 [351] 0.8241487 0.8241644 0.8241785 0.8241911 0.8242021 0.8242117 0.8242197 [358] 0.8242262 0.8242313 0.8242348 0.8242369 0.8242374 0.8242366 0.8242342 [365] 0.8242304 0.8242251 0.8242184 0.8242103 0.8242007 0.8241898 0.8241773 [372] 0.8241635 0.8241483 0.8241317 0.8241137 0.8240943 0.8240735 0.8240514 [379] 0.8240279 0.8240030 0.8239768 0.8239492 0.8239203 0.8238901 0.8238585 [386] 0.8238257 0.8237915 0.8237560 0.8237192 0.8236810 0.8236417 0.8236010 [393] 0.8235590 0.8235158 0.8234713 0.8234256 0.8233786 0.8233303 0.8232808 [400] 0.8232301 0.8231781 > mx [1] 0.8242374 > mxli [1] 1.61 > 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/1v5691226421558.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/249xk1226421558.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/3pgbh1226421558.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/49emu1226421558.tab") > > system("convert tmp/1v5691226421558.ps tmp/1v5691226421558.png") > system("convert tmp/249xk1226421558.ps tmp/249xk1226421558.png") > system("convert tmp/3pgbh1226421558.ps tmp/3pgbh1226421558.png") > > > proc.time() user system elapsed 1.040 0.528 1.432