Internal seam used by the simulation-based confidence interval helpers (get_sim_ci, get_sim_ci_cumu, get_sim_ci_surv). It returns a matrix of nsim draws of the (response-scale) hazard, one column per draw and one row per row of newdata. The default method draws coefficient vectors via sample_coefs and evaluates the linear predictor make_X(object, newdata) %*% z; other backends (e.g. a bootstrap ensemble that has no coefficient covariance) can provide their own method to obtain simulation-based intervals from the same machinery.

sim_hazard(object, newdata, nsim = 100L, ...)

# Default S3 method
sim_hazard(object, newdata, nsim = 100L, ...)

Arguments

object

A fitted model object.

newdata

A data frame for which hazards are predicted.

nsim

Number of draws.

...

Further arguments passed to methods.

Value

A numeric matrix with nrow(newdata) rows and nsim columns of hazard draws on the response scale. The draws are produced once for the whole newdata, so the callers can share one set of draws across groups by passing the full (grouped) data.

See also

The package website (https://adibender.github.io/pammtools/) has worked examples of implementing get_hazard and sim_hazard for new estimation backends: the articles “Defining a new backend: gradient boosting with xgboost” (a bootstrap tree ensemble) and “Bayesian Baseline PAMMs” (a brms model, drawing from the posterior).