Conditional distribution of Y|T for a mixed continuous/ordinal (Gaussian-copula) joint model, if no competing risk – biomarker-value prediction
Source:R/conditionalYTBioCopula.R
conditionalYTBioCopula.RdCopula-aware counterpart to conditionalYTBio(), used
by dynamicPredictionBio() whenever long_fit_all$biomarker_type
contains at least one "ordinal" biomarker (see
longitudinalSubCopula()). Both a continuous and an
ordinal bio_i target are supported: for an ordinal
bio_i, Y_all is expected to already be the vector of
candidate category labels (the fitted factor's levels(), in
threshold order) rather than a numeric grid – see
compute_bio_marker_step(), which builds that vector and translates
the result back into integer category codes for its caller. No branching
is actually needed here: build_conditional_design_copula() already
looks up each row of biomarker bio_i (historical and the
candidate row assigned below) generically via
long_fit_all$biomarker_type[bio_i], bracketing an ordinal row's
latent score between its category's cumulative-link thresholds instead of
matching it to an exact value – exactly the same mechanism already used
for every other ordinal biomarker's observed history in the joint
density. Assigning a candidate label into data_it_Y's ordinal
factor column (below) therefore evaluates the same
mixed_density_prob_copula() box probability as any other ordinal
row would, with no separate code path required.
Unlike conditionalYTBio() – which can evaluate
mvtnorm::dmvnorm() once per l_i across every Y_all
candidate in one vectorized call, because the multivariate-normal density
does not need re-normalizing per candidate – here each candidate value in
Y_all changes the conditional block's mean/covariance (see
mixed_density_prob_copula()) and therefore requires its own
mvtnorm::pmvnorm() evaluation. This makes the copula path in this
function O(patients * length(l_i) * length(Y_all)) Monte-Carlo box
probability evaluations, rather than one dmvnorm() call per
patient/l_i – keep bandcount3 modest for mixed fits with a
continuous bio_i (an ordinal bio_i's Y_all length is
fixed at its category count, not controlled by bandcount3 at all).
Usage
conditionalYTBioCopula(
Y_all,
time_new,
bio_i,
data_predict_all,
long_fit_all,
l_i,
survival_variable,
time_variable,
survival_variable_all,
survival_trans_function
)Arguments
- time_new
Prediction time add horizon
- bio_i
Biomarker used to do prediction
- data_predict_all
This involves a collection of
data.frameobjects for dynamic prediction, each corresponding to a distinct longitudinal outcome. These data frames should contain the variables specified inlong_sub_fixedandlong_sub_random. Utilizing a list structure allows for the incorporation of multiple longitudinal outcomes, each potentially following different measurement protocols. In instances where all longitudinal outcomes are recorded at identical time points across patients, a singulardata.frameobject may be used in alist. It is presumed that each data frame is structured in a long format.- long_fit_all
Outputs from the model fitting process using the
nlmepackage, encompassing the results and parameters obtained from the analysis.- l_i
A vector of time points to calculate the conditional probability.
- survival_variable
Time-to-event outcomes variable name.
- time_variable
The name of time variable in linear mixed model.
- survival_variable_all
The name of the transformed time-to-event outcomes variable.
- survival_trans_function
The transformation function used for time-to-event outcomes, in the order of
survival_variable_all.