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(9924,10371,10846,10413,10709,10662,10570,10297,10635,10872,10296,10383,10431,10574,10653,10805,10872,10625,10407,10463,10556,10646,10702,11353,11346,11451,11964,12574,13031,13812,14544,14931,14886,16005,17064,15168,16050,15839,15137,14954,15648,15305,15579,16348,15928,16171,15937,15713,15594,15683,16438,17032,17696,17745,19394,20148,20108,18584,18441,18391,19178) > x <- c(1.1372,1.1139,1.1222,1.1692,1.1702,1.2286,1.2613,1.2646,1.2262,1.1985,1.2007,1.2138,1.2266,1.2176,1.2218,1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718,1.4748,1.5527,1.575,1.5557,1.5553,1.577) > #'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.7530861 0.7531623 0.7532383 0.7533141 0.7533897 0.7534651 0.7535403 [8] 0.7536153 0.7536900 0.7537646 0.7538389 0.7539130 0.7539869 0.7540606 [15] 0.7541341 0.7542074 0.7542804 0.7543532 0.7544259 0.7544983 0.7545705 [22] 0.7546425 0.7547142 0.7547858 0.7548571 0.7549282 0.7549991 0.7550698 [29] 0.7551403 0.7552106 0.7552806 0.7553505 0.7554201 0.7554895 0.7555587 [36] 0.7556277 0.7556964 0.7557650 0.7558333 0.7559014 0.7559693 0.7560370 [43] 0.7561044 0.7561717 0.7562387 0.7563055 0.7563721 0.7564385 0.7565047 [50] 0.7565706 0.7566363 0.7567018 0.7567671 0.7568322 0.7568971 0.7569617 [57] 0.7570261 0.7570903 0.7571543 0.7572181 0.7572817 0.7573450 0.7574081 [64] 0.7574710 0.7575337 0.7575962 0.7576584 0.7577204 0.7577823 0.7578438 [71] 0.7579052 0.7579664 0.7580273 0.7580880 0.7581485 0.7582088 0.7582689 [78] 0.7583287 0.7583883 0.7584477 0.7585069 0.7585659 0.7586246 0.7586831 [85] 0.7587414 0.7587995 0.7588574 0.7589150 0.7589724 0.7590296 0.7590866 [92] 0.7591434 0.7591999 0.7592563 0.7593124 0.7593682 0.7594239 0.7594793 [99] 0.7595346 0.7595896 0.7596443 0.7596989 0.7597532 0.7598074 0.7598613 [106] 0.7599149 0.7599684 0.7600216 0.7600746 0.7601274 0.7601800 0.7602323 [113] 0.7602845 0.7603364 0.7603881 0.7604395 0.7604908 0.7605418 0.7605926 [120] 0.7606432 0.7606935 0.7607437 0.7607936 0.7608433 0.7608927 0.7609420 [127] 0.7609910 0.7610398 0.7610884 0.7611367 0.7611849 0.7612328 0.7612805 [134] 0.7613279 0.7613752 0.7614222 0.7614690 0.7615156 0.7615620 0.7616081 [141] 0.7616540 0.7616997 0.7617452 0.7617904 0.7618354 0.7618802 0.7619248 [148] 0.7619692 0.7620133 0.7620572 0.7621009 0.7621444 0.7621876 0.7622306 [155] 0.7622734 0.7623160 0.7623584 0.7624005 0.7624424 0.7624841 0.7625255 [162] 0.7625668 0.7626078 0.7626486 0.7626891 0.7627295 0.7627696 0.7628095 [169] 0.7628492 0.7628886 0.7629279 0.7629669 0.7630057 0.7630442 0.7630826 [176] 0.7631207 0.7631586 0.7631962 0.7632337 0.7632709 0.7633079 0.7633447 [183] 0.7633812 0.7634176 0.7634537 0.7634896 0.7635252 0.7635607 0.7635959 [190] 0.7636309 0.7636656 0.7637002 0.7637345 0.7637686 0.7638025 0.7638362 [197] 0.7638696 0.7639028 0.7639358 0.7639685 0.7640011 0.7640334 0.7640655 [204] 0.7640974 0.7641290 0.7641604 0.7641917 0.7642226 0.7642534 0.7642839 [211] 0.7643142 0.7643443 0.7643742 0.7644038 0.7644333 0.7644625 0.7644914 [218] 0.7645202 0.7645487 0.7645770 0.7646051 0.7646330 0.7646606 0.7646880 [225] 0.7647152 0.7647422 0.7647690 0.7647955 0.7648218 0.7648479 0.7648738 [232] 0.7648994 0.7649248 0.7649500 0.7649750 0.7649997 0.7650243 0.7650486 [239] 0.7650727 0.7650965 0.7651202 0.7651436 0.7651668 0.7651898 0.7652125 [246] 0.7652351 0.7652574 0.7652795 0.7653014 0.7653230 0.7653444 0.7653656 [253] 0.7653866 0.7654074 0.7654279 0.7654483 0.7654684 0.7654882 0.7655079 [260] 0.7655273 0.7655465 0.7655655 0.7655843 0.7656029 0.7656212 0.7656393 [267] 0.7656572 0.7656749 0.7656923 0.7657096 0.7657266 0.7657434 0.7657600 [274] 0.7657763 0.7657924 0.7658084 0.7658240 0.7658395 0.7658548 0.7658698 [281] 0.7658846 0.7658992 0.7659136 0.7659277 0.7659417 0.7659554 0.7659689 [288] 0.7659822 0.7659952 0.7660081 0.7660207 0.7660331 0.7660453 0.7660572 [295] 0.7660690 0.7660805 0.7660918 0.7661029 0.7661138 0.7661244 0.7661349 [302] 0.7661451 0.7661551 0.7661649 0.7661745 0.7661838 0.7661929 0.7662019 [309] 0.7662105 0.7662190 0.7662273 0.7662353 0.7662432 0.7662508 0.7662582 [316] 0.7662653 0.7662723 0.7662790 0.7662856 0.7662919 0.7662980 0.7663039 [323] 0.7663095 0.7663150 0.7663202 0.7663252 0.7663300 0.7663346 0.7663390 [330] 0.7663431 0.7663470 0.7663508 0.7663543 0.7663576 0.7663606 0.7663635 [337] 0.7663662 0.7663686 0.7663708 0.7663728 0.7663746 0.7663762 0.7663775 [344] 0.7663787 0.7663796 0.7663803 0.7663809 0.7663811 0.7663812 0.7663811 [351] 0.7663807 0.7663802 0.7663794 0.7663784 0.7663772 0.7663758 0.7663742 [358] 0.7663724 0.7663703 0.7663681 0.7663656 0.7663629 0.7663600 0.7663569 [365] 0.7663536 0.7663501 0.7663463 0.7663424 0.7663382 0.7663338 0.7663293 [372] 0.7663245 0.7663195 0.7663142 0.7663088 0.7663032 0.7662973 0.7662913 [379] 0.7662850 0.7662785 0.7662719 0.7662650 0.7662579 0.7662506 0.7662430 [386] 0.7662353 0.7662274 0.7662192 0.7662109 0.7662023 0.7661936 0.7661846 [393] 0.7661754 0.7661660 0.7661564 0.7661466 0.7661366 0.7661264 0.7661159 [400] 0.7661053 0.7660944 > mx [1] 0.7663812 > mxli [1] 1.48 > 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/15n5v1226625946.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/21u871226625946.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/3eqzd1226625946.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/4xhy61226625946.tab") > > system("convert tmp/15n5v1226625946.ps tmp/15n5v1226625946.png") > system("convert tmp/21u871226625946.ps tmp/21u871226625946.png") > system("convert tmp/3eqzd1226625946.ps tmp/3eqzd1226625946.png") > > > proc.time() user system elapsed 1.045 0.519 1.340