build an Markov probability model from multi-age prediction models
Source:R/mortality_markov_model.R
dot-mortality_markov_model_for_stitch_model.Rdbuild an Markov probability model from multi-age prediction models
Usage
.mortality_markov_model_for_stitch_model(
markov,
model,
step,
qbins,
required_conditions,
min_obs_for_estimate = 10
)Arguments
- markov
the markov model computed for the next age (older). the states in this age will be mapped to the states in this markov layer
- model
prediction model (output of build_cross_validation_time_stitch_classification_models)
- step
time between prediction models
- qbins
quantile bin size of prediction score for which the markov model will define a state
- required_conditions
any filter to apply to the patients to filter out from model computation, for example limiting the time window
- min_obs_for_estimate
minimum of observations required to compute probability per sex/sbin. If minimum is not available, probability will be compuated using all data.
Value
a markov model, a list with the following members:
model - matrix containing the probability for each quantile(score) bin to reach each of the target_classes provided in the oldest model.
local.model - data.frame containing the probability for each quantile(score) bin to reach each of the quantile(score) bins of the next model by age.
qbins - bins
target - data frame containing the target bin for this age model (to be used as outcome for the younger age model)