plot.aj_estimate: Plot Aalen-Johansen Estimates

View source: R/plot.R

plot.aj_estimateR Documentation

Plot Aalen-Johansen Estimates

Description

Visualizes calendar-time state occupation, product-integral point estimates, Nelson–Aalen cumulative cause-specific hazards, or hazard increments from the Aalen–Johansen estimator.

Usage

## S3 method for class 'aj_estimate'
plot(
  x,
  type = c("state_occupation", "stacked_transition_prob", "cumulative_hazard",
    "hazard_increment", "transition_intensity"),
  states = NULL,
  ci = FALSE,
  col = NULL,
  main = NULL,
  xlab = "Time",
  ylab = NULL,
  ...
)

Arguments

x

An aj_estimate object.

type

Character, one of "state_occupation" (default), "stacked_transition_prob", "cumulative_hazard", "hazard_increment". The legacy "transition_intensity" alias warns because increments are not intensities.

states

Character vector of states to plot (default: all). For cumulative-hazard and hazard-increment plots, transitions are filtered by destination state.

ci

One nonmissing logical value. This is a deprecated compatibility argument: TRUE warns because no validated AJ covariance or confidence band is returned.

col

One or more colors for selected states/transitions. Values are recycled when necessary; NULL uses the package palette.

main

Title (default: auto-generated).

xlab, ylab

Axis labels.

...

Additional arguments passed to plot.

Value

The input x object, returned invisibly. Called for its side effect of producing a plot.

Limitations

AJ plots are covariate-free calendar-time point estimates from the common baseline. Confidence bands are unavailable. Hazard increments are discrete Nelson–Aalen increments, not smoothed transition intensities. The legacy "transition_intensity" type is deprecated and draws the same hazard-increment plot with a warning. The historical "stacked_transition_prob" label displays the selected state-occupation components from the recorded initial state.

Examples

ms <- define_multistate(c("A", "B"), "B", list(A = "B"))
dat <- data.frame(id = 1:6, x = 1:6, time_B = 1:6,
                  censor = NA_real_)
long <- prepare_data(dat, "id", ms, list(B = "time_B"), "censor", "x")
aj <- aalen_johansen(long)
plot(aj, states = "B", xlab = "Study day", ylab = "Probability")
plot(aj, type = "hazard_increment", states = "B")


RFmstate documentation built on Sept. 10, 2026, 1:09 a.m.