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(14497,14398.3,16629.6,16670.7,16614.8,16869.2,15663.9,16359.9,18447.7,16889,16505,18320.9,15052.1,15699.8,18135.3,16768.7,18883,19021,18101.9,17776.1,21489.9,17065.3,18690,18953.1,16398.9,16895.6,18553,19270,19422.1,17579.4,18637.3,18076.7,20438.6,18075.2,19563,19899.2,19227.5,17789.6,19220.8,21968.9,21131.5,19484.6,22168.7,20866.8,22176.2,23533.8,21479.6,24347.7,22751.6,20328.3,23650.4,23335.7,19614.9,18042.3,17282.5,16847.2,18159.5,16540.9,15952.7,18357.8,16394.3) > x <- c(15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22160,20664.3,17877.4,20906.5,21164.1,21374.4,22952.3,21343.5,23899.3,22392.9,18274.1,22786.7,22321.5,17842.2,16373.5,15993.8,16446.1,17729,16643,16196.7,18252.1,17304) > #'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.8928895 0.8931072 0.8933243 0.8935410 0.8937571 0.8939726 0.8941877 [8] 0.8944022 0.8946161 0.8948296 0.8950425 0.8952548 0.8954667 0.8956780 [15] 0.8958888 0.8960990 0.8963087 0.8965179 0.8967265 0.8969346 0.8971422 [22] 0.8973493 0.8975558 0.8977618 0.8979672 0.8981721 0.8983765 0.8985804 [29] 0.8987837 0.8989865 0.8991888 0.8993905 0.8995917 0.8997924 0.8999925 [36] 0.9001921 0.9003912 0.9005897 0.9007878 0.9009852 0.9011822 0.9013786 [43] 0.9015745 0.9017699 0.9019647 0.9021590 0.9023528 0.9025460 0.9027388 [50] 0.9029309 0.9031226 0.9033137 0.9035043 0.9036944 0.9038839 0.9040730 [57] 0.9042614 0.9044494 0.9046368 0.9048237 0.9050101 0.9051959 0.9053813 [64] 0.9055661 0.9057503 0.9059341 0.9061173 0.9063000 0.9064821 0.9066637 [71] 0.9068449 0.9070254 0.9072055 0.9073850 0.9075640 0.9077425 0.9079205 [78] 0.9080979 0.9082748 0.9084512 0.9086270 0.9088024 0.9089772 0.9091514 [85] 0.9093252 0.9094984 0.9096712 0.9098433 0.9100150 0.9101862 0.9103568 [92] 0.9105269 0.9106965 0.9108655 0.9110341 0.9112021 0.9113696 0.9115365 [99] 0.9117030 0.9118689 0.9120343 0.9121992 0.9123636 0.9125275 0.9126908 [106] 0.9128536 0.9130159 0.9131777 0.9133390 0.9134997 0.9136599 0.9138196 [113] 0.9139788 0.9141375 0.9142957 0.9144533 0.9146104 0.9147670 0.9149231 [120] 0.9150787 0.9152338 0.9153883 0.9155423 0.9156959 0.9158489 0.9160014 [127] 0.9161533 0.9163048 0.9164557 0.9166062 0.9167561 0.9169055 0.9170544 [134] 0.9172028 0.9173507 0.9174981 0.9176449 0.9177913 0.9179371 0.9180824 [141] 0.9182272 0.9183715 0.9185153 0.9186586 0.9188014 0.9189437 0.9190854 [148] 0.9192267 0.9193674 0.9195077 0.9196474 0.9197866 0.9199254 0.9200636 [155] 0.9202013 0.9203385 0.9204752 0.9206114 0.9207471 0.9208823 0.9210169 [162] 0.9211511 0.9212848 0.9214180 0.9215506 0.9216828 0.9218145 0.9219456 [169] 0.9220763 0.9222065 0.9223361 0.9224653 0.9225940 0.9227221 0.9228498 [176] 0.9229770 0.9231036 0.9232298 0.9233555 0.9234806 0.9236053 0.9237295 [183] 0.9238532 0.9239764 0.9240991 0.9242212 0.9243429 0.9244642 0.9245849 [190] 0.9247051 0.9248248 0.9249440 0.9250628 0.9251810 0.9252988 0.9254160 [197] 0.9255328 0.9256491 0.9257648 0.9258801 0.9259949 0.9261093 0.9262231 [204] 0.9263364 0.9264493 0.9265616 0.9266735 0.9267849 0.9268958 0.9270062 [211] 0.9271161 0.9272255 0.9273345 0.9274429 0.9275509 0.9276584 0.9277654 [218] 0.9278719 0.9279780 0.9280835 0.9281886 0.9282932 0.9283973 0.9285009 [225] 0.9286041 0.9287067 0.9288089 0.9289106 0.9290118 0.9291126 0.9292128 [232] 0.9293126 0.9294119 0.9295108 0.9296091 0.9297070 0.9298044 0.9299013 [239] 0.9299977 0.9300937 0.9301892 0.9302842 0.9303788 0.9304728 0.9305664 [246] 0.9306595 0.9307522 0.9308444 0.9309361 0.9310273 0.9311181 0.9312083 [253] 0.9312982 0.9313875 0.9314764 0.9315648 0.9316527 0.9317402 0.9318272 [260] 0.9319137 0.9319998 0.9320854 0.9321705 0.9322552 0.9323394 0.9324231 [267] 0.9325064 0.9325892 0.9326715 0.9327534 0.9328348 0.9329158 0.9329963 [274] 0.9330763 0.9331559 0.9332350 0.9333136 0.9333918 0.9334695 0.9335468 [281] 0.9336236 0.9336999 0.9337758 0.9338512 0.9339262 0.9340007 0.9340747 [288] 0.9341483 0.9342215 0.9342942 0.9343664 0.9344382 0.9345095 0.9345803 [295] 0.9346508 0.9347207 0.9347902 0.9348593 0.9349279 0.9349960 0.9350637 [302] 0.9351310 0.9351978 0.9352641 0.9353300 0.9353955 0.9354605 0.9355250 [309] 0.9355891 0.9356528 0.9357160 0.9357788 0.9358411 0.9359030 0.9359644 [316] 0.9360254 0.9360859 0.9361460 0.9362057 0.9362649 0.9363236 0.9363820 [323] 0.9364398 0.9364973 0.9365543 0.9366108 0.9366670 0.9367227 0.9367779 [330] 0.9368327 0.9368871 0.9369410 0.9369945 0.9370475 0.9371001 0.9371523 [337] 0.9372041 0.9372554 0.9373063 0.9373567 0.9374067 0.9374563 0.9375054 [344] 0.9375541 0.9376024 0.9376502 0.9376976 0.9377446 0.9377912 0.9378373 [351] 0.9378830 0.9379282 0.9379731 0.9380175 0.9380615 0.9381050 0.9381481 [358] 0.9381908 0.9382331 0.9382749 0.9383163 0.9383573 0.9383979 0.9384381 [365] 0.9384778 0.9385171 0.9385560 0.9385944 0.9386324 0.9386700 0.9387072 [372] 0.9387440 0.9387804 0.9388163 0.9388518 0.9388869 0.9389216 0.9389558 [379] 0.9389897 0.9390231 0.9390561 0.9390887 0.9391209 0.9391526 0.9391840 [386] 0.9392149 0.9392454 0.9392755 0.9393052 0.9393345 0.9393633 0.9393918 [393] 0.9394198 0.9394475 0.9394747 0.9395015 0.9395279 0.9395539 0.9395795 [400] 0.9396047 0.9396294 > mx [1] 0.9396294 > 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/1ilgj1260717649.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/2ders1260717649.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/3i3xo1260717649.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/430mj1260717649.tab") > > try(system("convert tmp/1ilgj1260717649.ps tmp/1ilgj1260717649.png",intern=TRUE)) character(0) > try(system("convert tmp/2ders1260717649.ps tmp/2ders1260717649.png",intern=TRUE)) character(0) > try(system("convert tmp/3i3xo1260717649.ps tmp/3i3xo1260717649.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.770 0.482 0.883