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(104.89,105.15,105.24,105.57,105.62,106.17,106.27,106.41,106.94,107.16,107.32,107.32,107.35,107.55,107.87,108.37,108.38,107.92,108.03,108.14,108.3,108.64,108.66,109.04,109.03,109.03,109.54,109.75,109.83,109.65,109.82,109.95,110.12,110.15,110.21,109.99,110.14,110.14,110.81,110.97,110.99,109.73,109.81,110.02,110.18,110.21,110.25,110.36,110.51,110.6,110.95,111.18,111.19,111.69,111.7,111.83,111.77,111.73,112.01,111.86,112.04) > x <- c(124,118.63,121.86,119.97,125.03,130.09,126.65,121.7,119.24,122.63,116.66,114.12,113.11,112.61,113.4,115.18,121.01,119.44,116.68,117.07,117.41,119.58,120.92,117.09,116.77,119.39,122.49,124.08,118.29,112.94,113.79,114.43,118.7,120.36,118.27,118.34,117.82,117.65,118.18,121.02,124.78,131.16,130.14,131.75,134.73,135.35,140.32,136.35,131.6,128.9,133.89,138.25,146.23,144.76,149.3,156.8,159.08,165.12,163.14,153.43,151.01) > #'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.5738410 0.5739292 0.5740173 0.5741051 0.5741928 0.5742803 0.5743677 [8] 0.5744549 0.5745419 0.5746287 0.5747154 0.5748019 0.5748882 0.5749744 [15] 0.5750604 0.5751462 0.5752318 0.5753173 0.5754026 0.5754877 0.5755726 [22] 0.5756574 0.5757420 0.5758264 0.5759107 0.5759947 0.5760786 0.5761623 [29] 0.5762459 0.5763293 0.5764124 0.5764955 0.5765783 0.5766610 0.5767434 [36] 0.5768257 0.5769079 0.5769898 0.5770716 0.5771532 0.5772346 0.5773158 [43] 0.5773969 0.5774777 0.5775584 0.5776390 0.5777193 0.5777994 0.5778794 [50] 0.5779592 0.5780388 0.5781182 0.5781975 0.5782765 0.5783554 0.5784341 [57] 0.5785126 0.5785910 0.5786691 0.5787471 0.5788249 0.5789025 0.5789799 [64] 0.5790571 0.5791342 0.5792110 0.5792877 0.5793642 0.5794405 0.5795166 [71] 0.5795925 0.5796683 0.5797438 0.5798192 0.5798944 0.5799694 0.5800442 [78] 0.5801188 0.5801932 0.5802675 0.5803415 0.5804154 0.5804891 0.5805626 [85] 0.5806359 0.5807090 0.5807819 0.5808546 0.5809272 0.5809995 0.5810717 [92] 0.5811436 0.5812154 0.5812870 0.5813584 0.5814296 0.5815006 0.5815714 [99] 0.5816420 0.5817125 0.5817827 0.5818528 0.5819226 0.5819923 0.5820617 [106] 0.5821310 0.5822001 0.5822689 0.5823376 0.5824061 0.5824744 0.5825425 [113] 0.5826104 0.5826781 0.5827456 0.5828130 0.5828801 0.5829470 0.5830137 [120] 0.5830802 0.5831466 0.5832127 0.5832786 0.5833444 0.5834099 0.5834753 [127] 0.5835404 0.5836053 0.5836701 0.5837346 0.5837990 0.5838631 0.5839271 [134] 0.5839908 0.5840544 0.5841177 0.5841809 0.5842438 0.5843065 0.5843691 [141] 0.5844314 0.5844936 0.5845555 0.5846172 0.5846788 0.5847401 0.5848012 [148] 0.5848622 0.5849229 0.5849834 0.5850437 0.5851038 0.5851637 0.5852234 [155] 0.5852829 0.5853422 0.5854013 0.5854602 0.5855189 0.5855774 0.5856356 [162] 0.5856937 0.5857516 0.5858092 0.5858667 0.5859239 0.5859809 0.5860378 [169] 0.5860944 0.5861508 0.5862070 0.5862630 0.5863188 0.5863744 0.5864298 [176] 0.5864850 0.5865399 0.5865947 0.5866492 0.5867036 0.5867577 0.5868116 [183] 0.5868653 0.5869188 0.5869721 0.5870252 0.5870781 0.5871307 0.5871832 [190] 0.5872354 0.5872874 0.5873393 0.5873909 0.5874423 0.5874935 0.5875444 [197] 0.5875952 0.5876458 0.5876961 0.5877462 0.5877961 0.5878458 0.5878953 [204] 0.5879446 0.5879937 0.5880425 0.5880912 0.5881396 0.5881878 0.5882358 [211] 0.5882836 0.5883312 0.5883785 0.5884257 0.5884726 0.5885193 0.5885658 [218] 0.5886121 0.5886582 0.5887041 0.5887497 0.5887951 0.5888403 0.5888853 [225] 0.5889301 0.5889747 0.5890190 0.5890632 0.5891071 0.5891508 0.5891943 [232] 0.5892375 0.5892806 0.5893234 0.5893660 0.5894084 0.5894506 0.5894926 [239] 0.5895343 0.5895759 0.5896172 0.5896583 0.5896991 0.5897398 0.5897802 [246] 0.5898205 0.5898605 0.5899002 0.5899398 0.5899792 0.5900183 0.5900572 [253] 0.5900959 0.5901344 0.5901726 0.5902106 0.5902484 0.5902860 0.5903234 [260] 0.5903606 0.5903975 0.5904342 0.5904707 0.5905070 0.5905430 0.5905788 [267] 0.5906144 0.5906498 0.5906850 0.5907199 0.5907547 0.5907892 0.5908234 [274] 0.5908575 0.5908913 0.5909249 0.5909583 0.5909915 0.5910245 0.5910572 [281] 0.5910897 0.5911220 0.5911540 0.5911859 0.5912175 0.5912489 0.5912800 [288] 0.5913110 0.5913417 0.5913722 0.5914025 0.5914325 0.5914624 0.5914920 [295] 0.5915214 0.5915505 0.5915795 0.5916082 0.5916367 0.5916649 0.5916930 [302] 0.5917208 0.5917484 0.5917757 0.5918029 0.5918298 0.5918565 0.5918830 [309] 0.5919092 0.5919352 0.5919610 0.5919866 0.5920120 0.5920371 0.5920620 [316] 0.5920867 0.5921111 0.5921353 0.5921593 0.5921831 0.5922066 0.5922300 [323] 0.5922531 0.5922759 0.5922986 0.5923210 0.5923432 0.5923651 0.5923869 [330] 0.5924084 0.5924297 0.5924508 0.5924716 0.5924922 0.5925126 0.5925328 [337] 0.5925527 0.5925724 0.5925919 0.5926111 0.5926302 0.5926490 0.5926675 [344] 0.5926859 0.5927040 0.5927219 0.5927396 0.5927570 0.5927742 0.5927912 [351] 0.5928080 0.5928245 0.5928408 0.5928569 0.5928728 0.5928884 0.5929038 [358] 0.5929190 0.5929339 0.5929486 0.5929631 0.5929774 0.5929914 0.5930052 [365] 0.5930188 0.5930322 0.5930453 0.5930582 0.5930709 0.5930833 0.5930956 [372] 0.5931076 0.5931193 0.5931309 0.5931422 0.5931533 0.5931641 0.5931748 [379] 0.5931852 0.5931953 0.5932053 0.5932150 0.5932245 0.5932338 0.5932428 [386] 0.5932516 0.5932602 0.5932686 0.5932767 0.5932846 0.5932923 0.5932997 [393] 0.5933069 0.5933139 0.5933207 0.5933272 0.5933335 0.5933396 0.5933455 [400] 0.5933511 0.5933565 > mx [1] 0.5933565 > 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/158c91258040940.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/2d9881258040940.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/3pepa1258040940.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/450i71258040940.tab") > > system("convert tmp/158c91258040940.ps tmp/158c91258040940.png") > system("convert tmp/2d9881258040940.ps tmp/2d9881258040940.png") > system("convert tmp/3pepa1258040940.ps tmp/3pepa1258040940.png") > > > proc.time() user system elapsed 0.771 0.486 0.948