Learn R Programming

icmstate (version 0.2.0)

expand_covariates_long_data: Expand covariates for a data frame so that covariates can be transition specific.

Description

Expand covariates for a data frame so that covariates can be transition specific.

Usage

expand_covariates_long_data(newdata)

Arguments

newdata

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.