Description Usage Arguments Details Value References See Also Examples
Fractional polynomials transformation for continuous covariates.
1 |
x |
a numeric vector. |
p |
all powers of |
scaling |
a logical indicating if the measurements are scaled prior to model fitting. |
A fractional polynomial refers to a model ∑_{j = 1}^k (β_j x^{p_j} + γ_j x^{p_j} \log(x)) + β_{k + 1} \log(x) + γ_{k + 1} \log(x)^2, where the degree of the fractional polynomial is the number of non-zero regression coefficients β and γ.
A matrix including all powers p
of x
,
all powers p
of log(x)
, and log(x)
.
Willi Sauerbrei and Patrick Royston (1999), Building multivariable prognostic and diagnostic models: transformation of the predictors by using fractional polynomials. Journal of the Royal Statistical Society A, 162, 71–94.
gamboost
to fit smooth models, bbs
for P-spline base-learners
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | data("bodyfat", package = "TH.data")
tbodyfat <- bodyfat
### map covariates into [1, 2]
indep <- names(tbodyfat)[-2]
tbodyfat[indep] <- lapply(bodyfat[indep], function(x) {
x <- x - min(x)
x / max(x) + 1
})
### generate formula
fpfm <- as.formula(paste("DEXfat ~ ",
paste("FP(", indep, ", scaling = FALSE)", collapse = "+")))
fpfm
### fit linear model
bf_fp <- glmboost(fpfm, data = tbodyfat,
control = boost_control(mstop = 3000))
### when to stop
mstop(aic <- AIC(bf_fp))
plot(aic)
### coefficients
cf <- coef(bf_fp[mstop(aic)])
length(cf)
cf[abs(cf) > 0]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.