# # Epage > 137 # # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- if(is.null(version$language) == FALSE){ require(alr3) }else{ library(alr3) } # highway data if(is.null(version$language) == FALSE) data(highway) highway$logRate <- logb(highway$Rate,2) highway$LenAtL1 <- highway$Len - 1. highway$ADTAtL1 <- highway$ADT - 1. m0 = lm( logRate ~ LenAtL1 + ADTAtL1, data=highway ) cs = coefficients(m0) names(cs)=NULL b00 = cs[1] b10 = cs[2] b20 = cs[3] m1 = nls( logRate ~ b0 + b1 * ( Len^lam1 - 1. )/(lam1 + 1.e-6) + b2 * ( ADT^lam2 - 1. )/(lam2 + 1.e-6), data=highway, start=list(b0=b00,b1=b10,b2=b20,lam1=1,lam2=1) ) # compare this method to that from using bctrans: # ans <- bctrans( logRate ~ Len + ADT, data=highway ) #plot(ans) s <- summary(ans) optLambda <- s$optim$par #scoreT <- powtran( Score, optLambda[1] ) #pcntWomenT <- powtran( pcntWomen, optLambda[2] )