add_hazard2: Add predicted (cumulative) hazard to data set

Description Usage Arguments

View source: R/add-functions.R

Description

Add (cumulative) hazard based on the provided data set and model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
add_hazard2(
  newdata,
  object,
  reference = NULL,
  overwrite = FALSE,
  time_var = NULL,
  ...
)

add_cumu_hazard2(
  newdata,
  object,
  overwrite = FALSE,
  time_var = NULL,
  interval_length = "intlen",
  ...
)

Arguments

newdata

A data frame or list containing the values of the model covariates at which predictions are required. If this is not provided then predictions corresponding to the original data are returned. If newdata is provided then it should contain all the variables needed for prediction: a warning is generated if not. See details for use with link{linear.functional.terms}.

object

a fitted gam object as produced by gam().

reference

A data frame with number of rows equal to nrow(newdata) or one, or a named list with (partial) covariate specifications. See examples.

overwrite

Should hazard columns be overwritten if already present in the data set? Defaults to FALSE.

time_var

Name of the variable used for the baseline hazard. If not given, defaults to "tend" for gam fits, else "interval". The latter is assumed to be a factor, the former numeric.

...

Further arguments passed to predict.xgb.Booster.

interval_length

The variable in newdata containing the interval lengths. Can be either bare unquoted variable name or character. Defaults to "intlen".


adibender/pem.xgb documentation built on Sept. 10, 2021, 7:24 p.m.