gcemod-methods: Methods for fitted generalized competing event models

gcemod-methodsR Documentation

Methods for fitted generalized competing event models

Description

Methods for objects of class "gcemod" returned by gcecox, gcefg, and gcecif, and for the "gce_lunnmcneil" objects returned by lunnmcneil.

Usage

## S3 method for class 'gcemod'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

## S3 method for class 'gce_lunnmcneil'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

## S3 method for class 'gcemod'
summary(object, conf.level = object$conf.level, ...)

## S3 method for class 'gcecox'
summary(object, conf.level = object$conf.level, ...)

## S3 method for class 'gcefg'
summary(object, conf.level = object$conf.level, ...)

## S3 method for class 'gcecif'
summary(object, conf.level = object$conf.level, ...)

## S3 method for class 'gce_lunnmcneil'
summary(object, conf.level = object$conf.level, ...)

## S3 method for class 'summary.gcemod'
print(
  x,
  digits = max(3L, getOption("digits") - 3L),
  signif.stars = getOption("show.signif.stars"),
  eps = 1e-04,
  ...
)

## S3 method for class 'gcemod'
coef(object, ...)

## S3 method for class 'gce_lunnmcneil'
coef(object, ...)

## S3 method for class 'summary.gcemod'
coef(object, ...)

## S3 method for class 'gcemod'
vcov(object, ...)

## S3 method for class 'gce_lunnmcneil'
vcov(object, ...)

## S3 method for class 'gcemod'
confint(object, parm, level = 0.95, exponentiate = FALSE, ...)

## S3 method for class 'gce_lunnmcneil'
confint(object, parm, level = 0.95, exponentiate = FALSE, ...)

## S3 method for class 'gcemod'
nobs(object, ...)

## S3 method for class 'gce_lunnmcneil'
nobs(object, ...)

## S3 method for class 'gcemod'
formula(x, ...)

## S3 method for class 'gce_lunnmcneil'
formula(x, ...)

## S3 method for class 'gcemod'
terms(x, ...)

## S3 method for class 'gce_lunnmcneil'
terms(x, ...)

## S3 method for class 'gcemod'
model.frame(formula, ...)

## S3 method for class 'gcemod'
model.matrix(object, ...)

## S3 method for class 'gcemod'
logLik(object, ...)

## S3 method for class 'gcecif'
logLik(object, ...)

## S3 method for class 'gce_lunnmcneil'
logLik(object, ...)

## S3 method for class 'gcemod'
predict(
  object,
  newdata = NULL,
  type = c("lp", "risk", "ratio", "share"),
  times = NULL,
  ...
)

## S3 method for class 'gcecox'
predict(
  object,
  newdata = NULL,
  type = c("lp", "risk", "ratio", "share"),
  times = NULL,
  ...
)

## S3 method for class 'gcefg'
predict(
  object,
  newdata = NULL,
  type = c("lp", "risk", "ratio", "share"),
  times = NULL,
  ...
)

## S3 method for class 'gcecif'
predict(
  object,
  newdata = NULL,
  type = c("lp", "risk", "ratio", "share"),
  times = NULL,
  ...
)

## S3 method for class 'gcemod'
fitted(object, type = c("lp", "risk", "ratio", "share"), ...)

## S3 method for class 'gcemod'
plot(
  x,
  which = c("riskscore", "omegatime", "alligator", "calibration"),
  bins = 5,
  ylab = expression(omega^"+"),
  ...
)

## S3 method for class 'gcefg'
plot(x, ..., ylab = expression(tilde(omega)^"+"))

## S3 method for class 'gcecif'
plot(x, ..., ylab = expression(rho))

Arguments

x, object

a fitted model object.

digits

number of significant digits to print.

...

for plot, further arguments passed to the display function; for the print method of a summary, further arguments passed to printCoefmat; otherwise unused.

conf.level

confidence level of the intervals in the summary (defaults to the level used when fitting).

signif.stars

logical; print significance stars.

eps

threshold for printing the p-value of the omnibus test: values below eps are printed as < eps (see format.pval). The p-values in the coefficient table are formatted by printCoefmat, whose eps.Pvalue argument can be supplied through ....

parm

coefficients for which intervals are wanted (names or indices).

level

