R version 2.7.2 (2008-08-25) 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(154.783,187.646,237.863,215.54,231.745,199.548,164.147,159.388,203.514,224.901,211.539,211.16,181.712,203.908,240.774,232.819,255.221,246.7,206.263,211.679,236.601,237.43,233.767,219.52,222.625,216.238,248.587,221.376,242.453,246.539,189.351,185.956,213.175,228.732,212.93,218.254,227.103,219.026,264.529,262.057,258.779,231.928,211.167,205.439,224.883,228.624,209.435,215.607,287.356,306.015,338.546,344.16,328.412,342.006,277.668,290.477,314.967,324.627,290.646,315.033) > x <- c(299.63,305.945,382.252,348.846,335.367,373.617,312.612,312.232,337.161,331.476,350.103,345.127,297.256,295.979,361.007,321.803,354.937,349.432,290.979,349.576,327.625,349.377,336.777,339.134,323.321,318.86,373.583,333.03,408.556,414.646,291.514,348.857,349.368,375.765,364.136,349.53,348.167,332.856,360.551,346.969,392.815,372.02,371.027,342.672,367.343,390.786,343.785,362.6,349.468,340.624,369.536,407.782,392.239,404.824,373.669,344.902,396.7,398.911,366.009,392.484) > #'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.6438465 0.6439250 0.6440034 0.6440817 0.6441597 0.6442376 0.6443153 [8] 0.6443928 0.6444702 0.6445473 0.6446243 0.6447012 0.6447778 0.6448543 [15] 0.6449306 0.6450067 0.6450826 0.6451584 0.6452340 0.6453094 0.6453846 [22] 0.6454596 0.6455345 0.6456092 0.6456837 0.6457581 0.6458322 0.6459062 [29] 0.6459800 0.6460536 0.6461270 0.6462003 0.6462734 0.6463463 0.6464190 [36] 0.6464915 0.6465639 0.6466361 0.6467081 0.6467799 0.6468515 0.6469230 [43] 0.6469942 0.6470653 0.6471362 0.6472070 0.6472775 0.6473479 0.6474180 [50] 0.6474880 0.6475579 0.6476275 0.6476969 0.6477662 0.6478353 0.6479042 [57] 0.6479729 0.6480414 0.6481098 0.6481779 0.6482459 0.6483137 0.6483813 [64] 0.6484488 0.6485160 0.6485831 0.6486499 0.6487166 0.6487831 0.6488494 [71] 0.6489156 0.6489815 0.6490473 0.6491128 0.6491782 0.6492434 0.6493085 [78] 0.6493733 0.6494379 0.6495024 0.6495667 0.6496307 0.6496946 0.6497584 [85] 0.6498219 0.6498852 0.6499484 0.6500113 0.6500741 0.6501367 0.6501991 [92] 0.6502613 0.6503233 0.6503851 0.6504468 0.6505082 0.6505695 0.6506306 [99] 0.6506915 0.6507522 0.6508127 0.6508730 0.6509332 0.6509931 0.6510529 [106] 0.6511124 0.6511718 0.6512310 0.6512900 0.6513488 0.6514074 0.6514658 [113] 0.6515241 0.6515821 0.6516400 0.6516976 0.6517551 0.6518124 0.6518695 [120] 0.6519264 0.6519831 0.6520396 0.6520960 0.6521521 0.6522080 0.6522638 [127] 0.6523194 0.6523747 0.6524299 0.6524849 0.6525397 0.6525943 0.6526487 [134] 0.6527029 0.6527570 0.6528108 0.6528644 0.6529179 0.6529711 0.6530242 [141] 0.6530771 0.6531298 0.6531823 0.6532345 0.6532866 0.6533386 0.6533903 [148] 0.6534418 0.6534931 0.6535443 0.6535952 0.6536459 0.6536965 0.6537469 [155] 0.6537970 0.6538470 0.6538968 0.6539464 0.6539958 0.6540449 0.6540939 [162] 0.6541428 0.6541914 0.6542398 0.6542880 0.6543360 0.6543839 0.6544315 [169] 0.6544790 0.6545262 0.6545733 0.6546201 0.6546668 0.6547133 0.6547596 [176] 0.6548057 0.6548515 0.6548972 0.6549427 0.6549880 0.6550331 0.6550781 [183] 0.6551228 0.6551673 0.6552116 0.6552558 0.6552997 0.6553434 0.6553870 [190] 0.6554303 0.6554735 0.6555164 0.6555592 0.6556018 0.6556441 0.6556863 [197] 0.6557283 0.6557701 0.6558117 0.6558530 0.6558942 0.6559352 0.6559760 [204] 0.6560166 0.6560571 0.6560973 0.6561373 0.6561771 0.6562167 0.6562562 [211] 0.6562954 0.6563344 0.6563733 0.6564119 0.6564504 0.6564886 0.6565267 [218] 0.6565645 0.6566022 0.6566397 0.6566769 0.6567140 0.6567509 0.6567876 [225] 0.6568240 0.6568603 0.6568964 0.6569323 0.6569680 0.6570035 0.6570388 [232] 0.6570739 0.6571088 0.6571435 0.6571781 0.6572124 0.6572465 0.6572804 [239] 0.6573142 0.6573477 0.6573810 0.6574142 0.6574471 0.6574799 0.6575124 [246] 0.6575448 0.6575769 0.6576089 0.6576407 0.6576722 0.6577036 0.6577348 [253] 0.6577658 0.6577965 0.6578271 0.6578575 0.6578877 0.6579177 0.6579475 [260] 0.6579771 0.6580065 0.6580357 0.6580647 0.6580936 0.6581222 0.6581506 [267] 0.6581788 0.6582069 0.6582347 0.6582623 0.6582898 0.6583170 0.6583441 [274] 0.6583709 0.6583976 0.6584241 0.6584503 0.6584764 0.6585023 0.6585279 [281] 0.6585534 0.6585787 0.6586038 0.6586287 0.6586534 0.6586779 0.6587022 [288] 0.6587263 0.6587502 0.6587740 0.6587975 0.6588208 0.6588439 0.6588669 [295] 0.6588896 0.6589122 0.6589345 0.6589567 0.6589786 0.6590004 0.6590220 [302] 0.6590433 0.6590645 0.6590855 0.6591063 0.6591269 0.6591473 0.6591675 [309] 0.6591875 0.6592073 0.6592269 0.6592464 0.6592656 0.6592846 0.6593035 [316] 0.6593221 0.6593406 0.6593588 0.6593769 0.6593948 0.6594124 0.6594299 [323] 0.6594472 0.6594643 0.6594812 0.6594979 0.6595144 0.6595308 0.6595469 [330] 0.6595628 0.6595785 0.6595941 0.6596094 0.6596246 0.6596396 0.6596543 [337] 0.6596689 0.6596833 0.6596975 0.6597115 0.6597253 0.6597389 0.6597523 [344] 0.6597656 0.6597786 0.6597914 0.6598041 0.6598165 0.6598288 0.6598409 [351] 0.6598528 0.6598645 0.6598759 0.6598873 0.6598984 0.6599093 0.6599200 [358] 0.6599306 0.6599409 0.6599511 0.6599610 0.6599708 0.6599804 0.6599898 [365] 0.6599990 0.6600080 0.6600168 0.6600254 0.6600339 0.6600421 0.6600502 [372] 0.6600581 0.6600657 0.6600732 0.6600805 0.6600876 0.6600945 0.6601013 [379] 0.6601078 0.6601142 0.6601203 0.6601263 0.6601321 0.6601377 0.6601431 [386] 0.6601483 0.6601533 0.6601582 0.6601628 0.6601673 0.6601715 0.6601756 [393] 0.6601795 0.6601832 0.6601867 0.6601901 0.6601932 0.6601962 0.6601989 [400] 0.6602015 0.6602039 > mx [1] 0.6602039 > 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/1dylo1226255544.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/2gcxw1226255544.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/3n1xv1226255544.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/4daij1226255544.tab") > > system("convert tmp/1dylo1226255544.ps tmp/1dylo1226255544.png") > system("convert tmp/2gcxw1226255544.ps tmp/2gcxw1226255544.png") > system("convert tmp/3n1xv1226255544.ps tmp/3n1xv1226255544.png") > > > proc.time() user system elapsed 0.965 0.492 1.160