R/coef.xplus.R

Defines functions coef.xplus

Documented in coef.xplus

#' Extract coefficients from an xplus model
#'
#' @param object An `xplus` object.
#' @param s Penalty value name or numeric lambda.
#' @param ... Additional arguments.
#'
#' @return A sparse coefficient matrix.
#' @seealso [summary.xplus()], [print.xplus()]
#' @examples
#' set.seed(1)
#' x <- matrix(rnorm(100 * 5), ncol = 5)
#' y <- c(rep(1, 20), rep(0, 80))
#' fit <- xplus(x, y, max_iter = 5)
#' coef(fit)
#' @method coef xplus
#' @export
coef.xplus <- function(object, s = "lambda.min", ...) {
  glmnet::coef.glmnet(object$xplus, s = s, ...)
}

Try the xplus package in your browser

Any scripts or data that you put into this service are public.

xplus documentation built on Sept. 26, 2026, 5:07 p.m.