coef.coxkl_enet: Extract Coefficients from a 'coxkl_enet' Object

View source: R/coef.R

coef.coxkl_enetR Documentation

Extract Coefficients from a coxkl_enet Object

Description

Extracts the estimated regression coefficients (beta) from a fitted coxkl_enet object. Optionally, one or more lambda values can be supplied. If requested lambda values are not in the fitted sequence, linear interpolation is performed between nearest neighbors; out-of-range requests error.

Usage

## S3 method for class 'coxkl_enet'
coef(object, lambda = NULL, ...)

Arguments

object

An object of class "coxkl_enet", typically the result of coxkl_enet.

lambda

Optional numeric value or vector specifying the regularization parameter(s) for which to extract (or interpolate) coefficients. If NULL, all estimated coefficients are returned.

...

Additional arguments (currently ignored).

Value

A numeric matrix of regression coefficients; each column corresponds to one value of lambda, sorted in descending order.

Examples

data(ExampleData_highdim)

train_dat_highdim <- ExampleData_highdim$train
beta_external_highdim <- ExampleData_highdim$beta_external


enet_model <- coxkl_enet(z = train_dat_highdim$z,
                         delta = train_dat_highdim$status,
                         time = train_dat_highdim$time,
                         beta = beta_external_highdim,
                         eta = 1,
                         alpha = 1.0)
coef(enet_model)[1:5, 1:10]
   

survkl documentation built on April 22, 2026, 1:08 a.m.