Learn R Programming

EMGCR (version 0.2.0)

qqMCR: QQ-Plot of Residuals for MCR Model

Description

Produces a Q-Q plot of residuals from a Mixture Cure Rate (MCR) model fitted via MCRfit. Optionally, a simulation envelope can be included for Cox-Snell residuals.

Usage

qqMCR(
  object,
  type = c("cox-snell", "quantile"),
  envelope = FALSE,
  nsim = 100,
  censor = NULL,
  ...
)

Value

A QQ-plot is produced as a side effect. Nothing is returned.

Arguments

object

An object of class MCR, typically returned by MCRfit.

type

Character. Type of residual to use in the QQ-plot. Options are "cox-snell" or "quantile". Defaults to "cox-snell".

envelope

Logical. Whether to add a simulation envelope to the QQ-plot. Default is FALSE.

nsim

Integer. Number of simulations used to construct the envelope. Default is 100.

censor

Logical vector or NULL. Censoring indicator used when simulating data for the envelope. Required only when envelope = TRUE and type = "cox-snell".

...

Additional arguments (currently ignored).

Details

The function generates QQ-plots of either Cox-Snell or quantile residuals. When envelope = TRUE and type = "cox-snell", a simulation envelope is added using Monte Carlo replications.

See Also

MCRfit, residuals.MCR

Examples

Run this code

data(liver)
fit <- MCRfit(survival::Surv(time, status) ~ age + medh + relapse + grade | sex + grade,
              data = liver, dist = "weibull", link = "logit")
qqMCR(fit, type = "quantile", envelope = TRUE, nsim = 50, censor = liver$status)

Run the code above in your browser using DataLab