R version 2.7.2 (2008-08-25) 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(2187,1852,1570,1851,1954,1828,2251,2277,2085,2282,2266,1878,2267,2069,1746,2299,2360,2214,2825,2355,2333,3016,2155,2172,2150,2533,2058,2160,2259,2498,2695,2799,2945,2930,2318,2540,2570,2669,2450,2842,3439,2677,2979,2257,2842,2546,2455,2293,2379,2478,2054,2272,2351,2271,2542,2304,2194,2722,2395,2146,1894,2548,2087,2063,2481,2476,2212,2834,2148,2598) > x <- c(109.1,113.8,97.4,72.5,82.7,88.9,105.9,100.8,94,105,58.5,87.6,113.1,112.5,89.6,74.5,82.7,90.1,109.4,96,89.2,109.1,49.1,92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84,103.3,88.5,99,105.9,44.7,94,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6,104.7) > #'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.06565781 0.06581902 0.06598048 0.06614218 0.06630411 0.06646628 [7] 0.06662869 0.06679133 0.06695421 0.06711731 0.06728065 0.06744421 [13] 0.06760800 0.06777202 0.06793626 0.06810072 0.06826541 0.06843031 [19] 0.06859543 0.06876077 0.06892632 0.06909209 0.06925807 0.06942425 [25] 0.06959065 0.06975725 0.06992406 0.07009107 0.07025828 0.07042570 [31] 0.07059331 0.07076112 0.07092912 0.07109732 0.07126571 0.07143429 [37] 0.07160306 0.07177201 0.07194115 0.07211048 0.07227998 0.07244966 [43] 0.07261952 0.07278956 0.07295977 0.07313015 0.07330071 0.07347143 [49] 0.07364232 0.07381337 0.07398458 0.07415596 0.07432750 0.07449919 [55] 0.07467103 0.07484304 0.07501519 0.07518749 0.07535994 0.07553253 [61] 0.07570527 0.07587815 0.07605116 0.07622432 0.07639761 0.07657103 [67] 0.07674459 0.07691827 0.07709208 0.07726602 0.07744008 0.07761426 [73] 0.07778855 0.07796297 0.07813750 0.07831214 0.07848689 0.07866175 [79] 0.07883672 0.07901179 0.07918696 0.07936223 0.07953760 0.07971307 [85] 0.07988862 0.08006427 0.08024001 0.08041583 0.08059174 0.08076773 [91] 0.08094380 0.08111995 0.08129617 0.08147246 0.08164883 0.08182526 [97] 0.08200176 0.08217833 0.08235496 0.08253164 0.08270838 0.08288518 [103] 0.08306203 0.08323894 0.08341589 0.08359288 0.08376992 0.08394700 [109] 0.08412412 0.08430128 0.08447847 0.08465569 0.08483294 0.08501022 [115] 0.08518752 0.08536485 0.08554219 0.08571956 0.08589694 0.08607433 [121] 0.08625174 0.08642915 0.08660657 0.08678399 0.08696142 0.08713884 [127] 0.08731626 0.08749368 0.08767109 0.08784848 0.08802587 0.08820324 [133] 0.08838059 0.08855792 0.08873523 0.08891252 0.08908978 0.08926701 [139] 0.08944421 0.08962138 0.08979851 0.08997560 0.09015265 0.09032965 [145] 0.09050662 0.09068353 0.09086039 0.09103720 0.09121396 0.09139066 [151] 0.09156730 0.09174388 0.09192039 0.09209683 0.09227321 0.09244952 [157] 0.09262575 0.09280191 0.09297799 0.09315398 0.09332990 0.09350573 [163] 0.09368147 0.09385713 0.09403269 0.09420815 0.09438352 0.09455880 [169] 0.09473397 0.09490903 0.09508399 0.09525885 0.09543359 0.09560822 [175] 0.09578274 0.09595714 0.09613142 0.09630558 0.09647961 0.09665352 [181] 0.09682730 0.09700096 0.09717448 0.09734786 0.09752111 0.09769422 [187] 0.09786719 0.09804001 0.09821269 0.09838522 0.09855760 0.09872983 [193] 0.09890191 0.09907383 0.09924559 0.09941720 0.09958864 0.09975991 [199] 0.09993102 0.10010196 0.10027273 0.10044333 0.10061376 0.10078400 [205] 0.10095407 0.10112396 0.10129366 0.10146318 0.10163252 0.10180166 [211] 0.10197061 0.10213938 0.10230794 0.10247631 0.10264449 0.10281246 [217] 0.10298023 0.10314779 0.10331515 0.10348231 0.10364925 0.10381598 [223] 0.10398250 0.10414880 0.10431489 0.10448075 0.10464640 0.10481182 [229] 0.10497702 0.10514200 0.10530674 0.10547126 0.10563555 0.10579960 [235] 0.10596342 0.10612700 0.10629035 0.10645345 0.10661631 0.10677893 [241] 0.10694131 0.10710344 0.10726532 0.10742696 0.10758834 0.10774947 [247] 0.10791034 0.10807096 0.10823133 0.10839143 0.10855127 0.10871085 [253] 0.10887017 0.10902923 0.10918802 0.10934654 0.10950479 0.10966277 [259] 0.10982048 0.10997791 0.11013507 0.11029196 0.11044857 0.11060489 [265] 0.11076094 0.11091671 0.11107219 0.11122739 0.11138231 0.11153694 [271] 0.11169128 0.11184533 0.11199909 0.11215256 0.11230574 0.11245862 [277] 0.11261121 0.11276350 0.11291549 0.11306719 0.11321858 0.11336968 [283] 0.11352047 0.11367096 0.11382114 0.11397102 0.11412059 0.11426986 [289] 0.11441882 0.11456746 0.11471580 0.11486383 0.11501154 0.11515894 [295] 0.11530603 0.11545280 0.11559925 0.11574539 0.11589121 0.11603671 [301] 0.11618189 0.11632675 0.11647129 0.11661550 0.11675940 0.11690296 [307] 0.11704621 0.11718913 0.11733172 0.11747398 0.11761592 0.11775753 [313] 0.11789881 0.11803975 0.11818037 0.11832066 0.11846061 0.11860023 [319] 0.11873952 0.11887847 0.11901709 0.11915537 0.11929332 0.11943093 [325] 0.11956820 0.11970514 0.11984174 0.11997799 0.12011391 0.12024949 [331] 0.12038473 0.12051963 0.12065418 0.12078839 0.12092226 0.12105579 [337] 0.12118898 0.12132182 0.12145431 0.12158647 0.12171827 0.12184973 [343] 0.12198085 0.12211162 0.12224204 0.12237212 0.12250184 0.12263122 [349] 0.12276026 0.12288894 0.12301728 0.12314526 0.12327290 0.12340019 [355] 0.12352713 0.12365372 0.12377996 0.12390585 0.12403138 0.12415657 [361] 0.12428141 0.12440589 0.12453002 0.12465381 0.12477724 0.12490031 [367] 0.12502304 0.12514541 0.12526744 0.12538911 0.12551042 0.12563139 [373] 0.12575200 0.12587226 0.12599216 0.12611172 0.12623092 0.12634976 [379] 0.12646826 0.12658640 0.12670419 0.12682162 0.12693871 0.12705543 [385] 0.12717181 0.12728783 0.12740350 0.12751882 0.12763378 0.12774840 [391] 0.12786265 0.12797656 0.12809011 0.12820331 0.12831616 0.12842866 [397] 0.12854080 0.12865259 0.12876403 0.12887512 0.12898585 > mx [1] 0.1289859 > 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/1wrv11226488497.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/2ee701226488497.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/34n061226488497.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/4eqp21226488497.tab") > > system("convert tmp/1wrv11226488497.ps tmp/1wrv11226488497.png") > system("convert tmp/2ee701226488497.ps tmp/2ee701226488497.png") > system("convert tmp/34n061226488497.ps tmp/34n061226488497.png") > > > proc.time() user system elapsed 0.994 0.502 1.226