survival_data: Convert Input Survival Data Into Long-Form Data Needed for...

View source: R/coxph_utility.R

survival_dataR Documentation

Convert Input Survival Data Into Long-Form Data Needed for Fitting a Piecewise Exponential Model

Description

Converts the input survival data with one row or element corresponding to a single observation or subject into a long-form dataset where one observation or subject contributes j rows, where j is the number of time intervals that a subject survived at least part-way through.

Usage

survival_data(y, X, Z, group, offset_fit = NULL, survival_options)

Arguments

y

response, which must be a Surv object (see Surv from the survival package)

X

matrix of fixed effects covariates

Z

matrix of random effects covariates

group

vector specifying the group assignment for each subject

offset_fit

vector specifying the offset. This can be used to specify an a priori known component to be included in the linear predictor during fitting. Default set to NULL (no offset). If the data argument is not NULL, this should be a numeric vector of length equal to the number of cases (the length of the response vector).

survival_options

a structure of class "survivalControl" created from function survivalControl that specifies several parameters needed to properly fit the input survival data using a piecewise constant hazard mixed model. See the documentation for survivalControl for more details on defaults.


hheiling/glmmPen documentation built on Jan. 15, 2024, 11:47 p.m.