Skip to content
All library documents

How Multivariable Fractional Polynomials Select Logistic Regression Predictors

Article Quant Q&A · Author: user3022875

Summary

The document examines how the R implementation of multivariable fractional polynomials (MFP) handles continuous predictors in a logistic regression model of fracture outcomes. The author compares the procedure’s cycle-by-cycle output with a textbook description, focusing on why BMI appears in a later cycle despite failing a significance threshold earlier, and how BMI and weight ultimately receive zero degrees of freedom and leave the fitted model.

The evidence consists of printed model output and likelihood-ratio calculations for candidate fractional-polynomial transformations. It raises questions about the algorithm’s variable selection and backfitting, but provides no accepted explanation or resolution. The output alone cannot establish whether the discrepancy reflects implementation details, interpretation of the procedure, or a mismatch in model setup. Readers should treat it as a troubleshooting question rather than a general result about MFP or predictor selection.

Key ideas

  • MFP evaluates candidate transformations for continuous predictors within logistic regression.
  • The example compares R output with a textbook account of the procedure’s cycles.
  • The author questions why BMI reappears in a cycle after failing an earlier selection test.
  • The final output assigns zero degrees of freedom to BMI and weight, indicating exclusion from the fitted model.
  • The document poses implementation questions but does not provide their answers.

Tags

Full text
# logistic regression multivariable fractional ploynomials stata vs. R


# logistic regression multivariable fractional ploynomials stata vs. R












I a going through Hosmer, Lemenshow and Sturdivant's (HLS) Applied Logistic Regression (2013) and trying to interpret the difference between what STATA is doing and what R is doing. Concerning the fit of the model using multivariable fractional ploynomials (MFP), HLS looks at the glow500 study where the dependent variable is fracture and there are both dichotomous and continuous independent variable. You do not need the book to consider these questions:

Here is the data and the R call to the MFP function

```
library(mfp)
library(data.table)
mydat <- fread('http://www.umass.edu/statdata/statdata/data/glow/glow_bonemed.dat')
colnames(mydat) = c("SUB_ID","SITE_ID","PHY_ID","PRIORFRAC","AGE","WEIGHT","HEIGHT","BMI","PREMENO","MOMFRAC","ARMASSIST","SMOKE",
                    "RATERISK","FRACSCORE", "FRACTURE","V16","V17")
head(mydat)
m = mfp(FRACTURE ~ PRIORFRAC + as.factor(RATERISK) + MOMFRAC  + ARMASSIST + SMOKE + PREMENO + 
          fp(AGE, df=4, select = .15, alpha = .05) + 
          fp(BMI, df=4, select = .15, alpha = .05) + 
          fp(WEIGHT, df=4, select = .15, alpha = .05) + 
          fp(HEIGHT, df=4, select = .15, alpha = .05) ,
        family = binomial, data= mydat, verbose = TRUE)
summary(m)
```

In HLS's book on page 142 there is table that is Cycle 2 of the MFP procedure. Cycle 2 they says contains the "partial liklihood ratio tests that are based, not on the full 11 covariate model, but on a 5 covariate model (from Cycle 1)." NOTE: HERE HE SAYS THERE ARE 5 VARIABLES that are significant from cycle 1.

Here is the MFP function call in R using the same data he used in STATA.

I have a couple questions.

QUESTION 1

On page 141 in the book BMI is not significant so it is not included in cycle 2. You can see the same non-significance in the R output. If you look at Cycle 1 you see

```
           BMI               
        506.098      
        503.837     1
        501.743     0.5
        501.574     -2 1
```

So the liklihood ratio test is

```
1-pchisq(506.098 - 501.574,4) = p-value of .34 > .15 so DO NOT INCLUDE in cycle 2
```

This is the Deviance of the NULL Model excluding BMI compared to the deviance of the best 2-term polynomial fit powers (-2,1) the p-value = .34 which is > .15 so BMI SHOULD NOT BE INCLUDED in CYCLE 2. But it is. You can look under Cycle 2 of the output and you see:

```
                 BMI                 
                506.674      
                505.865     1
                504.843     -2
                504.224     -2 -2
```

So now in R - in Cycle 2 you see 6 (NOT 5 like he says in the book) variables in the model in cycle 2. BMI again is not significant

```
1-pchisq(506.674 - 504.224,4) =  p-value = .65 so again not significant in cycle 2 comparing the NULL model in cycle 2 vs. the best 2 term polynomial (-2,2)
```

So my first question is why is BMI included in Cycle 2 in R? Looking at BMI in cycle 1 it is NOT significant.

QUESTION 2 Under the Fractional Polynomials part of the output I see:

```
Fractional polynomials
                     df.initial select alpha df.final power1 power2
PRIORFRAC                     1   1.00  0.05        1      1      .
AGE                           4   0.15  0.05        1      1      .
as.factor(RATERISK)2          1   1.00  0.05        1      1      .
as.factor(RATERISK)3          1   1.00  0.05        1      1      .
MOMFRAC                       1   1.00  0.05        1      1      .
BMI                           4   0.15  0.05        0      .      .
WEIGHT                        4   0.15  0.05        0      .      .
ARMASSIST                     1   1.00  0.05        1      1      .
HEIGHT                        4   0.15  0.05        1      1      .
SMOKE                         1   1.00  0.05        1      1      .
PREMENO                       1   1.00  0.05        1      1      .
```

In the documentation (https://cran.r-project.org/web/packages/mfp/vignettes/mfp_vignette.pdf) df.final is defined as

```
"a vector containing the degrees of freedom of each covariate at convergence of the backfitting  algorithm (m=4 for second degree FP, m=2 for first degree FP, m=1 for untransformed variable, m=0 if covariate was excluded)."
```

can you explain how the df changes for weight and BMI so that they are excluded from the final model?

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.