confidence level.

exponentiate

logical; return intervals for the ratios exp(coef) instead of the log ratios.

formula

a fitted model object (the argument name is that of the model.frame generic).

newdata

optional data frame of new subjects. If omitted, predictions for the fitting data are returned.

type

type of prediction; see Prediction.

times

time(s) at which "ratio" and "share" are evaluated.

which

display to draw: "riskscore" (predicted ratio against the risk score, in bins quantile groups), "omegatime" (gce_omegatime), "alligator" (gce_alligator), or "calibration" (gce_calibration).

bins

number of quantile groups for which = "riskscore".

ylab

y-axis label for which = "riskscore". The default is the symbol of the ratio estimated by the model.

Details

The fitting functions return objects of class c("gcecox", "gcemod"), c("gcefg", "gcemod"), and c("gcecif", "gcemod"). Behaviour common to the three models is implemented in the methods for the parent class "gcemod". Where a model needs its own behaviour (summary, predict, logLik, plot), a method for the specific class supplies it and calls the parent method through NextMethod for the common part.

print

a short display: the call, the sample and event counts, and the estimated ratios exp(coef).

summary

returns an object of class "summary.gcemod" (or "summary.gce_lunnmcneil") holding the full coefficient table (estimate, ratio, standard error, Wald z, p-value), the confidence intervals for the ratios, the omnibus Wald test, and the baseline quantity of the model (\omega^{+}(t) of the average subject, or F_1(t), F_2(t), and \rho(t)). Its print method formats the table with printCoefmat. coef() applied to the summary object returns the coefficient table.

coef, vcov, confint

the log ratios (log \omega^{+} ratios; log \rho ratios for gcecif), their covariance matrix, and Wald confidence intervals, all on the reported coefficient scale (per unit, or per SD if the model was fitted with standardize = TRUE). confint(exponentiate = TRUE) returns intervals for the ratios.

logLik

the maximized log partial likelihood of the stacked model for gcecox fits, and the corresponding weighted log partial pseudo-likelihood for gcefg fits (useful for comparing nested specifications descriptively; it is not a genuine likelihood). gcecif is estimated by generalized estimating equations and has no likelihood, so logLik signals an error.

nobs, formula, terms, model.frame, model.matrix

the number of subjects and the stored model specification. update() works through the stored call.

predict, fitted

see below.

plot

dispatches to the display functions; see which.

Value

summary returns an object of class "summary.gcemod" or "summary.gce_lunnmcneil"; coef a named numeric vector (for a summary object, the coefficient matrix); vcov a matrix; confint a two-column matrix; logLik an object of class "logLik"; predict and fitted a numeric vector (or matrix, for several times); plot a ggplot object, invisibly. print methods return their argument invisibly.

Prediction

predict() rebuilds the design matrix for newdata from the stored terms, factor levels, and contrasts. type selects:

"lp"

the GCE risk score: the linear predictor centered at the covariate means of the fitting data.

"risk"

exp(lp), the subject's ratio relative to the average subject.

"ratio"

the absolute predicted ratio: \omega^{+}(t) for gcecox (the marginal Nelson-Aalen ratio H_1(t)/H_2(t) times exp(lp)), \tilde\omega^{+}(t) for gcefg, and \rho(t) for gcecif.

"share"

ratio / (1 + ratio): \omega(t), or the share \pi_1(t) for gcecif.

times defaults to the readout time t of the fit. With several times a matrix with one column per time is returned. For gcecif the landmark time is part of the fitted model and cannot be changed. fitted() is predict() on the fitting data.

Examples

data(hn)
fit <- gcecox(Surv(time, status) ~ age + smoker + p16, data = hn, t = 5)

fit                       # short display
s <- summary(fit)         # full table, returned as an object
coef(s)                   # the coefficient table
print(s, eps = 1e-8)      # p-value formatting of the omnibus test
coef(fit); vcov(fit)
confint(fit, exponentiate = TRUE)
logLik(fit); nobs(fit); formula(fit)

head(fitted(fit))                                  # risk score
predict(fit, hn[1:3, ], type = "ratio", times = c(2, 5))

fit2 <- update(fit, . ~ . - smoker)
plot(fit, which = "riskscore", bins = 5)

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