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(2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41,1810.99,1670.07,1864.44,2052.02,2029.6,2070.83,2293.41,2443.27,2513.17) > x <- c(139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137,135,124) > #'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.08121878 -0.08110741 -0.08099601 -0.08088460 -0.08077318 -0.08066174 [7] -0.08055028 -0.08043880 -0.08032731 -0.08021581 -0.08010430 -0.07999277 [13] -0.07988122 -0.07976967 -0.07965810 -0.07954653 -0.07943494 -0.07932334 [19] -0.07921173 -0.07910012 -0.07898849 -0.07887686 -0.07876522 -0.07865357 [25] -0.07854192 -0.07843026 -0.07831860 -0.07820693 -0.07809526 -0.07798358 [31] -0.07787190 -0.07776022 -0.07764854 -0.07753685 -0.07742516 -0.07731348 [37] -0.07720179 -0.07709010 -0.07697842 -0.07686673 -0.07675505 -0.07664337 [43] -0.07653169 -0.07642002 -0.07630835 -0.07619669 -0.07608503 -0.07597338 [49] -0.07586173 -0.07575009 -0.07563846 -0.07552683 -0.07541522 -0.07530361 [55] -0.07519201 -0.07508042 -0.07496885 -0.07485728 -0.07474572 -0.07463418 [61] -0.07452265 -0.07441113 -0.07429962 -0.07418813 -0.07407666 -0.07396520 [67] -0.07385375 -0.07374232 -0.07363091 -0.07351951 -0.07340813 -0.07329677 [73] -0.07318543 -0.07307411 -0.07296280 -0.07285152 -0.07274026 -0.07262901 [79] -0.07251779 -0.07240659 -0.07229542 -0.07218427 -0.07207314 -0.07196203 [85] -0.07185095 -0.07173989 -0.07162886 -0.07151786 -0.07140688 -0.07129593 [91] -0.07118501 -0.07107411 -0.07096325 -0.07085241 -0.07074160 -0.07063082 [97] -0.07052007 -0.07040936 -0.07029867 -0.07018802 -0.07007740 -0.06996681 [103] -0.06985625 -0.06974573 -0.06963524 -0.06952479 -0.06941437 -0.06930399 [109] -0.06919364 -0.06908334 -0.06897306 -0.06886283 -0.06875263 -0.06864248 [115] -0.06853236 -0.06842228 -0.06831224 -0.06820224 -0.06809228 -0.06798237 [121] -0.06787249 -0.06776266 -0.06765287 -0.06754312 -0.06743342 -0.06732376 [127] -0.06721415 -0.06710458 -0.06699506 -0.06688558 -0.06677615 -0.06666676 [133] -0.06655742 -0.06644814 -0.06633889 -0.06622970 -0.06612056 -0.06601146 [139] -0.06590242 -0.06579343 -0.06568448 -0.06557559 -0.06546675 -0.06535796 [145] -0.06524923 -0.06514055 -0.06503192 -0.06492334 -0.06481482 -0.06470636 [151] -0.06459795 -0.06448959 -0.06438129 -0.06427305 -0.06416487 -0.06405674 [157] -0.06394867 -0.06384066 -0.06373270 -0.06362481 -0.06351697 -0.06340920 [163] -0.06330148 -0.06319383 -0.06308624 -0.06297870 -0.06287124 -0.06276383 [169] -0.06265648 -0.06254920 -0.06244198 -0.06233483 -0.06222774 -0.06212072 [175] -0.06201376 -0.06190686 -0.06180004 -0.06169327 -0.06158658 -0.06147995 [181] -0.06137339 -0.06126690 -0.06116047 -0.06105412 -0.06094783 -0.06084162 [187] -0.06073547 -0.06062939 -0.06052339 -0.06041745 -0.06031159 -0.06020580 [193] -0.06010008 -0.05999443 -0.05988886 -0.05978336 -0.05967793 -0.05957257 [199] -0.05946730 -0.05936209 -0.05925696 -0.05915191 -0.05904693 -0.05894203 [205] -0.05883720 -0.05873246 -0.05862779 -0.05852319 -0.05841868 -0.05831424 [211] -0.05820988 -0.05810560 -0.05800140 -0.05789728 -0.05779324 -0.05768928 [217] -0.05758540 -0.05748161 -0.05737789 -0.05727426 -0.05717070 -0.05706723 [223] -0.05696385 -0.05686054 -0.05675732 -0.05665418 -0.05655113 -0.05644816 [229] -0.05634528 -0.05624248 -0.05613977 -0.05603714 -0.05593460 -0.05583214 [235] -0.05572978 -0.05562749 -0.05552530 -0.05542319 -0.05532118 -0.05521925 [241] -0.05511740 -0.05501565 -0.05491399 -0.05481241 -0.05471093 -0.05460953 [247] -0.05450823 -0.05440702 -0.05430589 -0.05420486 -0.05410392 -0.05400307 [253] -0.05390232 -0.05380165 -0.05370108 -0.05360061 -0.05350022 -0.05339993 [259] -0.05329973 -0.05319963 -0.05309962 -0.05299971 -0.05289989 -0.05280016 [265] -0.05270053 -0.05260100 -0.05250156 -0.05240222 -0.05230298 -0.05220383 [271] -0.05210478 -0.05200583 -0.05190697 -0.05180821 -0.05170956 -0.05161099 [277] -0.05151253 -0.05141417 -0.05131590 -0.05121774 -0.05111967 -0.05102171 [283] -0.05092384 -0.05082607 -0.05072841 -0.05063084 -0.05053338 -0.05043602 [289] -0.05033876 -0.05024160 -0.05014454 -0.05004759 -0.04995074 -0.04985399 [295] -0.04975734 -0.04966080 -0.04956436 -0.04946802 -0.04937179 -0.04927566 [301] -0.04917963 -0.04908371 -0.04898790 -0.04889218 -0.04879658 -0.04870108 [307] -0.04860568 -0.04851039 -0.04841521 -0.04832013 -0.04822516 -0.04813029 [313] -0.04803554 -0.04794088 -0.04784634 -0.04775190 -0.04765757 -0.04756335 [319] -0.04746924 -0.04737523 -0.04728133 -0.04718754 -0.04709386 -0.04700029 [325] -0.04690682 -0.04681347 -0.04672022 -0.04662709 -0.04653406 -0.04644115 [331] -0.04634834 -0.04625564 -0.04616306 -0.04607058 -0.04597822 -0.04588596 [337] -0.04579382 -0.04570179 -0.04560987 -0.04551806 -0.04542636 -0.04533477 [343] -0.04524330 -0.04515194 -0.04506069 -0.04496955 -0.04487852 -0.04478761 [349] -0.04469681 -0.04460612 -0.04451555 -0.04442509 -0.04433474 -0.04424451 [355] -0.04415439 -0.04406438 -0.04397449 -0.04388471 -0.04379504 -0.04370549 [361] -0.04361606 -0.04352674 -0.04343753 -0.04334844 -0.04325946 -0.04317060 [367] -0.04308185 -0.04299322 -0.04290470 -0.04281630 -0.04272801 -0.04263984 [373] -0.04255179 -0.04246385 -0.04237603 -0.04228832 -0.04220073 -0.04211326 [379] -0.04202590 -0.04193866 -0.04185154 -0.04176453 -0.04167764 -0.04159087 [385] -0.04150421 -0.04141767 -0.04133125 -0.04124494 -0.04115876 -0.04107269 [391] -0.04098673 -0.04090090 -0.04081518 -0.04072958 -0.04064410 -0.04055874 [397] -0.04047349 -0.04038836 -0.04030335 -0.04021846 -0.04013369 > mx [1] 0.08121878 > 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/1atxo1258041206.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/2z8bg1258041206.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/3eb911258041206.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/445gi1258041206.tab") > > system("convert tmp/1atxo1258041206.ps tmp/1atxo1258041206.png") > system("convert tmp/2z8bg1258041206.ps tmp/2z8bg1258041206.png") > system("convert tmp/3eb911258041206.ps tmp/3eb911258041206.png") > > > proc.time() user system elapsed 0.777 0.512 1.274