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,87.14054095,112.0054296,112.312101,109.474134,104.9746116,100.4926851,104.2154743,120.1768388,112.1028355,108.1481575,116.802197,102.1699512,95.15358705,120.6707808,111.5234277,119.9669448,113.3697401,110.0717661,111.5567342,132.424212,107.900558,122.1626615,124.3992258,110.4450505,101.5874013,122.3203962,125.2582826,125.4411543,108.9902468,118.9243879,116.7242723,134.1724901,116.8530994,124.5732995,130.9914031,123.4239103,111.4536725,124.5135991,139.2589613,129.8596099,112.3460359,131.381655,133.0004776,134.3220552,144.2379719,134.1278719,150.1891559,140.722563,114.8389975,143.1973003,140.2738676,112.1248303,102.8951536,100.5090242,103.3513901,111.4134533,104.5887587,101.7840983,114.7007441,108.7426474) > x <- c(100,99.31916948,114.7106298,114.9941367,114.6085397,116.3633855,108.0492516,112.8502449,127.2518452,116.4999655,113.8511416,126.3771815,103.8290681,108.296889,125.0969166,115.6701386,130.2545354,131.2064565,124.8665241,122.6191626,148.2368766,117.7160792,128.9232255,130.7380837,113.1192661,116.5454922,127.9782024,132.9240533,133.9732358,121.2623301,128.559702,124.692695,140.9850314,124.6823481,134.9451611,137.2642616,132.6308891,122.7122853,132.5846727,151.5410085,145.764641,134.4043595,152.9192247,143.9387459,152.9709595,162.3356557,148.1658274,167.9499207,156.9400566,140.2241843,163.13996,160.969166,135.3031662,124.4554046,119.2143202,116.21163,125.2638477,114.0987791,110.0413879,126.6317169,113.0875354) > #'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.9137321 0.9138802 0.9140278 0.9141750 0.9143216 0.9144678 0.9146135 [8] 0.9147586 0.9149033 0.9150475 0.9151911 0.9153343 0.9154770 0.9156192 [15] 0.9157609 0.9159020 0.9160427 0.9161829 0.9163226 0.9164618 0.9166005 [22] 0.9167386 0.9168763 0.9170135 0.9171501 0.9172863 0.9174220 0.9175571 [29] 0.9176918 0.9178259 0.9179596 0.9180927 0.9182253 0.9183575 0.9184891 [36] 0.9186202 0.9187508 0.9188809 0.9190105 0.9191396 0.9192681 0.9193962 [43] 0.9195238 0.9196508 0.9197773 0.9199034 0.9200289 0.9201539 0.9202784 [50] 0.9204024 0.9205258 0.9206488 0.9207712 0.9208932 0.9210146 0.9211355 [57] 0.9212559 0.9213758 0.9214951 0.9216140 0.9217323 0.9218501 0.9219675 [64] 0.9220842 0.9222005 0.9223163 0.9224315 0.9225463 0.9226605 0.9227742 [71] 0.9228873 0.9230000 0.9231121 0.9232238 0.9233349 0.9234455 0.9235555 [78] 0.9236651 0.9237741 0.9238826 0.9239906 0.9240981 0.9242051 0.9243115 [85] 0.9244174 0.9245228 0.9246277 0.9247320 0.9248359 0.9249392 0.9250420 [92] 0.9251442 0.9252460 0.9253472 0.9254479 0.9255481 0.9256478 0.9257469 [99] 0.9258455 0.9259436 0.9260412 0.9261382 0.9262348 0.9263308 0.9264263 [106] 0.9265212 0.9266156 0.9267096 0.9268029 0.9268958 0.9269881 0.9270799 [113] 0.9271712 0.9272620 0.9273522 0.9274420 0.9275311 0.9276198 0.9277080 [120] 0.9277956 0.9278827 0.9279692 0.9280553 0.9281408 0.9282258 0.9283102 [127] 0.9283942 0.9284776 0.9285605 0.9286429 0.9287247 0.9288060 0.9288868 [134] 0.9289671 0.9290468 0.9291260 0.9292047 0.9292828 0.9293605 0.9294376 [141] 0.9295142 0.9295902 0.9296657 0.9297407 0.9298152 0.9298892 0.9299626 [148] 0.9300355 0.9301079 0.9301797 0.9302510 0.9303218 0.9303921 0.9304618 [155] 0.9305310 0.9305997 0.9306679 0.9307355 0.9308026 0.9308692 0.9309353 [162] 0.9310008 0.9310658 0.9311303 0.9311943 0.9312577 0.9313206 0.9313830 [169] 0.9314448 0.9315062 0.9315670 0.9316273 0.9316870 0.9317462 0.9318050 [176] 0.9318631 0.9319208 0.9319779 0.9320345 0.9320906 0.9321462 0.9322012 [183] 0.9322557 0.9323097 0.9323632 0.9324161 0.9324685 0.9325204 0.9325718 [190] 0.9326226 0.9326729 0.9327227 0.9327720 0.9328208 0.9328690 0.9329167 [197] 0.9329639 0.9330106 0.9330567 0.9331023 0.9331474 0.9331920 0.9332361 [204] 0.9332796 0.9333226 0.9333651 0.9334071 0.9334485 0.9334895 0.9335299 [211] 0.9335698 0.9336091 0.9336480 0.9336863 0.9337242 0.9337614 0.9337982 [218] 0.9338345 0.9338702 0.9339054 0.9339402 0.9339743 0.9340080 0.9340412 [225] 0.9340738 0.9341059 0.9341375 0.9341686 0.9341992 0.9342292 0.9342588 [232] 0.9342878 0.9343163 0.9343443 0.9343718 0.9343988 0.9344252 0.9344512 [239] 0.9344766 0.9345015 0.9345259 0.9345498 0.9345732 0.9345960 0.9346184 [246] 0.9346402 0.9346616 0.9346824 0.9347027 0.9347225 0.9347418 0.9347606 [253] 0.9347788 0.9347966 0.9348138 0.9348306 0.9348468 0.9348625 0.9348778 [260] 0.9348925 0.9349067 0.9349204 0.9349336 0.9349463 0.9349585 0.9349701 [267] 0.9349813 0.9349920 0.9350022 0.9350118 0.9350210 0.9350296 0.9350378 [274] 0.9350455 0.9350526 0.9350593 0.9350654 0.9350711 0.9350762 0.9350809 [281] 0.9350850 0.9350887 0.9350918 0.9350945 0.9350966 0.9350983 0.9350994 [288] 0.9351001 0.9351003 0.9350999 0.9350991 0.9350978 0.9350960 0.9350937 [295] 0.9350909 0.9350876 0.9350838 0.9350795 0.9350747 0.9350695 0.9350637 [302] 0.9350575 0.9350507 0.9350435 0.9350358 0.9350276 0.9350189 0.9350097 [309] 0.9350001 0.9349899 0.9349793 0.9349681 0.9349565 0.9349444 0.9349318 [316] 0.9349187 0.9349052 0.9348912 0.9348766 0.9348616 0.9348461 0.9348302 [323] 0.9348137 0.9347968 0.9347794 0.9347615 0.9347431 0.9347243 0.9347050 [330] 0.9346852 0.9346649 0.9346441 0.9346229 0.9346012 0.9345790 0.9345563 [337] 0.9345332 0.9345096 0.9344855 0.9344610 0.9344360 0.9344105 0.9343845 [344] 0.9343581 0.9343312 0.9343038 0.9342759 0.9342476 0.9342188 0.9341896 [351] 0.9341599 0.9341297 0.9340991 0.9340679 0.9340364 0.9340043 0.9339718 [358] 0.9339389 0.9339054 0.9338715 0.9338372 0.9338024 0.9337671 0.9337314 [365] 0.9336952 0.9336585 0.9336214 0.9335839 0.9335459 0.9335074 0.9334685 [372] 0.9334291 0.9333892 0.9333489 0.9333082 0.9332670 0.9332253 0.9331832 [379] 0.9331407 0.9330977 0.9330542 0.9330103 0.9329660 0.9329212 0.9328759 [386] 0.9328303 0.9327841 0.9327375 0.9326905 0.9326430 0.9325951 0.9325468 [393] 0.9324980 0.9324487 0.9323991 0.9323489 0.9322984 0.9322474 0.9321959 [400] 0.9321441 0.9320917 > mx [1] 0.9351003 > mxli [1] 0.88 > 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/1s7at1257948640.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/24un21257948640.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/3wub91257948640.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/46cjw1257948640.tab") > system("convert tmp/1s7at1257948640.ps tmp/1s7at1257948640.png") > system("convert tmp/24un21257948640.ps tmp/24un21257948640.png") > system("convert tmp/3wub91257948640.ps tmp/3wub91257948640.png") > > > proc.time() user system elapsed 0.812 0.518 1.236