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.
trans_specific_risks(object, newdata, trans)
A coxph
object fit on multi-state
data. Must contain a strata(X)
term. Data used for the coxph() fit preferably prepared
using msprep
.
A data.frame
containing a single row for each transition per
subject in the data. For a model with m possible transitions, and n subjects
newdata
must have m*n rows. It must contain the following named columns:
id
:Unique identifier of the subject, can be numeric or character;
from
:State from which the transition takes place;
to
:State to which the transition takes place;
trans
:Transition number in the 'transMat'
trans
this transition relates to;
"variables"
:The variables and their values for the subject
identified by "id" for the transition this entry relates to. Names must
match the names of the variables in coxph object
.
Note that newdata must contain a column containing the variable which was
used to determine the stratum of a transition in object
.
Usually the stratum is determined from one of the required columns. The
"variables" columns can usually be obtained using expand.covs
.
A transition matrix as created by transMat
.