Learn R Programming

mfp2 (version 1.1.1)

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.

Arguments

object

A fitted mfp2() object.

See Also

mfp2(), print.mfp2()

Examples

Run this code
# Gaussian model
data("prostate")
x <- as.matrix(prostate[, 2:8])
y <- as.numeric(prostate$lpsa)
fit <- mfp2(x, y, verbose = FALSE)
get_selected_variable_names(fit)

Run the code above in your browser using DataLab