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(17903.9,16379.4,15420.3,17870.5,15912.8,13866.5,17823.2,17872,17422,16704.5,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,20906.5,21164.1,21374.4,22952.3,21343.5,23899.3,22392.9,18274.1,22786.7,22321.5,17842.2,16373.5,15993.8,16446.1,17729) > x <- c(17192.4,15386.1,14287.1,17526.6,14497,14398.3,16629.6,16670.7,16614.8,16869.2,15663.9,16359.9,18447.7,16889,16505,18320.9,15052.1,15699.8,18135.3,16768.7,18883,19021,18101.9,17776.1,21489.9,17065.3,18690,18953.1,16398.9,16895.6,18553,19270,19422.1,17579.4,18637.3,18076.7,20438.6,18075.2,19563,19899.2,19227.5,17789.6,19220.8,21968.9,21131.5,19484.6,22168.7,20866.8,22176.2,23533.8,21479.6,24347.7,22751.6,20328.3,23650.4,23335.7,19614.9,18042.3,17282.5,16847.2,18159.5) > #'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.9090470 0.9092213 0.9093951 0.9095684 0.9097412 0.9099134 0.9100851 [8] 0.9102563 0.9104269 0.9105971 0.9107666 0.9109357 0.9111042 0.9112722 [15] 0.9114397 0.9116066 0.9117730 0.9119388 0.9121041 0.9122689 0.9124331 [22] 0.9125968 0.9127600 0.9129226 0.9130846 0.9132462 0.9134072 0.9135676 [29] 0.9137275 0.9138869 0.9140457 0.9142039 0.9143617 0.9145188 0.9146755 [36] 0.9148315 0.9149871 0.9151421 0.9152965 0.9154504 0.9156037 0.9157565 [43] 0.9159087 0.9160604 0.9162115 0.9163621 0.9165121 0.9166616 0.9168105 [50] 0.9169588 0.9171066 0.9172538 0.9174005 0.9175466 0.9176922 0.9178372 [57] 0.9179817 0.9181255 0.9182689 0.9184116 0.9185538 0.9186955 0.9188365 [64] 0.9189771 0.9191170 0.9192564 0.9193952 0.9195335 0.9196712 0.9198083 [71] 0.9199449 0.9200809 0.9202163 0.9203511 0.9204854 0.9206192 0.9207523 [78] 0.9208849 0.9210169 0.9211484 0.9212792 0.9214095 0.9215393 0.9216684 [85] 0.9217970 0.9219250 0.9220525 0.9221793 0.9223056 0.9224314 0.9225565 [92] 0.9226811 0.9228051 0.9229285 0.9230513 0.9231736 0.9232953 0.9234164 [99] 0.9235370 0.9236569 0.9237763 0.9238951 0.9240133 0.9241310 0.9242480 [106] 0.9243645 0.9244804 0.9245958 0.9247105 0.9248247 0.9249383 0.9250513 [113] 0.9251637 0.9252756 0.9253868 0.9254975 0.9256076 0.9257171 0.9258260 [120] 0.9259344 0.9260421 0.9261493 0.9262559 0.9263619 0.9264674 0.9265722 [127] 0.9266765 0.9267801 0.9268832 0.9269857 0.9270876 0.9271890 0.9272897 [134] 0.9273899 0.9274894 0.9275884 0.9276868 0.9277846 0.9278819 0.9279785 [141] 0.9280746 0.9281700 0.9282649 0.9283592 0.9284529 0.9285460 0.9286385 [148] 0.9287305 0.9288218 0.9289126 0.9290027 0.9290923 0.9291813 0.9292697 [155] 0.9293575 0.9294448 0.9295314 0.9296174 0.9297029 0.9297878 0.9298721 [162] 0.9299557 0.9300388 0.9301214 0.9302033 0.9302846 0.9303654 0.9304455 [169] 0.9305251 0.9306040 0.9306824 0.9307602 0.9308374 0.9309140 0.9309901 [176] 0.9310655 0.9311404 0.9312146 0.9312883 0.9313614 0.9314338 0.9315057 [183] 0.9315771 0.9316478 0.9317179 0.9317874 0.9318564 0.9319248 0.9319925 [190] 0.9320597 0.9321263 0.9321923 0.9322577 0.9323226 0.9323868 0.9324504 [197] 0.9325135 0.9325760 0.9326379 0.9326992 0.9327599 0.9328200 0.9328795 [204] 0.9329385 0.9329968 0.9330546 0.9331118 0.9331684 0.9332244 0.9332798 [211] 0.9333346 0.9333889 0.9334425 0.9334956 0.9335481 0.9336000 0.9336513 [218] 0.9337021 0.9337522 0.9338018 0.9338507 0.9338991 0.9339469 0.9339942 [225] 0.9340408 0.9340868 0.9341323 0.9341772 0.9342215 0.9342652 0.9343084 [232] 0.9343509 0.9343929 0.9344343 0.9344751 0.9345153 0.9345550 0.9345940 [239] 0.9346325 0.9346704 0.9347078 0.9347445 0.9347807 0.9348163 0.9348513 [246] 0.9348857 0.9349195 0.9349528 0.9349855 0.9350176 0.9350492 0.9350801 [253] 0.9351105 0.9351403 0.9351696 0.9351982 0.9352263 0.9352538 0.9352807 [260] 0.9353071 0.9353329 0.9353581 0.9353827 0.9354068 0.9354303 0.9354532 [267] 0.9354756 0.9354974 0.9355186 0.9355392 0.9355593 0.9355788 0.9355977 [274] 0.9356161 0.9356339 0.9356511 0.9356678 0.9356839 0.9356994 0.9357143 [281] 0.9357287 0.9357426 0.9357558 0.9357685 0.9357807 0.9357922 0.9358032 [288] 0.9358137 0.9358236 0.9358329 0.9358417 0.9358499 0.9358575 0.9358646 [295] 0.9358711 0.9358771 0.9358825 0.9358873 0.9358916 0.9358953 0.9358985 [302] 0.9359011 0.9359032 0.9359047 0.9359057 0.9359061 0.9359059 0.9359052 [309] 0.9359039 0.9359021 0.9358998 0.9358969 0.9358934 0.9358894 0.9358848 [316] 0.9358797 0.9358741 0.9358679 0.9358611 0.9358538 0.9358460 0.9358376 [323] 0.9358287 0.9358192 0.9358092 0.9357986 0.9357875 0.9357758 0.9357637 [330] 0.9357509 0.9357377 0.9357239 0.9357095 0.9356946 0.9356792 0.9356633 [337] 0.9356468 0.9356297 0.9356122 0.9355941 0.9355754 0.9355563 0.9355366 [344] 0.9355164 0.9354956 0.9354743 0.9354525 0.9354301 0.9354073 0.9353839 [351] 0.9353599 0.9353355 0.9353105 0.9352850 0.9352589 0.9352324 0.9352053 [358] 0.9351777 0.9351496 0.9351209 0.9350917 0.9350621 0.9350319 0.9350011 [365] 0.9349699 0.9349381 0.9349058 0.9348731 0.9348397 0.9348059 0.9347716 [372] 0.9347367 0.9347014 0.9346655 0.9346291 0.9345922 0.9345548 0.9345169 [379] 0.9344785 0.9344396 0.9344001 0.9343602 0.9343198 0.9342788 0.9342374 [386] 0.9341954 0.9341530 0.9341100 0.9340666 0.9340226 0.9339781 0.9339332 [393] 0.9338877 0.9338418 0.9337954 0.9337484 0.9337010 0.9336531 0.9336046 [400] 0.9335557 0.9335063 > mx [1] 0.935906 > mxli [1] 1.05 > 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/1s0lb1260537279.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/2v04g1260537279.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/34mjc1260537279.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/43w1p1260537279.tab") > > system("convert tmp/1s0lb1260537279.ps tmp/1s0lb1260537279.png") > system("convert tmp/2v04g1260537279.ps tmp/2v04g1260537279.png") > system("convert tmp/34mjc1260537279.ps tmp/34mjc1260537279.png") > > > proc.time() user system elapsed 0.763 0.501 0.925