R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(19685.6,19601.7,16006.9,17681.2,19790.4,17014.2,17424.5,18908.9,15692.1,15160,15794.3,16032.1,16065,16236.8,12521,14762.1,15446.9,13635,14212.6,15021.7,14134.3,13721.4,14384.5,15638.6,19711.6,20359.8,16141.4,20056.9,20605.5,19325.8,20547.7,19211.2,19009.5,18746.8,16471.5,18957.2,20515.2,18374.4,16192.9,18147.5,19301.4,18344.7,17183.6,19630,17167.2,17428.5,16016.5,18466.5,18406.6,18174.1,14851.9,16260.7,18329.6,18003.8,15903.8,19554.2,16554.2,16198.9,16571.8,17535.2,16198.1) > x <- c(19437.5,18885.1,16579.0,17203.6,19165.7,17107.6,17690.5,18664.9,15878.6,16014.6,16842.6,15986.9,16773.3,16263.1,13597.3,14285.6,15496.8,13916.8,14345.5,15761.3,14531.6,15076.6,15816.8,17180.4,20432.3,21289.5,18203.6,20159.5,21053.2,19673.6,21473.3,20244.7,19049.6,20194.3,18021.9,19537.3,20286.6,17967.7,16409.9,17802.7,18509.9,18161.3,16721.3,19106.9,16772.1,17463.6,16162.3,17862.9,17664.9,17180.8,15672.7,15189.8,17699.4,17444.6,15930.7,19691.6,16698.0,16896.2,17972.4,17637.4,15214.0) > #'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.9271412 0.9272175 0.9272933 0.9273688 0.9274438 0.9275185 0.9275927 [8] 0.9276665 0.9277398 0.9278128 0.9278853 0.9279575 0.9280292 0.9281005 [15] 0.9281713 0.9282418 0.9283118 0.9283814 0.9284507 0.9285194 0.9285878 [22] 0.9286557 0.9287233 0.9287904 0.9288571 0.9289233 0.9289892 0.9290546 [29] 0.9291196 0.9291842 0.9292484 0.9293121 0.9293755 0.9294384 0.9295008 [36] 0.9295629 0.9296245 0.9296858 0.9297466 0.9298069 0.9298669 0.9299264 [43] 0.9299855 0.9300442 0.9301025 0.9301603 0.9302177 0.9302747 0.9303313 [50] 0.9303874 0.9304432 0.9304985 0.9305533 0.9306078 0.9306618 0.9307154 [57] 0.9307686 0.9308214 0.9308737 0.9309256 0.9309771 0.9310281 0.9310788 [64] 0.9311290 0.9311787 0.9312281 0.9312770 0.9313255 0.9313736 0.9314213 [71] 0.9314685 0.9315153 0.9315617 0.9316076 0.9316531 0.9316982 0.9317429 [78] 0.9317871 0.9318309 0.9318743 0.9319173 0.9319598 0.9320019 0.9320436 [85] 0.9320849 0.9321257 0.9321661 0.9322061 0.9322456 0.9322848 0.9323235 [92] 0.9323617 0.9323996 0.9324370 0.9324740 0.9325105 0.9325466 0.9325823 [99] 0.9326176 0.9326525 0.9326869 0.9327209 0.9327544 0.9327876 0.9328203 [106] 0.9328526 0.9328844 0.9329158 0.9329468 0.9329774 0.9330076 0.9330373 [113] 0.9330666 0.9330954 0.9331238 0.9331519 0.9331794 0.9332066 0.9332333 [120] 0.9332596 0.9332855 0.9333109 0.9333359 0.9333605 0.9333846 0.9334084 [127] 0.9334317 0.9334545 0.9334770 0.9334990 0.9335206 0.9335418 0.9335625 [134] 0.9335828 0.9336027 0.9336222 0.9336412 0.9336598 0.9336780 0.9336957 [141] 0.9337130 0.9337299 0.9337464 0.9337624 0.9337780 0.9337932 0.9338080 [148] 0.9338223 0.9338362 0.9338497 0.9338628 0.9338754 0.9338876 0.9338994 [155] 0.9339107 0.9339217 0.9339322 0.9339422 0.9339519 0.9339611 0.9339699 [162] 0.9339783 0.9339862 0.9339938 0.9340009 0.9340075 0.9340138 0.9340196 [169] 0.9340250 0.9340300 0.9340346 0.9340387 0.9340424 0.9340457 0.9340485 [176] 0.9340510 0.9340530 0.9340546 0.9340557 0.9340565 0.9340568 0.9340567 [183] 0.9340562 0.9340552 0.9340539 0.9340521 0.9340499 0.9340472 0.9340442 [190] 0.9340407 0.9340368 0.9340325 0.9340277 0.9340226 0.9340170 0.9340110 [197] 0.9340046 0.9339977 0.9339905 0.9339828 0.9339747 0.9339662 0.9339572 [204] 0.9339479 0.9339381 0.9339279 0.9339173 0.9339062 0.9338948 0.9338829 [211] 0.9338706 0.9338579 0.9338448 0.9338313 0.9338173 0.9338030 0.9337882 [218] 0.9337730 0.9337574 0.9337413 0.9337249 0.9337080 0.9336907 0.9336730 [225] 0.9336549 0.9336364 0.9336175 0.9335981 0.9335784 0.9335582 0.9335376 [232] 0.9335166 0.9334952 0.9334733 0.9334511 0.9334284 0.9334054 0.9333819 [239] 0.9333580 0.9333337 0.9333090 0.9332839 0.9332584 0.9332324 0.9332061 [246] 0.9331793 0.9331521 0.9331246 0.9330966 0.9330682 0.9330394 0.9330102 [253] 0.9329806 0.9329505 0.9329201 0.9328893 0.9328580 0.9328264 0.9327943 [260] 0.9327619 0.9327290 0.9326957 0.9326621 0.9326280 0.9325935 0.9325586 [267] 0.9325233 0.9324876 0.9324515 0.9324150 0.9323781 0.9323408 0.9323031 [274] 0.9322650 0.9322265 0.9321876 0.9321483 0.9321086 0.9320685 0.9320280 [281] 0.9319871 0.9319458 0.9319041 0.9318620 0.9318195 0.9317766 0.9317333 [288] 0.9316896 0.9316455 0.9316010 0.9315562 0.9315109 0.9314652 0.9314192 [295] 0.9313727 0.9313258 0.9312786 0.9312310 0.9311829 0.9311345 0.9310857 [302] 0.9310365 0.9309869 0.9309369 0.9308865 0.9308358 0.9307846 0.9307331 [309] 0.9306811 0.9306288 0.9305761 0.9305230 0.9304695 0.9304156 0.9303613 [316] 0.9303067 0.9302516 0.9301962 0.9301404 0.9300842 0.9300276 0.9299707 [323] 0.9299133 0.9298556 0.9297975 0.9297390 0.9296801 0.9296208 0.9295612 [330] 0.9295011 0.9294407 0.9293799 0.9293188 0.9292572 0.9291953 0.9291330 [337] 0.9290703 0.9290073 0.9289438 0.9288800 0.9288158 0.9287512 0.9286863 [344] 0.9286210 0.9285553 0.9284892 0.9284228 0.9283559 0.9282887 0.9282212 [351] 0.9281532 0.9280849 0.9280162 0.9279472 0.9278778 0.9278080 0.9277378 [358] 0.9276673 0.9275964 0.9275251 0.9274535 0.9273814 0.9273091 0.9272363 [365] 0.9271632 0.9270897 0.9270159 0.9269417 0.9268671 0.9267922 0.9267169 [372] 0.9266412 0.9265652 0.9264888 0.9264121 0.9263349 0.9262575 0.9261796 [379] 0.9261014 0.9260229 0.9259440 0.9258647 0.9257851 0.9257051 0.9256247 [386] 0.9255440 0.9254630 0.9253816 0.9252998 0.9252177 0.9251352 0.9250523 [393] 0.9249691 0.9248856 0.9248017 0.9247175 0.9246329 0.9245479 0.9244626 [400] 0.9243770 0.9242909 > mx [1] 0.9340568 > mxli [1] -0.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/rcomp/tmp/1qdb61293192977.ps",horizontal=F,onefile=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/rcomp/tmp/2qdb61293192977.ps",horizontal=F,onefile=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/rcomp/tmp/3qdb61293192977.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4mn9x1293192977.tab") > > try(system("convert tmp/1qdb61293192977.ps tmp/1qdb61293192977.png",intern=TRUE)) character(0) > try(system("convert tmp/2qdb61293192977.ps tmp/2qdb61293192977.png",intern=TRUE)) character(0) > try(system("convert tmp/3qdb61293192977.ps tmp/3qdb61293192977.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.870 0.660 1.523