Utility function which allows to prepare one row of data.frame to be fed into mstate::msfit for prediction.

make_mstate_refpat(refpat, tmat, covs)

Arguments

refpat

A single-row data.frane containing the covariate values to predict

tmat

Transition matrix

covs

Covariates used in the cause-specific Cox models

Examples

tmat <- mstate::trans.comprisk(2, c("REL", "NRM"))
covs <- c("age_allo1_decades", "mdsclass")

ref_pat <- dat_mds_synth[1, ]
ref_pat[]
#>   ci_s_allo1  ci_allo1                 match_allo1_1 mdsclass donorrel
#> 1          2 0.2617318 recipient female - donor male     sAML    Other
#>   karnofsk_allo1 crnocr cmv_combi_allo1_1 cytog_threecat hctci_risk
#> 1           <NA>     CR              <NA>      good(<=3)       <NA>
#>   agedonor_allo1_decades age_allo1_decades
#> 1                     NA             5.647
make_mstate_refpat(ref_pat, tmat, covs)
#> An object of class 'msdata'
#> 
#> Data:
#>   ci_s_allo1  ci_allo1                 match_allo1_1 mdsclass donorrel
#> 1          2 0.2617318 recipient female - donor male     sAML    Other
#> 2          2 0.2617318 recipient female - donor male     sAML    Other
#>   karnofsk_allo1 crnocr cmv_combi_allo1_1 cytog_threecat hctci_risk
#> 1           <NA>     CR              <NA>      good(<=3)       <NA>
#> 2           <NA>     CR              <NA>      good(<=3)       <NA>
#>   agedonor_allo1_decades age_allo1_decades trans age_allo1_decades.1
#> 1                     NA             5.647     1               5.647
#> 2                     NA             5.647     2               0.000
#>   age_allo1_decades.2 mdsclass1.1 mdsclass1.2 mdsclass2.1 mdsclass2.2 strata
#> 1               0.000           0           0           1           0      1
#> 2               5.647           0           0           0           1      2