Skip to contents

baseline_hazard() gives the baseline hazard of a fitted model, with its standard error and confidence limits. For a cox_ph() fit, it's the cumulative hazard \(H_0(t)\) at every distinct time in each stratum. For a piecewise_exponential() fit, it's the hazard in each interval.

Usage

baseline_hazard(object, ...)

# S3 method for class 'cox_ph'
baseline_hazard(
  object,
  centered = FALSE,
  conf_type = c("log", "plain"),
  conf_level = object$conf_level,
  ...
)

# S3 method for class 'piecewise_exponential'
baseline_hazard(object, conf_level = object$conf_level, ...)

Arguments

object

A fitted model.

...

Passed on to methods.

centered

Give the cumulative hazard at the means of the covariates instead of at 0. The default is FALSE.

conf_type

The scale for confidence intervals: "log" (the default) or "plain", with the lower limit floored at 0.

conf_level

The confidence level. The default is the level the model was fit with.

Value

A data frame. See the methods for the columns.

Methods (by class)

  • baseline_hazard(cox_ph): For a cox_ph() fit, the cumulative hazard of a subject with every covariate at 0 (or at its mean, with centered = TRUE), by Breslow's estimator (Efron's when the model uses Efron's ties). Survival is \(\exp(-H_0(t))\), and the confidence limits of the cumulative hazard map onto those of survival, so log-scale limits for \(H_0\) are log-log limits for survival. The table has the columns strata, the stratifying variables, time, n_risk, n_event, estimate, std_error, conf_low, and conf_high, with the same layout for one stratum (strata is "all") as for several.

  • baseline_hazard(piecewise_exponential): For a piecewise_exponential() fit, the hazard of a subject with every covariate at 0, one row per interval: start, stop, hazard, log_hazard, std_error (of the log hazard), and conf_low and conf_high (limits for the hazard, built on the log scale).

Examples

lung <- data.frame(
  time = c(306, 455, 1010, 210, 883, 1022, 310, 361, 218, 166, 170, 654, 728, 71, 567),
  status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2),
  age = c(74, 68, 56, 57, 60, 74, 68, 71, 53, 61, 57, 68, 68, 60, 57),
  sex = c(1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1)
)
fit <- cox_ph(Surv(time, status) ~ age + sex, data = lung)
baseline_hazard(fit, centered = TRUE)
#>    strata time n_risk n_event   estimate  std_error    conf_low conf_high
#> 1     all   71     15       1 0.06515465 0.06526763 0.009146773 0.4641122
#> 2     all  166     14       1 0.13518883 0.09597492 0.033623683 0.5435460
#> 3     all  170     13       1 0.21066988 0.12247958 0.067410817 0.6583780
#> 4     all  210     12       1 0.29363660 0.14833592 0.109096317 0.7903333
#> 5     all  218     11       1 0.38573719 0.17502577 0.158512779 0.9386826
#> 6     all  306     10       1 0.49132254 0.20477158 0.217073133 1.1120577
#> 7     all  310      9       1 0.60450774 0.23533181 0.281859971 1.2964934
#> 8     all  361      8       1 0.73215862 0.26881846 0.356516037 1.5035964
#> 9     all  455      7       1 0.87628876 0.30542355 0.442555401 1.7351093
#> 10    all  567      6       1 1.03906026 0.34754431 0.539425298 2.0014750
#> 11    all  654      5       1 1.24115192 0.40477460 0.654974132 2.3519373
#> 12    all  728      4       1 1.49450641 0.47757904 0.798897218 2.7957907
#> 13    all  883      3       1 1.83396957 0.58278847 0.983789348 3.4188664
#> 14    all 1010      2       0 1.83396957 0.58278847 0.983789348 3.4188664
#> 15    all 1022      1       0 1.83396957 0.58278847 0.983789348 3.4188664