View source: R/goodness_of_fit_SurvSurv.R
mean_S_before_T_plot_scr | R Documentation |
The mean_S_before_T_plot_scr()
and prob_dying_without_progression_plot()
functions build plots to assess the goodness-of-fit of the copula model
fitted by fit_model_SurvSurv()
. Specifically, these two functions focus on
the appropriateness of the copula. Note that to assess the appropriateness of
the marginal functions, two other functions are available:
marginal_gof_scr_S_plot()
and marginal_gof_scr_T_plot()
.
mean_S_before_T_plot_scr(fitted_model, plot_method = NULL, grid, treated, ...)
prob_dying_without_progression_plot(
fitted_model,
plot_method = NULL,
grid,
treated,
...
)
fitted_model |
Returned value from |
plot_method |
Defaults to |
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
If a patient progresses before death, this means that S_k < T_k
. For
these patients, we can look at the expected progression time given that the
patient has died at T_k = t
:
E(S_k | T_k = t, S_k < T_k).
The
mean_S_before_T_plot_scr()
function plots the model-based estimate of this
regression function together with a non-parametric estimate.
This regression function can also be estimated non-parametrically by
regressing S_k
onto T_k
in the subset of uncensored patients.
This non-parametric estimate is obtained via mgcv::gam(y~s(x))
with
additionally family = stats::quasi(link = "log", variance = "mu")
because
this tends to describe survival data better. The 95% confidence intervals are
added for this non-parametric estimate; although, they should be interpreted
with caution because the Poisson mean-variance relation may be wrong.
If a patient dies before progressing, this means that S_k = T_k
. This
probability can be modeled as a function of time, i.e.,
\pi_k(t) =
P(S_k = t \, | \, T_k = t).
The prob_dying_without_progression_plot()
function plots the model-based estimate of this regression function together
with a non-parametric estimate.
This regression function can also be estimated non-parametrically by
regressing the censoring indicator for S_k
, \delta_{S_k}
,
onto T_k
in the subset of patients with uncensored T_k
.
# 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.