I'm working on a data set modeling road kills (0 = random point, 1 = road kill) as a function of a number of habitat variables. Following Hosmer and Lemeshow, I've examined each continuous predictor variable for linearity, and a couple appear nonlinear. I'd like to try a fractional polynomial transformation for each, also following Hosmer and Lemeshow, and have looked at the R package mfp, but I'm having trouble coming up with (and understanding) the R code that will correctly transform the variable. Can anyone suggest R code that would help me accomplish the concepts on p. 101 - 102 of Hosmer and Lemeshow's Applied Logistic Regression (2000).


1 Answer 1


Here is some R code with an example taken from an example data set included in package MASS:


vignette("mfp_vignette",package="mfp")   # Read this!

mfp_mod <- mfp(factor(low) ~ fp(age,df=4)+fp(lwt,df=4)+factor(race)+factor(smoke)+ptl+factor(ht)+factor(ui)+ftv, family=binomial,data=birthwt)


(I did not include output). An alternative would be to use splines.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.