Returns a compact summary of a hazard object, including model metadata,
fit diagnostics, and coefficient-level statistics when available.
Usage
# S3 method for class 'hazard'
summary(object, ...)Value
An object of class summary.hazard. Its log_lik is the
log-likelihood at the estimates, and NA for a fit with
objective = "sas" that read an interval-censored row (one of positive
weight, not dropped by a phase design): there the
fitted objective is PROC HAZARD's interval-mean-hazard objective, not a
log-likelihood. That value is always in objective_value, and
objective says which of the two it is ("likelihood" or "sas").
For a Weibull fit whose scale mu, or its variance, cannot be
represented, the coefficient table has a log(mu) row under mu, with
the standard error of log(mu); it is not tested against 0.
See also
hazard() for model fitting, predict.hazard() for predictions.
vignette("fitting-hazard-models") for fitting workflows,
vignette("inference-diagnostics") for bootstrap CIs and diagnostics.
Examples
# -- Single-phase Weibull summary ------------------------------------
set.seed(1)
fit <- hazard(time = rexp(30, 0.5), status = rep(1L, 30),
theta = c(0.3, 1.0), dist = "weibull", fit = TRUE)
summary(fit)
#> hazard model summary
#> observations: 30
#> predictors: 0
#> dist: weibull
#> engine: native-r-m2
#> converged: TRUE
#> gradient: relative 4.55e-07 (SAS/C requires <= 6.06e-06; met, nlm code 1)
#> log-lik: -52.9685
#> Not done in this run: none
#> evaluations: fn=14, gr=6
#> message: continued with nlm() for 7 iterations (code 1)
#>
#> Coefficients:
#> estimate std_error z_stat p_value
#> mu 0.4431225 0.07736754 5.727499 1.019222e-08
#> nu 1.1055369 0.15224866 7.261390 3.831314e-13
# \donttest{
# -- Multiphase model summary ----------------------------------------
set.seed(42)
n <- 200
dat <- data.frame(
time = rexp(n, rate = 0.25) + 0.01,
status = rbinom(n, size = 1, prob = 0.65)
)
fit_mp <- hazard(
survival::Surv(time, status) ~ 1,
data = dat,
dist = "multiphase",
phases = list(
early = hzr_phase("cdf", t_half = 0.5, nu = 2, m = 0,
fixed = "shapes"),
late = hzr_phase("cdf", t_half = 5, nu = 1, m = 0,
fixed = "shapes")
),
fit = TRUE,
control = list(n_starts = 5, maxit = 1000)
)
summary(fit_mp)
#> Multiphase hazard model (2 phases)
#> observations: 200
#> predictors: 0
#> dist: multiphase
#> phase 1: early - cdf (early risk)
#> phase 2: late - cdf (late risk)
#> engine: native-r-m2
#> converged: TRUE
#> gradient: relative 7.38e-10 (SAS/C requires <= 6.06e-06; met, nlm code 1)
#> log-lik: -428.716
#> Not done in this run: none
#> evaluations: fn=15, gr=4
#> message: continued with nlm() for 1 iterations (code 1)
#>
#> Coefficients (internal scale):
#>
#> Phase: early (cdf)
#> estimate std_error z_stat p_value
#> log_mu -2.1153148 0.2910764 -7.267214 3.669771e-13
#> log_t_half -0.6931472 NA NA NA
#> nu 2.0000000 NA NA NA
#> m 0.0000000 NA NA NA
#>
#> Phase: late (cdf)
#> estimate std_error z_stat p_value
#> log_mu 0.5511652 0.09532805 5.781774 7.391706e-09
#> log_t_half 1.6094379 NA NA NA
#> nu 1.0000000 NA NA NA
#> m 0.0000000 NA NA NA
# }