lunnmcneil: Lunn-McNeil stacked-model estimation of omega+ ratios

View source: R/lunnmcneil.R

lunnmcneilR Documentation

Lunn-McNeil stacked-model estimation of omega+ ratios

Description

Estimates covariate effects on \omega^{+} (the ratio of the hazard for the event of interest to the hazard for the competing event) from a single stacked ("augmented") model, following Lunn and McNeil (1995). Each subject contributes one record per event type; the model is stratified by event type and the covariate-by-event-type interaction estimates \log(\omega^{+}\text{ ratio}) with model-based standard errors, per-covariate Wald tests, and an omnibus multivariate Wald test.

lunnmcneil() is the estimation engine behind gcecox and gcefg; use it directly when only the coefficient table and tests are needed, and the GCE fitters when the risk score, predictions, and displays are wanted as well.

Usage

lunnmcneil(formula, ...)

## S3 method for class 'formula'
lunnmcneil(
  formula,
  data,
  subset,
  na.action,
  event = NULL,
  competing = NULL,
  type = c("coxph", "finegray"),
  cluster.se = TRUE,
  conf.level = 0.95,
  standardize = FALSE,
  se = c("robust", "boot"),
  B = 200,
  contrasts = NULL,
  ...
)

## Default S3 method:
lunnmcneil(
  formula,
  cause,
  Cov,
  event = 1,
  competing = 2,
  type = c("coxph", "finegray"),
  cluster.se = TRUE,
  conf.level = 0.95,
  standardize = FALSE,
  se = c("robust", "boot"),
  B = 200,
  ...
)

Arguments

formula

a formula with a Surv(time, status) response (formula method), or the numeric vector of follow-up times (default method, where it may also be named Time).

...

passed to coxph.

data

a data frame in which the formula is evaluated.

subset, na.action

as in model.frame.

event

code (or factor level) marking the event of interest.

competing

code (or factor level) marking the competing event.

type

"coxph" (cause-specific, default) or "finegray" (subdistribution).

cluster.se

logical; cluster-robust (subject) SEs (default TRUE).

conf.level

confidence level (default 0.95).

standardize

logical; controls only the reported coefficient scale (default FALSE). FALSE reports omega+ ratios per natural covariate unit; TRUE reports them per 1 SD. This is a reparameterization, so Wald tests, p-values, and the omnibus test are identical either way. The covariate means/SDs ($center, $scale) are always returned.

se

standard-error method: "robust" (default; model-based, cluster-robust on subject, with the censoring weights treated as fixed) or "boot" (subject bootstrap: the stacked model is refit on B resamples of subjects, re-estimating the censoring weights within each resample, so the variance additionally accounts for their estimation). Mainly relevant for type = "finegray"; because estimating the weights reduces the asymptotic variance, the fixed-weights default errs, if at all, on the conservative side.

B

number of bootstrap resamples when se = "boot" (default 200).

contrasts

optional contrasts specification passed to model.matrix.

cause

(default method) event indicator per subject: 0 = censored, and the codes in event and competing for the two event types.

Cov

(default method) a data frame of covariates (factors are expanded to indicators).

Details

Two hazard scales are supported:

type = "coxph"

Cause-specific hazards. The augmented data set duplicates each subject into an "event" stratum and a "competing" stratum; the interaction coefficient is exactly the difference in cause-specific log-hazards, i.e. \log(\omega^{+}). This is the original Lunn-McNeil construction and the interaction MLE equals the difference of two separate cause-specific Cox fits.

type = "finegray"

Subdistribution hazards. Risk-set-weighted data are generated for each event type with finegray, stacked, and fit with a single weighted, event-type-stratified coxph. The interaction estimates the difference in subdistribution log-hazards. Because subjects recur across the weighted risk sets, cluster-robust (subject) standard errors are used. This is an extension of Lunn-McNeil to the subdistribution scale.

Subject records are duplicated in both cases, so cluster-robust standard errors (clustered on subject) are the default.

Value

An object of class "gce_lunnmcneil": a list with the fitted stacked model ($fit), the omega+ coefficient table ($omegaplus), the coefficient vector and its covariance matrix on the reported scale ($coef, $var), the reference (competing-event) coefficients ($beta_competing), the omnibus test ($omnibus), the model terms, xlevels, contrasts and formula, and the hazard scale ($type). Methods are available for print, summary, coef, vcov, confint, nobs, logLik, formula, and terms.

Interfaces

The formula method is the recommended interface. The response is written Surv(time, status), where status is either numeric with 0 = censored and the codes given by event and competing (defaults 1 and 2), or a factor whose first level denotes censoring (the convention of Surv for multi-state data), in which case event and competing default to the second and third levels. The right-hand side accepts the usual model-formula syntax (factors, interactions, transformations, splines). The model terms, factor levels, and contrasts are stored in the fitted object.

The default method is the matrix interface of earlier versions (lunnmcneil(Time, cause, Cov)); it is retained for backward compatibility and returns the same object.

References

Lunn M, McNeil D (1995) Applying Cox regression to competing risks. Biometrics 51:524-32.

See Also

gcecox, gcefg, gcemod-methods

Examples

data(hn)
fit <- lunnmcneil(Surv(time, status) ~ age + smoker + t_cat + n_cat + p16,
                  data = hn)
fit
summary(fit)
confint(fit)

# subdistribution scale
lunnmcneil(Surv(time, status) ~ age + smoker + p16, data = hn,
           type = "finegray")

# matrix interface
lunnmcneil(hn$time, hn$status, hn[, c("age", "smoker", "p16")])

gcemod documentation built on Dec. 1, 2026, 1:06 a.m.