Learn R Programming

spsurv (version 1.1.0)

ggresiduals: ggplot2 residual diagnostic plots for spbp models

Description

Convenience wrapper around residuals.spbp that returns a ggplot2 object for martingale, deviance, or Cox-Snell residuals.

Usage

ggresiduals(
  object,
  type = c("martingale", "deviance", "cox-snell", "coxsnell"),
  against = c("fitted", "index"),
  ...
)

Value

A ggplot object (requires ggplot2).

Arguments

object

A fitted "spbp" object.

type

Residual type: "martingale" (default), "deviance", "cox-snell", or "coxsnell".

against

What to plot on the x-axis: "fitted" (default, Cox-Snell cumulative hazard) or "index" (observation index).

...

Further arguments passed to residuals.spbp.

Examples

Run this code
if (FALSE) {
library(spsurv)
library(ggplot2)
data(veteran, package = "survival")
fit <- bpph(Surv(time, status) ~ karno, data = veteran, degree = 4)
ggresiduals(fit, type = "martingale")
}

Run the code above in your browser using DataLab