Skip to contents

Extracts coefficients from a multi-penalty ridge regression model.

Usage

# S3 method for class 'multiridge'
coef(object, ...)

Arguments

object

object of type "multiridge"

...

(for compatibility with stats::coef)

Value

Returns an \((1 + p)\)-dimensional vector of estimated coefficients (estimated intercept and estimated slopes) if family="gaussian" and family="binomial" and a \(p\)-dimensional vector of estimated slopes if family="cox".

References

Mark A. van de Wiel, Mirrelijn M. van Nee and Armin Rauschenberger (2021). "Fast cross-validation for multi-penalty high-dimensional ridge regression" Journal of Computational and Graphical Statistics 30(4):835-847. doi:10.1080/10618600.2021.1904962 .

See also

Fit models with multiridge() and make predictions with predict().

Examples

warning("Re-activate examples.")
#> Warning: Re-activate examples.
data <- simulate_data()

## standard model fitting
#model <- multiridge(x = data$x_train, y = data$y_train, group = data$group)

## fitting with given folds
#foldid <- sample(seq_len(10L), size = nrow(data$x_train), replace = TRUE)
#model <- multiridge(x = data$x_train, y = data$y_train, group = data$group,
#                    foldid = foldid)

## fitting with given penalties
#penalties <- abs(rnorm(length(unique(data$group))))
#model <- multiridge(x = data$x_train, y = data$y_train, group = data$group,
#                    penalties = penalties)