hazardPlot {casebase} | R Documentation |

Visualize estimated hazard curves as a function of time with
confidence intervals. This function takes as input, the result from the
`fitSmoothHazard()`

function. The user can also specify a
sequence of times at which to estimate the hazard function. These plots are
useful to visualize the non-proportional hazards, i.e., time dependent
interactions with a covariate.

hazardPlot( object, newdata, type = c("hazard"), xlab = NULL, breaks = 100, ci.lvl = 0.95, ylab = NULL, line.col = 1, ci.col = "grey", lty = par("lty"), add = FALSE, ci = !add, rug = !add, s = c("lambda.1se", "lambda.min"), times = NULL, ... )

`object` |
Fitted object of class |

`newdata` |
A data frame in which to look for variables with which to predict. This is required and must contain all the variables used in the model. Only one covariate profile can be used. If more than one row is provided, only the first row will be used. |

`type` |
Type of plot. Currently, only "hazard" has been implemented. Default: c("hazard") |

`xlab` |
x-axis label. Default: the name of the time variable from the
fitted |

`breaks` |
Number of points at which to estimate the hazard. This argument
is only used if argument |

`ci.lvl` |
Confidence level. Must be in (0,1), Default: 0.95 |

`ylab` |
y-axis label. Default: NULL which means the function will put sensible defaults. |

`line.col` |
Line color, Default: 1. See |

`ci.col` |
Confidence band color. Only used if argument |

`lty` |
Line type. See |

`add` |
Logical; if TRUE add to an already existing plot; Default: FALSE |

`ci` |
Logical; if TRUE confidence bands are calculated. Only available
for |

`rug` |
Logical. Adds a rug representation (1-d plot) of the event times
(only for |

`s` |
Value of the penalty parameter lambda at which predictions are
required (for class |

`times` |
Vector of numeric values at which the hazard should be
calculated. Default: NULL which means this function will use the minimum
and maximum of observed event times with the |

`...` |
further arguments passed to |

This is an earlier version of a function to plot hazards. We
recommend instead using the plot method for objects returned by
`fitSmoothHazard()`

. See `plot.singleEventCB()`

.

a plot of the hazard function and a data.frame of original data used
in the fitting along with the data used to create the plots including
`predictedhazard`

which is the predicted hazard for a given covariate
pattern and time `predictedloghazard`

is the predicted hazard on the log
scale. `lowerbound`

and `upperbound`

are the lower and upper confidence
interval bounds on the hazard scale (i.e. used to plot the confidence
bands). `standarderror`

is the standard error of the log hazard (only if
`family="glm"`

or `family="gam"`

)

data("simdat") mod_cb <- fitSmoothHazard(status ~ trt * eventtime, time = "eventtime", data = simdat[1:200,], ratio = 1, family = "glm") results0 <- hazardPlot(object = mod_cb, newdata = data.frame(trt = 0), ci.lvl = 0.95, ci = FALSE, lty = 1, line.col = 1, lwd = 2) head(results0) hazardPlot(object = mod_cb, newdata = data.frame(trt = 1), ci = FALSE, ci.lvl = 0.95, add = TRUE, lty = 2, line.col = 2, lwd = 2) legend("topleft", c("trt=0","trt=1"),lty=1:2,col=1:2,bty="y", lwd = 2)

[Package *casebase* version 0.9.1 Index]