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(2220.6,2161.5,1863.6,1955.1,1907.4,1889.4,2246.3,2213,1965,2285.6,1983.8,1872.4,2371.4,2287,2198.2,2330.4,2014.4,2066.1,2355.8,2232.5,2091.7,2376.5,1931.9,2025.7,2404.9,2316.1,2368.1,2282.5,2158.6,2174.8,2594.1,2281.4,2547.9,2606.3,2190.8,2262.3,2423.8,2520.4,2482.9,2215.9,2441.9,2333.8,2670.2,2431,2559.3,2661.4,2404.6,2378.3,2489.2,2941,2700.9,2335.6,2770,2764.2,2784.9,2898.8,2853.4,3022.6,2851.4,2630.8) > x <- c(16283.6,16726.5,14968.9,14861,14583.3,15305.8,17903.9,16379.4,15420.3,17870.5,15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22160,20664.3,17877.4,21211.2,21423.1,21688.7,23243.2,21490.2,22925.8,23184.8,18562.2) > #'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.9292232 0.9293900 0.9295564 0.9297223 0.9298877 0.9300527 0.9302172 [8] 0.9303813 0.9305448 0.9307080 0.9308706 0.9310328 0.9311945 0.9313557 [15] 0.9315165 0.9316768 0.9318366 0.9319960 0.9321548 0.9323132 0.9324712 [22] 0.9326287 0.9327856 0.9329422 0.9330982 0.9332538 0.9334089 0.9335635 [29] 0.9337176 0.9338713 0.9340245 0.9341772 0.9343294 0.9344811 0.9346324 [36] 0.9347832 0.9349335 0.9350833 0.9352327 0.9353816 0.9355299 0.9356778 [43] 0.9358253 0.9359722 0.9361186 0.9362646 0.9364101 0.9365551 0.9366996 [50] 0.9368436 0.9369872 0.9371302 0.9372728 0.9374149 0.9375565 0.9376976 [57] 0.9378382 0.9379783 0.9381179 0.9382571 0.9383957 0.9385339 0.9386716 [64] 0.9388087 0.9389454 0.9390816 0.9392173 0.9393525 0.9394873 0.9396215 [71] 0.9397552 0.9398885 0.9400212 0.9401534 0.9402852 0.9404164 0.9405472 [78] 0.9406775 0.9408072 0.9409365 0.9410653 0.9411935 0.9413213 0.9414486 [85] 0.9415754 0.9417016 0.9418274 0.9419527 0.9420775 0.9422017 0.9423255 [92] 0.9424488 0.9425716 0.9426938 0.9428156 0.9429369 0.9430576 0.9431779 [99] 0.9432976 0.9434169 0.9435356 0.9436539 0.9437716 0.9438889 0.9440056 [106] 0.9441218 0.9442375 0.9443528 0.9444675 0.9445817 0.9446954 0.9448086 [113] 0.9449212 0.9450334 0.9451451 0.9452562 0.9453669 0.9454770 0.9455867 [120] 0.9456958 0.9458044 0.9459125 0.9460201 0.9461272 0.9462338 0.9463398 [127] 0.9464454 0.9465504 0.9466550 0.9467590 0.9468625 0.9469655 0.9470680 [134] 0.9471700 0.9472715 0.9473724 0.9474729 0.9475728 0.9476722 0.9477711 [141] 0.9478695 0.9479674 0.9480647 0.9481616 0.9482579 0.9483538 0.9484491 [148] 0.9485439 0.9486381 0.9487319 0.9488252 0.9489179 0.9490101 0.9491018 [155] 0.9491930 0.9492837 0.9493739 0.9494635 0.9495526 0.9496413 0.9497293 [162] 0.9498169 0.9499040 0.9499905 0.9500766 0.9501621 0.9502471 0.9503316 [169] 0.9504155 0.9504990 0.9505819 0.9506643 0.9507462 0.9508276 0.9509085 [176] 0.9509888 0.9510687 0.9511480 0.9512268 0.9513050 0.9513828 0.9514600 [183] 0.9515368 0.9516130 0.9516886 0.9517638 0.9518385 0.9519126 0.9519862 [190] 0.9520593 0.9521319 0.9522039 0.9522755 0.9523465 0.9524170 0.9524870 [197] 0.9525565 0.9526254 0.9526938 0.9527618 0.9528291 0.9528960 0.9529624 [204] 0.9530282 0.9530935 0.9531583 0.9532226 0.9532864 0.9533496 0.9534124 [211] 0.9534746 0.9535363 0.9535974 0.9536581 0.9537182 0.9537778 0.9538369 [218] 0.9538955 0.9539536 0.9540111 0.9540682 0.9541247 0.9541807 0.9542361 [225] 0.9542911 0.9543455 0.9543994 0.9544529 0.9545057 0.9545581 0.9546100 [232] 0.9546613 0.9547121 0.9547624 0.9548122 0.9548615 0.9549102 0.9549584 [239] 0.9550062 0.9550533 0.9551000 0.9551462 0.9551918 0.9552370 0.9552816 [246] 0.9553257 0.9553693 0.9554124 0.9554549 0.9554970 0.9555385 0.9555795 [253] 0.9556200 0.9556600 0.9556994 0.9557384 0.9557768 0.9558147 0.9558521 [260] 0.9558890 0.9559254 0.9559613 0.9559966 0.9560315 0.9560658 0.9560996 [267] 0.9561329 0.9561657 0.9561980 0.9562297 0.9562610 0.9562917 0.9563220 [274] 0.9563517 0.9563809 0.9564096 0.9564378 0.9564654 0.9564926 0.9565192 [281] 0.9565454 0.9565710 0.9565961 0.9566207 0.9566449 0.9566684 0.9566915 [288] 0.9567141 0.9567362 0.9567577 0.9567788 0.9567993 0.9568194 0.9568389 [295] 0.9568579 0.9568764 0.9568945 0.9569120 0.9569290 0.9569454 0.9569614 [302] 0.9569769 0.9569919 0.9570064 0.9570203 0.9570338 0.9570468 0.9570592 [309] 0.9570712 0.9570826 0.9570936 0.9571040 0.9571140 0.9571234 0.9571323 [316] 0.9571408 0.9571487 0.9571562 0.9571631 0.9571695 0.9571755 0.9571809 [323] 0.9571859 0.9571903 0.9571942 0.9571977 0.9572006 0.9572031 0.9572050 [330] 0.9572065 0.9572075 0.9572079 0.9572079 0.9572074 0.9572063 0.9572048 [337] 0.9572028 0.9572003 0.9571973 0.9571938 0.9571898 0.9571853 0.9571804 [344] 0.9571749 0.9571690 0.9571625 0.9571556 0.9571481 0.9571402 0.9571318 [351] 0.9571229 0.9571135 0.9571037 0.9570933 0.9570825 0.9570711 0.9570593 [358] 0.9570470 0.9570342 0.9570209 0.9570071 0.9569929 0.9569782 0.9569629 [365] 0.9569472 0.9569310 0.9569144 0.9568972 0.9568796 0.9568615 0.9568429 [372] 0.9568238 0.9568042 0.9567842 0.9567637 0.9567427 0.9567212 0.9566992 [379] 0.9566768 0.9566539 0.9566305 0.9566066 0.9565823 0.9565575 0.9565322 [386] 0.9565064 0.9564801 0.9564534 0.9564262 0.9563986 0.9563704 0.9563418 [393] 0.9563128 0.9562832 0.9562532 0.9562227 0.9561917 0.9561603 0.9561284 [400] 0.9560960 0.9560632 > mx [1] 0.957208 > mxli [1] 1.31 > 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/1hwdw1229955112.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/2v7pg1229955112.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/3ljez1229955112.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/4osf71229955112.tab") > > system("convert tmp/1hwdw1229955112.ps tmp/1hwdw1229955112.png") > system("convert tmp/2v7pg1229955112.ps tmp/2v7pg1229955112.png") > system("convert tmp/3ljez1229955112.ps tmp/3ljez1229955112.png") > > > proc.time() user system elapsed 0.775 0.515 1.018