| Title: | Weighted NPMLE for Competing Risks and Recurrent Events with a Competing Terminal Event |
| Version: | 0.2.0 |
| Description: | Provides regression modeling and prediction for the subdistribution of a competing risk and for the marginal rate of recurrent events with a competing terminal event, using the weighted nonparametric maximum likelihood estimator (wNPMLE) of Bellach, Kosorok, Rüschendorf and Fine (2019) <doi:10.1080/01621459.2017.1401540> and Bellach and Kosorok (2026) <doi:10.48550/arXiv.2605.25934>. Two classes of transformation models are implemented: Box-Cox transformation models and logarithmic transformation models. These include the Fine-Gray model and the proportional means model of Ghosh and Lin (2002) <doi:10.17615/pt0g-y207>, and extend the transformation model framework of Zeng and Lin (2006) <doi:10.1093/biomet/93.3.627>. Parameter estimation is performed using automatic differentiation through the Template Model Builder (TMB) framework. Standard errors are computed using sandwich variance estimators that account for estimation of the inverse-probability censoring weights. Model selection over the transformation parameter is supported by the profile log-likelihood and Takeuchi's information criterion (TIC). |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 4.1.0) |
| Imports: | TMB (≥ 1.9.0), survival, methods, MASS, graphics, grDevices, utils |
| LinkingTo: | TMB, RcppEigen |
| Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| URL: | https://github.com/abellach/wnpmle |
| BugReports: | https://github.com/abellach/wnpmle/issues |
| Author: | Anna Bellach [aut, cre] |
| Maintainer: | Anna Bellach <abellach.biostat@gmail.com> |
| NeedsCompilation: | yes |
| Packaged: | 2026-12-01 08:22:35 UTC; abell |
| Repository: | CRAN |
| Date/Publication: | 2026-12-01 08:40:02 UTC |
wnpmle: Weighted NPMLE for the Subdistribution of a Competing Risk and the Marginal Rate of Recurrent Events with a Competing Terminal Event
Description
Implements the weighted nonparametric maximum likelihood estimator (wNPMLE)
for the subdistribution of a competing risk (type = "cmprsk") and for
the marginal rate of recurrent events in the presence of a competing
terminal event (type = "recurrent"). Two semiparametric transformation models are
provided: the Box-Cox transformation model and the logarithmic
transformation model. Both use automatic differentiation via TMB for
efficient and exact gradient computation.
Details
The main user-facing function is wnpmle_fit.
Author(s)
Maintainer: Anna Bellach abellach.biostat@gmail.com
References
Bellach, A. and Kosorok, M.R. (2026). Pseudo-likelihood regression for the marginal rate of recurrent events with a competing terminal event. arXiv preprint arXiv:2605.25934. doi:10.48550/arXiv.2605.25934
Bellach, A., Kosorok, M.R., Rüschendorf, L. and Fine, J.P. (2019). Weighted NPMLE for the subdistribution of a competing risk. Journal of the American Statistical Association, 114(525), 259-270. doi:10.1080/01621459.2017.1401540
See Also
Useful links:
AIC for wnpmle objects
Description
AIC for wnpmle objects
Usage
## S3 method for class 'wnpmle'
AIC(object, ..., k = 2)
Arguments
object |
A |
... |
Ignored. |
k |
Penalty per parameter (default 2 for AIC). |
Value
A numeric scalar giving the AIC value.
BIC for wnpmle objects
Description
BIC for wnpmle objects
Usage
## S3 method for class 'wnpmle'
BIC(object, ...)
Arguments
object |
A |
... |
Ignored. |
Value
A numeric scalar giving the BIC value.
Takeuchi information criterion for the weighted NPMLE
Description
Computes Takeuchi's information criterion (TIC) for a fitted wnpmle
model. The weighted NPMLE maximizes an inverse probability of censoring
weighted log-likelihood, for which the information equality need not hold.
TIC therefore replaces the AIC penalty 2p by
2\,\mathrm{tr}(\mathcal{I}_n^{-1}\widehat\Sigma_n), where
\mathcal{I}_n is the observed information and \widehat\Sigma_n
the censoring-corrected meat of the sandwich estimator:
\mathrm{TIC} = -2\,\ell(\hat\theta) + 2\,\mathrm{tr}(\mathcal{I}_n^{-1}\widehat\Sigma_n).
Usage
TIC(object, ...)
## S3 method for class 'wnpmle'
TIC(object, fisher = NULL, details = FALSE, ...)
Arguments
object |
A |
... |
Ignored. |
fisher |
Optional |
details |
Logical; if |
Details
The trace is computed from the full covariance matrices of
(\beta, \Lambda):
\mathrm{tr}(\mathcal{I}_n^{-1}\widehat\Sigma_n) = \mathrm{tr}(V_S V_F^{-1}),
with V_S = \mathcal{I}_n^{-1}\widehat\Sigma_n\mathcal{I}_n^{-1} the
sandwich and V_F = \mathcal{I}_n^{-1} the inverse Fisher information.
The trace is invariant to the parametrization of the baseline (jumps or
cumulative values).
For a correctly specified model with a genuine likelihood the penalty
equals p asymptotically, and TIC reduces to AIC. Since all Box-Cox
and logarithmic transformation models have the same number of parameters,
AIC compares log-likelihoods only, whereas TIC can give different
transformations different penalties. The trace is estimated, so TIC is
noisier than AIC in small samples.
The penalty should not exceed p by much; a penalty clearly larger
than p points to a problem with the variance estimate.
Value
A numeric scalar giving the TIC value. With details = TRUE,
a named vector with TIC, penalty (the trace
\mathrm{tr}(\mathcal{I}_n^{-1}\widehat\Sigma_n)), p (the
number of parameters, including the baseline jumps), AIC
(-2\ell + 2p with this p) and loglik.
References
Takeuchi, K. (1976). Distribution of informational statistics and a criterion of model fitting. Suri-Kagaku (Mathematical Sciences), 153, 12-18 (in Japanese).
Konishi, S. and Kitagawa, G. (1996). Generalised information criteria in model selection. Biometrika, 83, 875-890.
See Also
Examples
dat <- bladder_prep()
fit <- wnpmle_fit(Surv(time, status) ~ treat + num + size, data = dat,
id = "id", model = "boxcox", rho = 1)
TIC(fit)
TIC(fit, details = TRUE)
Extract the estimated baseline mean function
Description
Returns a data frame with the estimated cumulative baseline mean function Lambda(t) and its increments lambda(t), together with standard errors and pointwise 95% confidence intervals.
Usage
baseline(object, conf_level = 0.95, ...)
Arguments
object |
A |
conf_level |
Confidence level for the pointwise intervals (default 0.95). |
... |
Ignored. |
Value
A data frame with columns:
time |
Recurrent event times. |
lambda |
Estimated baseline increments. |
Lambda |
Estimated cumulative baseline mean. |
se_Lambda |
Standard error of Lambda (if SE was estimated). |
lower |
Lower pointwise confidence band for Lambda. |
upper |
Upper pointwise confidence band for Lambda. |
Examples
bdata <- bladder_prep()
bdata_clean <- bdata[, c("id", "time", "status", "treat", "num", "size")]
fit <- wnpmle_fit(Surv(time, status) ~ treat + num + size,
data = bdata_clean, id = "id", model = "log", r = 1)
bl <- baseline(fit)
head(bl)
Prepare bladder cancer data for wnpmle analysis
Description
Prepares the bladder1 dataset from the survival package for
use with wnpmle_fit. Subjects randomised to pyridoxine are
excluded (only placebo and thiotepa arms are retained). Status codes are
recoded to 0 (censored), 1 (recurrent tumour), 2 (terminal/dropout), and
event times beyond tau are truncated to tau.
Usage
bladder_prep(tau = 59)
Arguments
tau |
Follow-up truncation time (default: 59 months). Event times
beyond |
Details
The bladder cancer trial (Veterans Administration Cooperative Urological
Research Group) randomised patients to placebo, pyridoxine, or thiotepa.
Only the placebo and thiotepa arms are used here (pyridoxine arm excluded).
Subjects with event times equal to tau and status 0 have their
times truncated to tau, consistent with administrative censoring.
Value
A data frame with columns:
id |
Subject identifier (integer). |
status |
Event status: 0 = censored, 1 = recurrent event, 2 = terminal event. |
status0 |
Indicator: 1 if censored. |
status1 |
Indicator: 1 if recurrent event. |
status2 |
Indicator: 1 if terminal event. |
time |
Event time (months). |
treat |
Treatment indicator: 1 = thiotepa, 0 = placebo. |
num |
Initial number of tumours. |
size |
Initial tumour size (cm). |
References
Byar, D.P. (1980). The Veterans Administration study of chemoprophylaxis for recurrent stage I bladder tumors. In Bladder Tumors and Other Topics in Urological Oncology, 363-370. Plenum, New York.
Examples
bdata <- bladder_prep(tau = 59)
head(bdata)
table(bdata$status)
Extract coefficients from a wnpmle object
Description
Extract coefficients from a wnpmle object
Usage
## S3 method for class 'wnpmle'
coef(object, ...)
Arguments
object |
A |
... |
Ignored. |
Value
A named numeric vector of regression coefficients.
Log-likelihood for wnpmle objects
Description
Log-likelihood for wnpmle objects
Usage
## S3 method for class 'wnpmle'
logLik(object, ...)
Arguments
object |
A |
... |
Ignored. |
Value
An object of class "logLik" with the log-likelihood value,
degrees of freedom (df) equal to the number of regression
coefficients plus the number of baseline jumps, and number of
observations (nobs).
Plot method for wnpmle objects
Description
Plots the estimated cumulative baseline mean function Lambda(t) with optional pointwise confidence bands.
Usage
## S3 method for class 'wnpmle_cmprsk'
plot(x, conf_bands = TRUE, ...)
## S3 method for class 'wnpmle'
plot(x, conf_bands = TRUE, ...)
Arguments
x |
A |
conf_bands |
Logical; if |
... |
Additional graphical parameters passed to |
Value
No return value, called for side effects (produces a plot).
Plot predicted cumulative incidences or marginal means
Description
Plots the result of predict() for a wnpmle fit: one curve per
row of newdata, with pointwise confidence bands. For competing-risks
fits (type = "cmprsk") the curves are cumulative incidences, for
recurrent events marginal means.
Usage
## S3 method for class 'wnpmle_pred'
plot(
x,
conf_int = !add,
add = FALSE,
xscale = 1,
type = c("s", "l"),
col = NULL,
lty = NULL,
lwd = NULL,
band_col = NULL,
band_alpha = 0.15,
labels = NULL,
legend = if (add) FALSE else "auto",
xlab = NULL,
ylab = NULL,
main = NULL,
xlim = NULL,
ylim = NULL,
...
)
Arguments
x |
Result of |
conf_int |
Logical; draw the pointwise confidence bands, if available
(default |
add |
Logical; add the curves to the current plot, e.g. to compare two
models (default |
xscale |
The time axis is divided by |
type |
|
col, lty, lwd |
Colour, line type and line width, recycled over the
curves. Default: grey shades from black, solid lines (dashed with
|
band_col |
Colour of the confidence bands (default: |
band_alpha |
Transparency of the confidence bands (default 0.15). |
labels |
Legend labels, one per curve. By default built from the
covariates that differ between the rows of |
legend |
Position of the legend, e.g. |
xlab, ylab, main, xlim, ylim |
Axis labels, title and axis limits. The y-axis label depends on the type of prediction. |
... |
Further graphical parameters passed to |
Value
x, invisibly.
Examples
library(survival)
tp <- survival::transplant
tp <- tp[tp$futime > 0 & complete.cases(tp), ]
tp$status <- ifelse(tp$event == "ltx", 1, ifelse(tp$event == "censored", 0, 2))
fit <- wnpmle_fit(Surv(futime, status) ~ age + sex + abo, data = tp,
type = "cmprsk", model = "boxcox", rho = 1)
nd <- data.frame(age = 50, sex = factor("m", levels = levels(tp$sex)),
abo = factor(c("A", "O"), levels = levels(tp$abo)))
p <- predict(fit, newdata = nd)
plot(p, xscale = 365.25, xlab = "Years on the waiting list")
Plot the results of plot_loglik() or plot_tic() again
Description
plot_loglik and plot_tic return their results
(invisibly) as an object of class "wnpmle_profile". plot()
redraws the figure from these results without refitting any model, e.g.
with a different layout or into a PDF file.
Usage
## S3 method for class 'wnpmle_profile'
plot(
x,
layout = NULL,
relative = TRUE,
show_loglik = TRUE,
mark_points = TRUE,
legend = TRUE,
file = NULL,
width = NULL,
height = NULL,
...
)
Arguments
x |
An object of class |
layout |
|
relative |
Logical; show each criterion relative to its optimum
( |
show_loglik |
Logical; for results of |
mark_points, legend, file |
As in |
width, height |
Size of the PDF in inches; default 3.6 x 2.8 (with
pointsize 9, as in Bellach and Kosorok, 2026) for |
... |
Ignored. |
Value
x, invisibly.
Examples
bdata <- bladder_prep()
res <- plot_loglik(Surv(time, status) ~ treat + num + size, data = bdata,
id = "id", rho_grid = seq(0.2, 1.2, by = 0.2),
r_grid = seq(0.2, 1.2, by = 0.2))
plot(res, layout = "panels") # redrawn without refitting
Log-likelihood profile plot for the transformation parameter
Description
Fits the model over a fine grid of transformation parameter values and
plots the profile log-likelihood for both the Box-Cox and logarithmic
transformation models in one panel (layout = "joint", default): the
log transformation parameter r to the left and the Box-Cox parameter rho to
the right of a dotted line at zero, where the families meet
(\rho \to 0 is the log model with r = 1, r \to 0 the
Box-Cox model with \rho = 1). layout = "panels" gives two
panels side by side. Curves are natural splines through the grid points. For
competing risks the plot refers to the event coded 1; for another event,
recode the
status and call the function again.
Usage
plot_loglik(
formula,
data,
id = "id",
rho_grid = seq(0.01, 1.2, by = 0.01),
r_grid = seq(0.01, 1.2, by = 0.01),
tau = NULL,
mark_points = TRUE,
layout = NULL,
legend = TRUE,
file = NULL,
width = NULL,
height = NULL,
verbose = TRUE,
...
)
Arguments
formula |
A formula as passed to |
data |
A data frame. |
id |
Name of the subject identifier column. |
rho_grid |
A numeric vector of rho values for the Box-Cox model
(default: |
r_grid |
A numeric vector of r values for the log model
(default: |
tau |
Optional truncation time. If |
mark_points |
Logical; if |
layout |
|
legend |
Logical; add a legend (default |
file |
Optional path to save the plot as a PDF (e.g.
|
width, height |
Size of the PDF in inches; default 3.6 x 2.8 (pointsize
9, as Figure 2 of Bellach and Kosorok, 2026) for |
verbose |
Logical; print progress (default |
... |
Additional arguments passed to |
Value
A data frame of class "wnpmle_profile" with columns
model, param and loglik, invisibly. Save it
(res <- plot_loglik(...)) to redraw the figure with
plot.wnpmle_profile without refitting.
Examples
bdata <- bladder_prep()
bdata_clean <- bdata[, c("id", "time", "status", "treat", "num", "size")]
# a coarse grid keeps the example short; use finer grids in practice
plot_loglik(Surv(time, status) ~ treat + num + size,
data = bdata_clean, id = "id",
rho_grid = seq(0.2, 1.2, by = 0.2),
r_grid = seq(0.2, 1.2, by = 0.2))
Takeuchi information criterion over the transformation parameter
Description
Fits the Box-Cox and logarithmic transformation models over grids of the
transformation parameter and plots TIC and AIC on the log-likelihood scale,
relative to their optimum: -\Delta\mathrm{TIC}/2 (solid, filled
circles) and -\Delta\mathrm{AIC}/2 (dashed, open circles), as in
Figure 2 of Bellach and Kosorok (2026); see TIC. The maximum
of the solid curve is the model with the smallest TIC. r \to 0 and
\rho = 1 give the Ghosh-Lin model (the Fine-Gray model for
type = "cmprsk"), and \rho \to 0 and r = 1 the
proportional odds model. Further arguments such as type = "cmprsk"
are passed to wnpmle_fit via ....
Usage
plot_tic(
formula,
data,
id = "id",
rho_grid = seq(0.05, 1.2, by = 0.05),
r_grid = seq(0.05, 1.2, by = 0.05),
tau = NULL,
mark_points = TRUE,
show_loglik = TRUE,
layout = NULL,
legend = TRUE,
file = NULL,
width = NULL,
height = NULL,
verbose = TRUE,
...
)
Arguments
formula |
A formula as passed to |
data |
A data frame. |
id |
Name of the subject identifier column. |
rho_grid |
Box-Cox parameter values (default |
r_grid |
Logarithmic parameter values (default |
tau |
Optional truncation time. If |
mark_points |
Logical; if |
show_loglik |
Logical; if |
layout |
|
legend |
Logical; add a legend (default |
file |
Optional path to save the plot as a PDF (e.g.
|
width, height |
Size of the PDF in inches; default 3.6 x 2.8 (pointsize
9, as Figure 2 of Bellach and Kosorok, 2026) for |
verbose |
Logical; print progress (default |
... |
Additional arguments passed to |
Details
Every grid point needs a fit with the censoring-corrected sandwich and a
fit with the inverse Fisher information, so this is much slower than
plot_loglik; the default grids are therefore coarser.
Value
A data frame of class "wnpmle_profile" with columns
model, param, loglik, penalty, p,
AIC and TIC, invisibly. Save it (res <- plot_tic(...))
to redraw the figure with plot.wnpmle_profile without
refitting.
See Also
Examples
dat <- bladder_prep()
res <- plot_tic(Surv(time, status) ~ treat + num + size, data = dat,
id = "id", rho_grid = c(0.5, 1), r_grid = c(0.5, 1))
res
Predict marginal mean for new covariate values
Description
Evaluates the estimated marginal mean number of recurrent events,
\hat\mu(t \mid z) = G\{e^{\hat\beta^T z} \hat\Lambda(t)\}, at new
covariate values, with pointwise confidence limits.
Usage
## S3 method for class 'wnpmle_cmprsk'
predict(
object,
newdata = NULL,
times = NULL,
conf_int = TRUE,
conf_level = 0.95,
...
)
## S3 method for class 'wnpmle'
predict(
object,
newdata = NULL,
times = NULL,
conf_int = TRUE,
conf_level = 0.95,
...
)
Arguments
object |
A |
newdata |
A data frame with the same covariates used in fitting
(factors may be given as factors or character strings).
If |
times |
Time points at which to evaluate the marginal mean.
If |
conf_int |
Logical; if |
conf_level |
Confidence level (default 0.95). |
... |
Ignored. |
Details
For competing-risks fits (type = "cmprsk"), predict
returns the cumulative incidence of the event of interest,
\hat F_1(t \mid z) = 1 - \exp[-G\{e^{\hat\beta^T z} \hat\Lambda(t)\}],
in columns cif_i; the confidence limits are those of
G\{e^{\beta^T z}\Lambda(t)\} (delta method, log scale) mapped through
1 - \exp(-\cdot), so they stay within (0, 1).
The confidence limits are computed with the delta method from the
estimated covariance matrix of (\beta, \Lambda) (vcov(object)),
on the log scale so that they stay positive.
Value
A data frame with column time and, for each row i of
newdata, columns mu_i and (if conf_int) lower_i
and upper_i; or columns mu (and lower, upper)
for the baseline.
Print method for wnpmle objects
Description
Print method for wnpmle objects
Usage
## S3 method for class 'wnpmle_cmprsk'
print(x, ...)
## S3 method for class 'wnpmle'
print(x, ...)
Arguments
x |
A |
... |
Ignored. |
Value
Invisibly returns x.
Prepare the colorectal cancer readmission data for wnpmle analysis
Description
Reads the hospital readmission data of 403 colorectal cancer patients
(Gonzalez et al., 2005), shipped with wnpmle as a copy of the
readmission data from the frailtypack package, and converts
them to the format used by wnpmle_fit: one row per
readmission (status 1), plus a final row for death (status 2) or censoring
(status 0) unless the follow-up of a surviving patient ends with a
readmission.
Usage
readmission_prep(tau = NULL)
Arguments
tau |
Optional end of follow-up (days). If given, readmissions after
|
Details
The data contain 403 patients with 458 readmissions and 109 deaths. All covariates are taken at baseline (the first record of each patient), as required by the marginal rate model with external covariates; the Charlson index recorded later in follow-up is not used. This is the data set analysed in Bellach and Kosorok (2026).
Value
A data frame with columns:
id |
Patient identifier. |
time |
Days since surgery of the readmission, death or censoring. |
status |
0 = censored, 1 = readmission (recurrent event), 2 = death (terminal event). |
chemo |
Chemotherapy: factor with levels |
sex |
Factor with levels |
dukes |
Dukes' tumour stage: factor with levels |
charlson |
Charlson comorbidity index at baseline: factor with
levels |
Source
Copy of the readmission data from the frailtypack package
(Rondeau et al.; GPL (>= 2)).
References
Gonzalez, J.R., Fernandez, E., Moreno, V., Ribes, J., Peris, M., Navarro, M., Cambray, M. and Borras, J.M. (2005). Sex differences in hospital readmission among colorectal cancer patients. Journal of Epidemiology and Community Health, 59(6), 506-511. doi:10.1136/jech.2004.028902
Examples
rdata <- readmission_prep()
head(rdata)
table(rdata$status)
table(readmission_prep(tau = 1460)$status)
Summary method for wnpmle objects
Description
Summary method for wnpmle objects
Usage
## S3 method for class 'wnpmle_cmprsk'
summary(object, tau_grid = TRUE, times = NULL, ...)
## S3 method for class 'wnpmle'
summary(object, tau_grid = TRUE, times = NULL, ...)
Arguments
object |
A |
tau_grid |
Logical; if |
times |
Optional numeric vector of time points at which the cumulative
baseline is shown instead of tau/4, tau/2 and tau, e.g.
|
... |
Ignored. |
Value
An object of class summary.wnpmle, printed with the
coefficient table and Lambda at tau/4, tau/2 and tau.
Extract variance-covariance matrix from a wnpmle object
Description
Returns the full variance-covariance matrix for (beta, Lambda).
To get only the beta part, use vcov(fit)[1:p, 1:p].
Usage
## S3 method for class 'wnpmle'
vcov(object, ...)
Arguments
object |
A |
... |
Ignored. |
Value
A numeric matrix containing the variance-covariance matrix for
the regression coefficients and cumulative baseline mean function.
Returns an error if se = "none" was used in wnpmle_fit.
Fit Weighted NPMLE for Survival Data with Recurrent or Competing Events
Description
Estimates the weighted nonparametric maximum likelihood estimator (wNPMLE)
for the marginal mean function of recurrent events in the presence of a
competing terminal event (type = "recurrent"), or for the
subdistribution of a competing risk (type = "cmprsk"). Two
transformation models are supported: the Box-Cox model and the logarithmic
model.
Usage
wnpmle_fit(
formula,
data,
id = "id",
type = c("recurrent", "cmprsk", "cmprsk_ltrc"),
model = c("boxcox", "log"),
rho = 1,
r = NULL,
tau = NULL,
se = c("sandwich_adj", "sandwich", "fisher", "none"),
init_beta = NULL,
control = list(),
silent = TRUE
)
Arguments
formula |
A formula of the form |
data |
A data frame containing the variables in |
id |
Name of the subject identifier column in |
type |
Type of analysis: |
model |
Transformation model: |
rho |
Box-Cox parameter rho for |
r |
Parameter r of the logarithmic model,
|
tau |
Follow-up truncation time. Kaplan-Meier censoring weights are
truncated at |
se |
Variance estimation method: |
init_beta |
Initial values for regression coefficients (default: all zeros). |
control |
A list of control parameters passed to |
silent |
Suppress TMB output (default: |
Details
Analysis types: type = "recurrent" models the marginal mean
\mu(t \mid z) = G\{e^{\beta^T z}\Lambda(t)\} of recurrent events with a
competing terminal event (Bellach and Kosorok, 2026).
type = "cmprsk" models the cumulative incidence of the event of
interest, F_1(t \mid z) = 1 - \exp[-G\{e^{\beta^T z}\Lambda(t)\}]
(Bellach, Kosorok, Rüschendorf and Fine, 2019); \rho = 1 in the
Box-Cox model is the Fine-Gray model. For type = "cmprsk", subjects
observed beyond tau, and the last subjects once the Kaplan-Meier
estimate of the censoring distribution drops below 0.05, are censored just
after tau; the result has class c("wnpmle_cmprsk", "wnpmle"),
and predict() returns cumulative incidences.
Transformation models: The two models differ in the link function G:
-
Box-Cox:
G(x) = ((1 + x)^\rho - 1) / \rho, withG(x) \to \log(1+x)as\rho \to 0. -
Logarithmic:
G(x) = \log(1 + r \cdot x) / r, withG(x) \to xasr \to 0.
Both are estimated via automatic differentiation using TMB. The sandwich variance estimator accounts for the estimation of the censoring weights. The censoring-corrected sandwich adds an influence function correction for the Kaplan-Meier censoring weight estimation.
Value
An object of class "wnpmle" with components:
coefficients |
Estimated regression coefficients (beta). |
se |
Standard errors for the regression coefficients. |
Lambda |
Estimated cumulative baseline mean function, evaluated at the recurrent event times. |
lambda |
Estimated baseline increments. |
event_times |
Recurrent event times at which Lambda is estimated. |
loglik |
Log-likelihood at the optimum. |
vcov |
Full variance-covariance matrix for (beta, Lambda). |
model |
Transformation model used. |
rho |
Transformation parameter used. |
tau |
Truncation time used. |
n |
Number of subjects. |
n_events |
Named vector: recurrent events, terminal events, censored. |
convergence |
Convergence message from |
call |
The matched call. |
References
Bellach, A. and Kosorok, M.R. (2026). Pseudo-likelihood regression for the marginal rate of recurrent events with a competing terminal event. arXiv preprint arXiv:2605.25934. doi:10.48550/arXiv.2605.25934
Bellach, A., Kosorok, M.R., Rüschendorf, L. and Fine, J.P. (2019). Weighted NPMLE for the subdistribution of a competing risk. Journal of the American Statistical Association, 114(525), 259-270. doi:10.1080/01621459.2017.1401540
Examples
library(survival)
data("bladder2", package = "survival")
bladder2_prepped <- bladder_prep()
fit <- wnpmle_fit(Surv(time, status) ~ treat + num + size,
data = bladder2_prepped, id = "id",
model = "log", r = 1)
summary(fit)
# competing risks: liver transplant (event of interest) versus
# death or withdrawal from the waiting list (competing events)
tp <- survival::transplant
tp <- tp[tp$futime > 0 & complete.cases(tp), ]
tp$status <- ifelse(tp$event == "ltx", 1,
ifelse(tp$event == "censored", 0, 2))
fit_fg <- wnpmle_fit(Surv(futime, status) ~ age + sex + abo, data = tp,
type = "cmprsk", model = "boxcox", rho = 1) # Fine-Gray
summary(fit_fg)