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(4.379523504,4.423648309,4.732683506,4.726502471,4.644390899,4.699570861,4.59511985,4.666265285,4.85903691,4.710430697,4.633757643,4.86753445,4.465908119,4.471638793,4.767289035,4.638604962,4.707726774,4.723841716,4.629862799,4.722063937,4.909709376,4.654912278,4.849683763,4.919980926,4.510859507,4.505349851,4.80729437,4.81462041,4.822697999,4.787491743,4.771531723,4.779123493,4.960744524,4.817050545,4.864452784,5.021245473,4.704110134,4.597138014,4.871373227,4.914124394,4.865224091,4.852030264,4.80073697,4.911183215,4.968423445,4.993828176,4.914124394,5.053694784,4.81462041,4.649187071,4.94021283,4.916324615,4.71939133,4.774912961,4.547541073,4.627909673,4.713127327,4.597138014,4.475061501,4.751864565) > x <- c(4.699297849,4.561636184,4.812672041,4.815350071,4.789822358,4.747797584,4.704110134,4.740487483,4.883029169,4.813484323,4.777609743,4.854527144,4.720639436,4.649474112,4.887110808,4.808274282,4.881285622,4.824707242,4.795459912,4.808927024,4.980313534,4.775503503,4.899703733,4.917788744,4.798843731,4.715189831,4.900969227,4.924714232,4.926238677,4.785573237,4.872828107,4.854215375,4.993489135,4.855306142,4.919250732,4.969466017,4.910004317,4.807947751,4.918739279,5.030699325,4.960814599,4.815917217,4.972379449,4.984633492,4.994573661,5.065817683,4.99314998,5.106248458,5.041099835,4.83786795,5.058536174,5.037926154,4.813890217,4.728007096,4.70456293,4.732419387,4.807621114,4.744323247,4.717158688,4.836599317) > #'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.8820914 0.8820868 0.8820822 0.8820776 0.8820729 0.8820682 0.8820635 [8] 0.8820588 0.8820540 0.8820493 0.8820444 0.8820396 0.8820348 0.8820299 [15] 0.8820250 0.8820201 0.8820152 0.8820102 0.8820052 0.8820002 0.8819952 [22] 0.8819901 0.8819851 0.8819800 0.8819748 0.8819697 0.8819645 0.8819593 [29] 0.8819541 0.8819489 0.8819436 0.8819384 0.8819331 0.8819277 0.8819224 [36] 0.8819170 0.8819116 0.8819062 0.8819008 0.8818953 0.8818898 0.8818843 [43] 0.8818788 0.8818733 0.8818677 0.8818621 0.8818565 0.8818508 0.8818452 [50] 0.8818395 0.8818338 0.8818281 0.8818223 0.8818165 0.8818107 0.8818049 [57] 0.8817991 0.8817932 0.8817873 0.8817814 0.8817755 0.8817695 0.8817636 [64] 0.8817576 0.8817516 0.8817455 0.8817394 0.8817334 0.8817273 0.8817211 [71] 0.8817150 0.8817088 0.8817026 0.8816964 0.8816901 0.8816839 0.8816776 [78] 0.8816713 0.8816649 0.8816586 0.8816522 0.8816458 0.8816394 0.8816329 [85] 0.8816265 0.8816200 0.8816135 0.8816069 0.8816004 0.8815938 0.8815872 [92] 0.8815806 0.8815739 0.8815673 0.8815606 0.8815539 0.8815471 0.8815404 [99] 0.8815336 0.8815268 0.8815200 0.8815132 0.8815063 0.8814994 0.8814925 [106] 0.8814856 0.8814786 0.8814716 0.8814646 0.8814576 0.8814506 0.8814435 [113] 0.8814364 0.8814293 0.8814222 0.8814150 0.8814079 0.8814007 0.8813934 [120] 0.8813862 0.8813789 0.8813717 0.8813644 0.8813570 0.8813497 0.8813423 [127] 0.8813349 0.8813275 0.8813201 0.8813126 0.8813051 0.8812976 0.8812901 [134] 0.8812825 0.8812750 0.8812674 0.8812598 0.8812521 0.8812445 0.8812368 [141] 0.8812291 0.8812214 0.8812136 0.8812059 0.8811981 0.8811903 0.8811824 [148] 0.8811746 0.8811667 0.8811588 0.8811509 0.8811430 0.8811350 0.8811270 [155] 0.8811190 0.8811110 0.8811029 0.8810949 0.8810868 0.8810787 0.8810705 [162] 0.8810624 0.8810542 0.8810460 0.8810378 0.8810295 0.8810213 0.8810130 [169] 0.8810047 0.8809963 0.8809880 0.8809796 0.8809712 0.8809628 0.8809544 [176] 0.8809459 0.8809374 0.8809289 0.8809204 0.8809119 0.8809033 0.8808947 [183] 0.8808861 0.8808775 0.8808688 0.8808601 0.8808514 0.8808427 0.8808340 [190] 0.8808252 0.8808164 0.8808076 0.8807988 0.8807899 0.8807811 0.8807722 [197] 0.8807633 0.8807543 0.8807454 0.8807364 0.8807274 0.8807184 0.8807094 [204] 0.8807003 0.8806912 0.8806821 0.8806730 0.8806638 0.8806547 0.8806455 [211] 0.8806363 0.8806270 0.8806178 0.8806085 0.8805992 0.8805899 0.8805806 [218] 0.8805712 0.8805618 0.8805524 0.8805430 0.8805335 0.8805241 0.8805146 [225] 0.8805051 0.8804955 0.8804860 0.8804764 0.8804668 0.8804572 0.8804476 [232] 0.8804379 0.8804282 0.8804185 0.8804088 0.8803991 0.8803893 0.8803795 [239] 0.8803697 0.8803599 0.8803501 0.8803402 0.8803303 0.8803204 0.8803104 [246] 0.8803005 0.8802905 0.8802805 0.8802705 0.8802605 0.8802504 0.8802403 [253] 0.8802302 0.8802201 0.8802100 0.8801998 0.8801896 0.8801794 0.8801692 [260] 0.8801589 0.8801487 0.8801384 0.8801281 0.8801177 0.8801074 0.8800970 [267] 0.8800866 0.8800762 0.8800658 0.8800553 0.8800448 0.8800343 0.8800238 [274] 0.8800133 0.8800027 0.8799921 0.8799815 0.8799709 0.8799602 0.8799496 [281] 0.8799389 0.8799282 0.8799175 0.8799067 0.8798959 0.8798851 0.8798743 [288] 0.8798635 0.8798526 0.8798418 0.8798309 0.8798200 0.8798090 0.8797981 [295] 0.8797871 0.8797761 0.8797651 0.8797540 0.8797430 0.8797319 0.8797208 [302] 0.8797097 0.8796985 0.8796873 0.8796762 0.8796650 0.8796537 0.8796425 [309] 0.8796312 0.8796199 0.8796086 0.8795973 0.8795859 0.8795746 0.8795632 [316] 0.8795518 0.8795403 0.8795289 0.8795174 0.8795059 0.8794944 0.8794829 [323] 0.8794713 0.8794597 0.8794481 0.8794365 0.8794249 0.8794132 0.8794015 [330] 0.8793898 0.8793781 0.8793664 0.8793546 0.8793428 0.8793310 0.8793192 [337] 0.8793074 0.8792955 0.8792836 0.8792717 0.8792598 0.8792478 0.8792359 [344] 0.8792239 0.8792119 0.8791999 0.8791878 0.8791757 0.8791637 0.8791516 [351] 0.8791394 0.8791273 0.8791151 0.8791029 0.8790907 0.8790785 0.8790662 [358] 0.8790540 0.8790417 0.8790294 0.8790170 0.8790047 0.8789923 0.8789799 [365] 0.8789675 0.8789551 0.8789426 0.8789301 0.8789176 0.8789051 0.8788926 [372] 0.8788800 0.8788675 0.8788549 0.8788423 0.8788296 0.8788170 0.8788043 [379] 0.8787916 0.8787789 0.8787662 0.8787534 0.8787406 0.8787278 0.8787150 [386] 0.8787022 0.8786893 0.8786764 0.8786636 0.8786506 0.8786377 0.8786247 [393] 0.8786118 0.8785988 0.8785858 0.8785727 0.8785597 0.8785466 0.8785335 [400] 0.8785204 0.8785072 > mx [1] 0.8820914 > 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/1y7ma1257864295.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/2edsj1257864295.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/3mue21257864295.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/4qalp1257864295.tab") > > system("convert tmp/1y7ma1257864295.ps tmp/1y7ma1257864295.png") > system("convert tmp/2edsj1257864295.ps tmp/2edsj1257864295.png") > system("convert tmp/3mue21257864295.ps tmp/3mue21257864295.png") > > > proc.time() user system elapsed 0.788 0.506 3.581