R version 2.8.0 (2008-10-20) 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(98.1,101.1,111.1,93.3,100,108,70.4,75.4,105.5,112.3,102.5,93.5,86.7,95.2,103.8,97,95.5,101,67.5,64,106.7,100.6,101.2,93.1,84.2,85.8,91.8,92.4,80.3,79.7,62.5,57.1,100.8,100.7,86.2,83.2) > x <- c(467,460,448,443,436,431,484,510,513,503,471,471,476,475,470,461,455,456,517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555) > #'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.4736784 -0.4736838 -0.4736892 -0.4736944 -0.4736996 -0.4737047 [7] -0.4737097 -0.4737147 -0.4737195 -0.4737243 -0.4737291 -0.4737337 [13] -0.4737383 -0.4737428 -0.4737472 -0.4737516 -0.4737559 -0.4737601 [19] -0.4737642 -0.4737683 -0.4737723 -0.4737762 -0.4737800 -0.4737838 [25] -0.4737875 -0.4737911 -0.4737946 -0.4737981 -0.4738015 -0.4738048 [31] -0.4738080 -0.4738112 -0.4738143 -0.4738173 -0.4738202 -0.4738231 [37] -0.4738259 -0.4738286 -0.4738312 -0.4738338 -0.4738363 -0.4738387 [43] -0.4738410 -0.4738433 -0.4738455 -0.4738476 -0.4738496 -0.4738516 [49] -0.4738534 -0.4738552 -0.4738570 -0.4738586 -0.4738602 -0.4738617 [55] -0.4738632 -0.4738645 -0.4738658 -0.4738670 -0.4738681 -0.4738692 [61] -0.4738701 -0.4738710 -0.4738719 -0.4738726 -0.4738733 -0.4738739 [67] -0.4738744 -0.4738749 -0.4738752 -0.4738755 -0.4738757 -0.4738759 [73] -0.4738759 -0.4738759 -0.4738758 -0.4738757 -0.4738754 -0.4738751 [79] -0.4738747 -0.4738742 -0.4738737 -0.4738731 -0.4738724 -0.4738716 [85] -0.4738707 -0.4738698 -0.4738688 -0.4738677 -0.4738666 -0.4738653 [91] -0.4738640 -0.4738626 -0.4738611 -0.4738596 -0.4738580 -0.4738563 [97] -0.4738545 -0.4738527 -0.4738507 -0.4738487 -0.4738467 -0.4738445 [103] -0.4738423 -0.4738399 -0.4738376 -0.4738351 -0.4738326 -0.4738299 [109] -0.4738272 -0.4738245 -0.4738216 -0.4738187 -0.4738157 -0.4738126 [115] -0.4738094 -0.4738062 -0.4738029 -0.4737995 -0.4737960 -0.4737925 [121] -0.4737889 -0.4737852 -0.4737814 -0.4737775 -0.4737736 -0.4737696 [127] -0.4737655 -0.4737613 -0.4737571 -0.4737528 -0.4737484 -0.4737439 [133] -0.4737393 -0.4737347 -0.4737300 -0.4737252 -0.4737203 -0.4737154 [139] -0.4737104 -0.4737053 -0.4737001 -0.4736949 -0.4736895 -0.4736841 [145] -0.4736786 -0.4736731 -0.4736674 -0.4736617 -0.4736559 -0.4736501 [151] -0.4736441 -0.4736381 -0.4736320 -0.4736258 -0.4736195 -0.4736132 [157] -0.4736068 -0.4736003 -0.4735937 -0.4735870 -0.4735803 -0.4735735 [163] -0.4735666 -0.4735597 -0.4735526 -0.4735455 -0.4735383 -0.4735310 [169] -0.4735237 -0.4735162 -0.4735087 -0.4735011 -0.4734935 -0.4734857 [175] -0.4734779 -0.4734700 -0.4734620 -0.4734540 -0.4734458 -0.4734376 [181] -0.4734293 -0.4734210 -0.4734125 -0.4734040 -0.4733954 -0.4733867 [187] -0.4733779 -0.4733691 -0.4733602 -0.4733512 -0.4733421 -0.4733330 [193] -0.4733237 -0.4733144 -0.4733051 -0.4732956 -0.4732860 -0.4732764 [199] -0.4732667 -0.4732570 -0.4732471 -0.4732372 -0.4732272 -0.4732171 [205] -0.4732069 -0.4731967 -0.4731863 -0.4731759 -0.4731654 -0.4731549 [211] -0.4731442 -0.4731335 -0.4731227 -0.4731119 -0.4731009 -0.4730899 [217] -0.4730788 -0.4730676 -0.4730563 -0.4730450 -0.4730336 -0.4730221 [223] -0.4730105 -0.4729988 -0.4729871 -0.4729753 -0.4729634 -0.4729514 [229] -0.4729394 -0.4729273 -0.4729151 -0.4729028 -0.4728904 -0.4728780 [235] -0.4728655 -0.4728529 -0.4728402 -0.4728275 -0.4728146 -0.4728017 [241] -0.4727887 -0.4727757 -0.4727625 -0.4727493 -0.4727360 -0.4727226 [247] -0.4727092 -0.4726956 -0.4726820 -0.4726683 -0.4726546 -0.4726407 [253] -0.4726268 -0.4726128 -0.4725987 -0.4725846 -0.4725703 -0.4725560 [259] -0.4725416 -0.4725272 -0.4725126 -0.4724980 -0.4724833 -0.4724685 [265] -0.4724536 -0.4724387 -0.4724237 -0.4724086 -0.4723934 -0.4723782 [271] -0.4723628 -0.4723474 -0.4723319 -0.4723164 -0.4723007 -0.4722850 [277] -0.4722692 -0.4722533 -0.4722374 -0.4722214 -0.4722053 -0.4721891 [283] -0.4721728 -0.4721565 -0.4721400 -0.4721236 -0.4721070 -0.4720903 [289] -0.4720736 -0.4720568 -0.4720399 -0.4720229 -0.4720059 -0.4719888 [295] -0.4719716 -0.4719543 -0.4719370 -0.4719195 -0.4719020 -0.4718844 [301] -0.4718668 -0.4718490 -0.4718312 -0.4718133 -0.4717953 -0.4717773 [307] -0.4717592 -0.4717410 -0.4717227 -0.4717043 -0.4716859 -0.4716674 [313] -0.4716488 -0.4716301 -0.4716114 -0.4715925 -0.4715736 -0.4715547 [319] -0.4715356 -0.4715165 -0.4714973 -0.4714780 -0.4714586 -0.4714392 [325] -0.4714197 -0.4714001 -0.4713804 -0.4713606 -0.4713408 -0.4713209 [331] -0.4713009 -0.4712809 -0.4712607 -0.4712405 -0.4712202 -0.4711999 [337] -0.4711794 -0.4711589 -0.4711383 -0.4711177 -0.4710969 -0.4710761 [343] -0.4710552 -0.4710342 -0.4710132 -0.4709920 -0.4709708 -0.4709495 [349] -0.4709282 -0.4709067 -0.4708852 -0.4708636 -0.4708420 -0.4708202 [355] -0.4707984 -0.4707765 -0.4707545 -0.4707325 -0.4707104 -0.4706882 [361] -0.4706659 -0.4706436 -0.4706211 -0.4705986 -0.4705760 -0.4705534 [367] -0.4705307 -0.4705078 -0.4704850 -0.4704620 -0.4704390 -0.4704159 [373] -0.4703927 -0.4703694 -0.4703461 -0.4703227 -0.4702992 -0.4702756 [379] -0.4702520 -0.4702283 -0.4702045 -0.4701806 -0.4701567 -0.4701326 [385] -0.4701085 -0.4700844 -0.4700601 -0.4700358 -0.4700114 -0.4699870 [391] -0.4699624 -0.4699378 -0.4699131 -0.4698883 -0.4698635 -0.4698386 [397] -0.4698136 -0.4697885 -0.4697634 -0.4697382 -0.4697129 > mx [1] 0.4738759 > mxli [1] -1.28 > 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/1w3ll1229876099.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/2vl2q1229876099.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/3t5i31229876099.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/4qvhk1229876099.tab") > > system("convert tmp/1w3ll1229876099.ps tmp/1w3ll1229876099.png") > system("convert tmp/2vl2q1229876099.ps tmp/2vl2q1229876099.png") > system("convert tmp/3t5i31229876099.ps tmp/3t5i31229876099.png") > > > proc.time() user system elapsed 0.828 0.525 1.061