3
$\begingroup$

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).

$\endgroup$
2
$\begingroup$

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

library(MASS)
library(mfp)
data(birthwt)

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)

summary(mfp_mod)

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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