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(512238,519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258) > x <- c(94.71,93.77,95.73,95.99,95.82,95.47,95.82,94.71,96.33,96.5,96.16,96.33,96.33,95.05,96.84,96.92,97.44,97.78,97.69,96.67,98.29,98.2,98.71,98.54,98.2,96.92,99.06,99.65,99.82,99.99,100.33,99.31,101.1,101.1,100.93,100.85,100.93,99.6,101.88,101.81,102.38,102.74,102.82,101.72,103.47,102.98,102.68,102.9,103.03,101.29,103.69,103.68,104.2,104.08,104.16,103.05,104.66,104.46,104.95,105.85,106.23) > #'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.09427283 0.09417406 0.09407527 0.09397647 0.09387767 0.09377885 [7] 0.09368003 0.09358119 0.09348235 0.09338350 0.09328464 0.09318577 [13] 0.09308689 0.09298800 0.09288910 0.09279019 0.09269128 0.09259235 [19] 0.09249341 0.09239447 0.09229552 0.09219655 0.09209758 0.09199860 [25] 0.09189961 0.09180061 0.09170161 0.09160259 0.09150356 0.09140453 [31] 0.09130548 0.09120643 0.09110737 0.09100830 0.09090922 0.09081013 [37] 0.09071103 0.09061192 0.09051281 0.09041368 0.09031455 0.09021540 [43] 0.09011625 0.09001709 0.08991792 0.08981874 0.08971956 0.08962036 [49] 0.08952116 0.08942194 0.08932272 0.08922349 0.08912425 0.08902500 [55] 0.08892574 0.08882648 0.08872720 0.08862792 0.08852863 0.08842933 [61] 0.08833002 0.08823070 0.08813137 0.08803203 0.08793269 0.08783334 [67] 0.08773398 0.08763461 0.08753523 0.08743584 0.08733644 0.08723704 [73] 0.08713763 0.08703820 0.08693877 0.08683933 0.08673989 0.08664043 [79] 0.08654097 0.08644149 0.08634201 0.08624252 0.08614303 0.08604352 [85] 0.08594400 0.08584448 0.08574495 0.08564541 0.08554586 0.08544630 [91] 0.08534674 0.08524717 0.08514758 0.08504799 0.08494840 0.08484879 [97] 0.08474917 0.08464955 0.08454992 0.08445028 0.08435063 0.08425097 [103] 0.08415131 0.08405164 0.08395196 0.08385227 0.08375257 0.08365286 [109] 0.08355315 0.08345343 0.08335370 0.08325396 0.08315422 0.08305446 [115] 0.08295470 0.08285493 0.08275515 0.08265537 0.08255557 0.08245577 [121] 0.08235596 0.08225614 0.08215631 0.08205648 0.08195664 0.08185679 [127] 0.08175693 0.08165706 0.08155719 0.08145731 0.08135742 0.08125752 [133] 0.08115761 0.08105770 0.08095778 0.08085785 0.08075791 0.08065797 [139] 0.08055802 0.08045806 0.08035809 0.08025811 0.08015813 0.08005814 [145] 0.07995814 0.07985813 0.07975812 0.07965810 0.07955807 0.07945803 [151] 0.07935798 0.07925793 0.07915787 0.07905780 0.07895773 0.07885764 [157] 0.07875755 0.07865745 0.07855735 0.07845723 0.07835711 0.07825699 [163] 0.07815685 0.07805671 0.07795655 0.07785640 0.07775623 0.07765606 [169] 0.07755587 0.07745569 0.07735549 0.07725529 0.07715508 0.07705486 [175] 0.07695463 0.07685440 0.07675416 0.07665391 0.07655366 0.07645340 [181] 0.07635313 0.07625285 0.07615257 0.07605227 0.07595198 0.07585167 [187] 0.07575136 0.07565104 0.07555071 0.07545037 0.07535003 0.07524968 [193] 0.07514933 0.07504896 0.07494859 0.07484821 0.07474783 0.07464744 [199] 0.07454704 0.07444663 0.07434622 0.07424580 0.07414537 0.07404494 [205] 0.07394450 0.07384405 0.07374359 0.07364313 0.07354266 0.07344218 [211] 0.07334170 0.07324121 0.07314071 0.07304021 0.07293970 0.07283918 [217] 0.07273865 0.07263812 0.07253758 0.07243704 0.07233649 0.07223593 [223] 0.07213536 0.07203479 0.07193421 0.07183362 0.07173303 0.07163243 [229] 0.07153182 0.07143121 0.07133059 0.07122996 0.07112933 0.07102869 [235] 0.07092804 0.07082739 0.07072673 0.07062606 0.07052539 0.07042471 [241] 0.07032402 0.07022333 0.07012263 0.07002192 0.06992121 0.06982049 [247] 0.06971976 0.06961903 0.06951829 0.06941754 0.06931679 0.06921603 [253] 0.06911527 0.06901450 0.06891372 0.06881293 0.06871214 0.06861134 [259] 0.06851054 0.06840973 0.06830891 0.06820809 0.06810726 0.06800643 [265] 0.06790559 0.06780474 0.06770388 0.06760302 0.06750215 0.06740128 [271] 0.06730040 0.06719952 0.06709862 0.06699773 0.06689682 0.06679591 [277] 0.06669499 0.06659407 0.06649314 0.06639221 0.06629127 0.06619032 [283] 0.06608936 0.06598840 0.06588744 0.06578647 0.06568549 0.06558451 [289] 0.06548352 0.06538252 0.06528152 0.06518051 0.06507949 0.06497847 [295] 0.06487745 0.06477642 0.06467538 0.06457433 0.06447328 0.06437223 [301] 0.06427117 0.06417010 0.06406903 0.06396795 0.06386686 0.06376577 [307] 0.06366467 0.06356357 0.06346246 0.06336135 0.06326023 0.06315910 [313] 0.06305797 0.06295684 0.06285569 0.06275454 0.06265339 0.06255223 [319] 0.06245106 0.06234989 0.06224872 0.06214753 0.06204634 0.06194515 [325] 0.06184395 0.06174275 0.06164154 0.06154032 0.06143910 0.06133787 [331] 0.06123664 0.06113540 0.06103415 0.06093290 0.06083165 0.06073039 [337] 0.06062912 0.06052785 0.06042657 0.06032529 0.06022400 0.06012271 [343] 0.06002141 0.05992011 0.05981880 0.05971749 0.05961617 0.05951484 [349] 0.05941351 0.05931217 0.05921083 0.05910949 0.05900813 0.05890678 [355] 0.05880541 0.05870405 0.05860267 0.05850130 0.05839991 0.05829852 [361] 0.05819713 0.05809573 0.05799433 0.05789292 0.05779151 0.05769009 [367] 0.05758866 0.05748723 0.05738580 0.05728436 0.05718291 0.05708146 [373] 0.05698001 0.05687855 0.05677708 0.05667561 0.05657414 0.05647266 [379] 0.05637117 0.05626968 0.05616819 0.05606669 0.05596519 0.05586368 [385] 0.05576216 0.05566064 0.05555912 0.05545759 0.05535606 0.05525452 [391] 0.05515297 0.05505143 0.05494987 0.05484832 0.05474675 0.05464519 [397] 0.05454361 0.05444204 0.05434046 0.05423887 0.05413728 > mx [1] 0.09427283 > 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/1vji81226402438.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/2ln4p1226402438.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/3pv3e1226402438.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/47ujz1226402438.tab") > > system("convert tmp/1vji81226402438.ps tmp/1vji81226402438.png") > system("convert tmp/2ln4p1226402438.ps tmp/2ln4p1226402438.png") > system("convert tmp/3pv3e1226402438.ps tmp/3pv3e1226402438.png") > > > proc.time() user system elapsed 1.025 0.506 1.452