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(3922,3759,4138,4634,3995,4308,4143,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > x <- c(6.7,6.5,6.2,6.2,6.5,6.8,6.8,6.5,5.9,5.5,5.6,6,6.3,6.2,5.6,5.4,5.7,5.9,6.2,6.3,6.1,5.9,5.9,5.7,5.9,6.1,6.1,6.5,6.8,6.8,6.9,6.9,6.8,6.6,6.5,6.5,6.5,6.7,7,7.3,7.5,7.5,7.5,7.3,7.1,6.9,7,7.1,7.2,7.1,6.8,6.9,6.9,7.3,7.4,7.2,6.9,6.8,7.1,7.4) > #'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.5784753 -0.5784975 -0.5785194 -0.5785412 -0.5785629 -0.5785843 [7] -0.5786056 -0.5786266 -0.5786475 -0.5786682 -0.5786888 -0.5787091 [13] -0.5787293 -0.5787493 -0.5787691 -0.5787888 -0.5788082 -0.5788275 [19] -0.5788466 -0.5788655 -0.5788843 -0.5789028 -0.5789212 -0.5789394 [25] -0.5789574 -0.5789753 -0.5789929 -0.5790104 -0.5790277 -0.5790448 [31] -0.5790617 -0.5790785 -0.5790951 -0.5791115 -0.5791277 -0.5791437 [37] -0.5791596 -0.5791753 -0.5791908 -0.5792061 -0.5792212 -0.5792362 [43] -0.5792509 -0.5792655 -0.5792799 -0.5792942 -0.5793082 -0.5793221 [49] -0.5793358 -0.5793493 -0.5793626 -0.5793758 -0.5793888 -0.5794016 [55] -0.5794142 -0.5794266 -0.5794388 -0.5794509 -0.5794628 -0.5794745 [61] -0.5794860 -0.5794974 -0.5795086 -0.5795196 -0.5795304 -0.5795410 [67] -0.5795514 -0.5795617 -0.5795718 -0.5795817 -0.5795914 -0.5796010 [73] -0.5796104 -0.5796196 -0.5796286 -0.5796374 -0.5796460 -0.5796545 [79] -0.5796628 -0.5796709 -0.5796788 -0.5796866 -0.5796942 -0.5797015 [85] -0.5797088 -0.5797158 -0.5797226 -0.5797293 -0.5797358 -0.5797421 [91] -0.5797482 -0.5797542 -0.5797600 -0.5797655 -0.5797710 -0.5797762 [97] -0.5797812 -0.5797861 -0.5797908 -0.5797953 -0.5797997 -0.5798038 [103] -0.5798078 -0.5798116 -0.5798152 -0.5798186 -0.5798219 -0.5798250 [109] -0.5798279 -0.5798306 -0.5798331 -0.5798355 -0.5798377 -0.5798397 [115] -0.5798415 -0.5798431 -0.5798446 -0.5798459 -0.5798470 -0.5798479 [121] -0.5798487 -0.5798492 -0.5798496 -0.5798499 -0.5798499 -0.5798497 [127] -0.5798494 -0.5798489 -0.5798482 -0.5798474 -0.5798463 -0.5798451 [133] -0.5798437 -0.5798421 -0.5798404 -0.5798385 -0.5798363 -0.5798341 [139] -0.5798316 -0.5798289 -0.5798261 -0.5798231 -0.5798199 -0.5798166 [145] -0.5798130 -0.5798093 -0.5798054 -0.5798014 -0.5797971 -0.5797927 [151] -0.5797881 -0.5797833 -0.5797783 -0.5797732 -0.5797679 -0.5797624 [157] -0.5797567 -0.5797509 -0.5797449 -0.5797387 -0.5797323 -0.5797257 [163] -0.5797190 -0.5797121 -0.5797050 -0.5796977 -0.5796903 -0.5796826 [169] -0.5796748 -0.5796669 -0.5796587 -0.5796504 -0.5796419 -0.5796332 [175] -0.5796243 -0.5796153 -0.5796061 -0.5795967 -0.5795872 -0.5795774 [181] -0.5795675 -0.5795574 -0.5795471 -0.5795367 -0.5795261 -0.5795153 [187] -0.5795043 -0.5794931 -0.5794818 -0.5794703 -0.5794586 -0.5794468 [193] -0.5794347 -0.5794225 -0.5794102 -0.5793976 -0.5793849 -0.5793720 [199] -0.5793589 -0.5793456 -0.5793322 -0.5793186 -0.5793048 -0.5792909 [205] -0.5792767 -0.5792624 -0.5792479 -0.5792333 -0.5792184 -0.5792034 [211] -0.5791883 -0.5791729 -0.5791574 -0.5791417 -0.5791258 -0.5791097 [217] -0.5790935 -0.5790771 -0.5790606 -0.5790438 -0.5790269 -0.5790098 [223] -0.5789925 -0.5789751 -0.5789575 -0.5789397 -0.5789217 -0.5789036 [229] -0.5788853 -0.5788668 -0.5788481 -0.5788293 -0.5788103 -0.5787911 [235] -0.5787718 -0.5787523 -0.5787326 -0.5787127 -0.5786927 -0.5786725 [241] -0.5786521 -0.5786315 -0.5786108 -0.5785899 -0.5785688 -0.5785476 [247] -0.5785262 -0.5785046 -0.5784828 -0.5784609 -0.5784388 -0.5784165 [253] -0.5783941 -0.5783715 -0.5783487 -0.5783257 -0.5783026 -0.5782793 [259] -0.5782559 -0.5782322 -0.5782084 -0.5781844 -0.5781603 -0.5781360 [265] -0.5781115 -0.5780868 -0.5780620 -0.5780370 -0.5780118 -0.5779865 [271] -0.5779609 -0.5779353 -0.5779094 -0.5778834 -0.5778572 -0.5778308 [277] -0.5778043 -0.5777776 -0.5777508 -0.5777237 -0.5776965 -0.5776691 [283] -0.5776416 -0.5776139 -0.5775860 -0.5775580 -0.5775298 -0.5775014 [289] -0.5774728 -0.5774441 -0.5774152 -0.5773862 -0.5773569 -0.5773276 [295] -0.5772980 -0.5772683 -0.5772384 -0.5772083 -0.5771781 -0.5771477 [301] -0.5771171 -0.5770864 -0.5770555 -0.5770245 -0.5769932 -0.5769618 [307] -0.5769303 -0.5768986 -0.5768667 -0.5768346 -0.5768024 -0.5767700 [313] -0.5767374 -0.5767047 -0.5766718 -0.5766388 -0.5766056 -0.5765722 [319] -0.5765386 -0.5765049 -0.5764711 -0.5764370 -0.5764028 -0.5763684 [325] -0.5763339 -0.5762992 -0.5762643 -0.5762293 -0.5761941 -0.5761588 [331] -0.5761233 -0.5760876 -0.5760517 -0.5760157 -0.5759795 -0.5759432 [337] -0.5759067 -0.5758701 -0.5758332 -0.5757962 -0.5757591 -0.5757218 [343] -0.5756843 -0.5756467 -0.5756089 -0.5755709 -0.5755328 -0.5754945 [349] -0.5754561 -0.5754175 -0.5753787 -0.5753398 -0.5753007 -0.5752614 [355] -0.5752220 -0.5751824 -0.5751427 -0.5751028 -0.5750627 -0.5750225 [361] -0.5749822 -0.5749416 -0.5749009 -0.5748601 -0.5748190 -0.5747779 [367] -0.5747365 -0.5746950 -0.5746534 -0.5746116 -0.5745696 -0.5745275 [373] -0.5744852 -0.5744427 -0.5744001 -0.5743574 -0.5743144 -0.5742713 [379] -0.5742281 -0.5741847 -0.5741412 -0.5740974 -0.5740536 -0.5740095 [385] -0.5739654 -0.5739210 -0.5738765 -0.5738319 -0.5737870 -0.5737421 [391] -0.5736969 -0.5736517 -0.5736062 -0.5735606 -0.5735149 -0.5734690 [397] -0.5734229 -0.5733767 -0.5733303 -0.5732838 -0.5732371 > mx [1] 0.5798499 > mxli [1] -0.76 > 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/1khhn1257936842.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/2hcc41257936842.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/3pwcu1257936842.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/4pq9v1257936842.tab") > > system("convert tmp/1khhn1257936842.ps tmp/1khhn1257936842.png") > system("convert tmp/2hcc41257936842.ps tmp/2hcc41257936842.png") > system("convert tmp/3pwcu1257936842.ps tmp/3pwcu1257936842.png") > > > proc.time() user system elapsed 0.726 0.504 0.956