Learn R Programming

dynamichazard (version 1.0.2)

plot.ddhazard: Plots for ddhazard Object

Description

Plot of estimated state space variables from a ddhazard fit.

Usage

# S3 method for ddhazard
plot(
  x,
  xlab = "Time",
  ylab = "Hazard",
  type = "cov",
  plot_type = "l",
  cov_index,
  ylim,
  col = "black",
  add = FALSE,
  do_alter_mfcol = TRUE,
  level = 0.95,
  ddhazard_boot,
  ...
)

Value

Returns NULL using invisible.

Arguments

x

result of ddhazard call.

xlab, ylab, ylim, col

arguments to override defaults set in the function.

type

type of plot. Currently, only "cov" is available for plot of the state space parameters.

plot_type

the type argument passed to plot.

cov_index

the index (indices) of the state space parameter(s) to plot.

add

FALSE if you want to make a new plot.

do_alter_mfcol

TRUE if the function should alter par(mfcol) in case that cov_index has more than one element.

level

level (fraction) for confidence bounds.

ddhazard_boot

object from a ddhazard_boot call which confidence bounds will be based on and where bootstrap samples will be printed with a transparent color.

...

arguments passed to plot.default or lines depending on the value of add.

Details

Creates a plot of state variables or adds state variables to a plot with indices cov_index. Pointwise 1.96 std. confidence intervals are provided with the smoothed co-variance matrices from the fit.

Examples

Run this code
library(dynamichazard)
fit <- ddhazard(
 Surv(time, status == 2) ~ log(bili), pbc, id = pbc$id, max_T = 3600,
 Q_0 = diag(1, 2), Q = diag(1e-4, 2), by = 50,
 control = ddhazard_control(method = "GMA"))
plot(fit)
plot(fit, cov_index = 2)

Run the code above in your browser using DataLab