View source: R/goodness_of_fit_SurvSurv.R
marginal_gof_scr_S_plot | R Documentation |
The marginal_gof_scr_S_plot()
and marginal_gof_scr_T_plot()
functions
plot the estimated marginal survival functions for the surrogate and true
endpoints. In these plots, it is assumed that the copula model has been
fitted for (T_0, \tilde{S}_0, \tilde{S}_1, T_1)'
where
S_k =
\min(\tilde{S_k}, T_k)
is the (composite) surrogate of interest. In these
plots, the model-based survival functions for (T_0, S_0, S_1, T_1)'
are
plotted together with the corresponding Kaplan-Meier etimates.
marginal_gof_scr_S_plot(fitted_model, grid, treated, ...)
marginal_gof_scr_T_plot(fitted_model, grid, treated, ...)
fitted_model |
Returned value from |
grid |
Grid of time-points at which the model-based estimated regression functions, survival functions, or probabilities are evaluated. |
treated |
(numeric) Treatment group. Should be |
... |
Additional arguments to pass to |
NULL
The marginal goodness-of-fit plots for the true endpoint, build by
marginal_gof_scr_T_plot()
, is simply a comparison of the model-based
estimate of P(T_k > t)
with the Kaplan-Meier (KM) estimate obtained
with survival::survfit()
. A pointwise 95% confidence interval for the KM
estimate is also plotted.
The model-based estimate of P(S_k > s)
follows indirectly from the
fitted copula model because the copula model has been fitted for
\tilde{S}_k
instead of S_k
. However, the model-based estimate
still follows easily from the copula model as follows,
P(S_k > s) = P(\min(\tilde{S}_k, T_k)) = P(\tilde{S}_k > s, T_k > s).
The marginal_gof_scr_T_plot()
function plots the model-based estimate for
P(\tilde{S}_k > s, T_k > s)
together with the KM estimate (see above).
# Load Ovarian data
data("Ovarian")
# Recode the Ovarian data in the semi-competing risks format.
data_scr = data.frame(
ttp = Ovarian$Pfs,
os = Ovarian$Surv,
treat = Ovarian$Treat,
ttp_ind = ifelse(
Ovarian$Pfs == Ovarian$Surv &
Ovarian$SurvInd == 1,
0,
Ovarian$PfsInd
),
os_ind = Ovarian$SurvInd
)
# Fit copula model.
fitted_model = fit_model_SurvSurv(data = data_scr,
copula_family = "clayton",
n_knots = 1)
# Define grid for GoF plots.
grid = seq(from = 1e-3,
to = 2.5,
length.out = 30)
# Assess marginal goodness-of-fit in the control group.
marginal_gof_scr_S_plot(fitted_model, grid = grid, treated = 0)
marginal_gof_scr_T_plot(fitted_model, grid = grid, treated = 0)
# Assess goodness-of-fit of the association structure, i.e., the copula.
prob_dying_without_progression_plot(fitted_model, grid = grid, treated = 0)
mean_S_before_T_plot_scr(fitted_model, grid = grid, treated = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.