Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fid

Helper function for Cox deviance and gradient


Description

Helps to find ties in death times of data.

Usage

fid(x, index)

Arguments

x

Sorted vector of death times.

index

Vector of indices for the death times.

Value

A list with two arguments.

index_first

A vector of indices for the first observation at each death time as they appear in the sorted list.

index_ties

If there are no ties at all, this is NULL. If not, this is a list with length equal to the number of unique times with ties. For each time with ties, index_ties gives the indices of the observations with a death at that time.

Examples

# Example with no ties
glmnet:::fid(c(1, 4, 5, 6), 1:5)

# Example with ties
glmnet:::fid(c(1, 1, 1, 2, 3, 3, 4, 4, 4), 1:9)

glmnet

Lasso and Elastic-Net Regularized Generalized Linear Models

v4.1-1
GPL-2
Authors
Jerome Friedman [aut], Trevor Hastie [aut, cre], Rob Tibshirani [aut], Balasubramanian Narasimhan [aut], Kenneth Tay [aut], Noah Simon [aut], Junyang Qian [ctb]
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.