trans_specific_risks: Calculate subject specific risks for subjects in newdata

View source: R/msfit_subjects.R

trans_specific_risksR Documentation

Calculate subject specific risks for subjects in newdata

Description

Return a 2 dimensional array, with subjects in the first dimension and transition (numbers) in the second. Can expand later to include time-dependent covariates by introducing extra dimension. Entries of the matrix are exp(lp)_i^m, with i denoting the subject and m the transition.

Usage

trans_specific_risks(object, newdata, trans, n_subjects, subject_ids)

Arguments

object

A coxph object describing the fit of the multi-state model, must contain a 'strata()' term.

newdata

A data.frame containing K rows per subject in the data, with K the number of transitions possible in the model. The following named columns must be present:

id:

Unique identifier of the subject this row relates to, must be numeric or character;

trans:

Transition number in the 'transMat' trans this row relates to;

"variables":

The subject-specific covariates (appearing in the coxph formula), ordered according to transition number in trans.

Note that newdata must contain a column containing the variable which was used to determine the stratum of a transition in object (usually this is 'trans').

trans

Transition matrix describing the states and transitions in the multi-state model. See trans in msprep for more detailed information

Author(s)

Daniel Gomon


hputter/mstate documentation built on July 17, 2025, 2:04 a.m.