get_selected_variable_names: Extract Names of Selected Variables from an mfp2 Model
Description
Returns the names of predictors retained in the final model after MFP
selection, as recorded in the selected column of object$fp_terms.
Usually a selected variable has at least one fractional-polynomial power
that is not NA. The exception is a spike-at-zero term for which only
the binary indicator for x = 0 is retained: it is selected although
all of its powers are NA. Factors are reported by their variable name,
not by their contrast columns.
Usage
get_selected_variable_names(object)
Value
Character vector of selected predictor names, ordered according to the
xorder used in the mfp2() call.
# Gaussian modeldata("prostate")
x <- as.matrix(prostate[, 2:8])
y <- as.numeric(prostate$lpsa)
fit <- mfp2(x, y, verbose = FALSE)
get_selected_variable_names(fit)