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(100.00,102.83,109.50,115.91,107.94,110.86,118.89,123.38,113.33,116.38,122.04,125.47,115.62,117.91,122.40,125.05,114.18,114.74,120.63,123.68,112.84,115.64,122.32,124.59,116.33,117.45,125.64,128.38,119.87,121.22,128.98,131.35,121.35,123.72,131.06,134.55,125.93,128.90,136.19,140.34,130.48,134.68,141.05,145.44,136.21,139.85,147.13,151.44,143.62,148.55,153.54,159.79,152.55,155.84,160.38,164.22,156.40,160.05,165.60,171.15,161.90,167.21,171.34,176.83,166.27,172.30,176.71,182.99,172.07,178.17,182.20,188.49,176.88,182.13,185.32,192.86,180.27,184.92,187.82,194.94,184.36,188.80,193.42,199.76,188.78,191.49,194.87,198.28,183.24,204.87) > x <- c(100.30,101.90,102.10,103.20,103.70,106.20,107.70,109.90,111.70,114.90,116.00,118.30,120.40,126.00,128.10,130.10,130.80,133.60,134.20,135.50,136.20,139.10,139.00,139.60,138.70,140.90,141.30,141.80,142.00,144.50,144.60,145.50,146.80,149.50,149.90,150.10,150.90,152.80,153.10,154.00,154.90,156.90,158.40,159.70,160.20,163.20,163.70,164.40,163.70,165.50,165.60,166.80,167.50,170.60,170.90,172.00,171.80,173.90,174.00,173.80,173.90,176.00,176.60,178.20,179.20,181.30,181.80,182.90,183.80,186.30,187.40,189.20,189.70,191.90,192.60,193.70,194.20,197.60,199.30,201.40,203.00,206.30,207.10,209.80,211.10,215.30,217.40,215.50,210.90,212.60) > #'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.8443341 0.8448447 0.8453547 0.8458641 0.8463729 0.8468812 0.8473889 [8] 0.8478960 0.8484025 0.8489084 0.8494137 0.8499184 0.8504225 0.8509260 [15] 0.8514289 0.8519312 0.8524328 0.8529338 0.8534341 0.8539338 0.8544328 [22] 0.8549312 0.8554290 0.8559260 0.8564224 0.8569181 0.8574132 0.8579075 [29] 0.8584012 0.8588942 0.8593864 0.8598780 0.8603688 0.8608590 0.8613484 [36] 0.8618371 0.8623250 0.8628122 0.8632987 0.8637844 0.8642694 0.8647536 [43] 0.8652371 0.8657198 0.8662017 0.8666829 0.8671633 0.8676428 0.8681216 [50] 0.8685996 0.8690768 0.8695532 0.8700288 0.8705036 0.8709775 0.8714506 [57] 0.8719229 0.8723944 0.8728650 0.8733348 0.8738037 0.8742718 0.8747390 [64] 0.8752054 0.8756708 0.8761355 0.8765992 0.8770620 0.8775240 0.8779851 [71] 0.8784452 0.8789045 0.8793629 0.8798203 0.8802769 0.8807325 0.8811872 [78] 0.8816410 0.8820938 0.8825457 0.8829967 0.8834467 0.8838957 0.8843438 [85] 0.8847910 0.8852372 0.8856824 0.8861266 0.8865698 0.8870121 0.8874534 [92] 0.8878937 0.8883330 0.8887713 0.8892085 0.8896448 0.8900801 0.8905143 [99] 0.8909475 0.8913797 0.8918109 0.8922410 0.8926701 0.8930982 0.8935251 [106] 0.8939511 0.8943760 0.8947998 0.8952226 0.8956443 0.8960649 0.8964844 [113] 0.8969029 0.8973202 0.8977365 0.8981517 0.8985658 0.8989788 0.8993907 [120] 0.8998015 0.9002111 0.9006197 0.9010271 0.9014334 0.9018386 0.9022426 [127] 0.9026455 0.9030473 0.9034479 0.9038474 0.9042457 0.9046429 0.9050389 [134] 0.9054337 0.9058274 0.9062199 0.9066113 0.9070014 0.9073904 0.9077782 [141] 0.9081648 0.9085502 0.9089344 0.9093175 0.9096993 0.9100799 0.9104593 [148] 0.9108375 0.9112145 0.9115903 0.9119648 0.9123381 0.9127102 0.9130811 [155] 0.9134507 0.9138191 0.9141862 0.9145522 0.9149168 0.9152802 0.9156424 [162] 0.9160033 0.9163629 0.9167213 0.9170784 0.9174342 0.9177888 0.9181421 [169] 0.9184941 0.9188448 0.9191943 0.9195425 0.9198894 0.9202350 0.9205792 [176] 0.9209223 0.9212640 0.9216044 0.9219435 0.9222812 0.9226177 0.9229529 [183] 0.9232867 0.9236193 0.9239505 0.9242804 0.9246090 0.9249362 0.9252621 [190] 0.9255867 0.9259099 0.9262318 0.9265524 0.9268716 0.9271895 0.9275061 [197] 0.9278213 0.9281351 0.9284476 0.9287587 0.9290685 0.9293769 0.9296840 [204] 0.9299897 0.9302941 0.9305970 0.9308986 0.9311989 0.9314977 0.9317952 [211] 0.9320913 0.9323861 0.9326794 0.9329714 0.9332620 0.9335512 0.9338390 [218] 0.9341254 0.9344105 0.9346942 0.9349764 0.9352573 0.9355368 0.9358148 [225] 0.9360915 0.9363668 0.9366407 0.9369132 0.9371842 0.9374539 0.9377222 [232] 0.9379890 0.9382545 0.9385185 0.9387811 0.9390423 0.9393021 0.9395605 [239] 0.9398175 0.9400730 0.9403272 0.9405799 0.9408312 0.9410810 0.9413295 [246] 0.9415765 0.9418221 0.9420663 0.9423091 0.9425504 0.9427903 0.9430288 [253] 0.9432658 0.9435014 0.9437356 0.9439684 0.9441997 0.9444296 0.9446581 [260] 0.9448851 0.9451107 0.9453349 0.9455576 0.9457789 0.9459987 0.9462172 [267] 0.9464342 0.9466497 0.9468638 0.9470765 0.9472878 0.9474976 0.9477059 [274] 0.9479129 0.9481184 0.9483224 0.9485250 0.9487262 0.9489260 0.9491243 [281] 0.9493212 0.9495166 0.9497106 0.9499031 0.9500942 0.9502839 0.9504722 [288] 0.9506590 0.9508443 0.9510283 0.9512108 0.9513918 0.9515714 0.9517496 [295] 0.9519264 0.9521017 0.9522756 0.9524480 0.9526190 0.9527886 0.9529568 [302] 0.9531235 0.9532888 0.9534526 0.9536150 0.9537760 0.9539356 0.9540937 [309] 0.9542504 0.9544057 0.9545595 0.9547119 0.9548629 0.9550125 0.9551606 [316] 0.9553074 0.9554527 0.9555965 0.9557390 0.9558800 0.9560197 0.9561579 [323] 0.9562946 0.9564300 0.9565640 0.9566965 0.9568276 0.9569573 0.9570856 [330] 0.9572125 0.9573380 0.9574621 0.9575848 0.9577060 0.9578259 0.9579444 [337] 0.9580614 0.9581771 0.9582913 0.9584042 0.9585157 0.9586258 0.9587344 [344] 0.9588417 0.9589476 0.9590521 0.9591552 0.9592570 0.9593573 0.9594563 [351] 0.9595539 0.9596501 0.9597449 0.9598384 0.9599304 0.9600211 0.9601105 [358] 0.9601984 0.9602850 0.9603702 0.9604541 0.9605366 0.9606177 0.9606975 [365] 0.9607759 0.9608529 0.9609286 0.9610030 0.9610760 0.9611476 0.9612179 [372] 0.9612869 0.9613545 0.9614208 0.9614857 0.9615493 0.9616115 0.9616725 [379] 0.9617321 0.9617903 0.9618472 0.9619029 0.9619571 0.9620101 0.9620617 [386] 0.9621121 0.9621611 0.9622088 0.9622551 0.9623002 0.9623440 0.9623865 [393] 0.9624276 0.9624675 0.9625060 0.9625433 0.9625793 0.9626140 0.9626474 [400] 0.9626795 0.9627103 > mx [1] 0.9627103 > 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/1ez8v1257974365.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/2t3ce1257974365.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/3h3gz1257974365.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/42e5e1257974365.tab") > > system("convert tmp/1ez8v1257974365.ps tmp/1ez8v1257974365.png") > system("convert tmp/2t3ce1257974365.ps tmp/2t3ce1257974365.png") > system("convert tmp/3h3gz1257974365.ps tmp/3h3gz1257974365.png") > > > proc.time() user system elapsed 0.796 0.516 1.082