Skip to contents

Return the model coefficients of a strat_cox object

Usage

# S3 method for class 'strat_cox'
coef(fit, lambda, which = 1:length(fit$lambda), drop = TRUE, ...)

Arguments

fit

a strat_cox object.

lambda

values of the regularization parameter lambda at which coefficients are requested. For values of lambda not in the sequence of fitted models, linear interpolation is used.

which

indices of the penalty parameter lambda at which predictions are required. By default, all indices are returned. If lambda is specified, this will override which.

drop

whether to keep coefficient names

...

Examples

data(ContTime)
data <- ContTime$data
Event.char <- ContTime$Event.char
prov.char <- ContTime$prov.char
Z.char <- ContTime$Z.char
Time.char <- ContTime$Time.char
fit <- Strat.cox(data, Event.char, Z.char, Time.char, prov.char, group = c(1, 2, 2, 3, 3))
coef(fit, lambda = fit$lambda)[, 1:5]
#>    0.0394      0.0368     0.0343       0.032      0.0298
#> Z1      0 -0.01983922 -0.0390155 -0.05686517 -0.07358008
#> Z2      0  0.00000000  0.0000000  0.00000000  0.00000000
#> Z3      0  0.00000000  0.0000000  0.00000000  0.00000000
#> Z4      0  0.00000000  0.0000000  0.00000000  0.00000000
#> Z5      0  0.00000000  0.0000000  0.00000000  0.00000000