glance()

Return a one-row model-summary DataFrame for a fitted model.

Usage

Source

glance(
    model,
    **kwargs,
)

Produces a single row of model-level statistics such as the number of observations, number of events, log-likelihood, AIC, and concordance. This is the Python equivalent of R’s broom::glance().

Parameters

model: object

A fitted Greenwood estimator (e.g., CoxPH, AFT, Parametric).

**kwargs: Any
Forwarded to the registered adapter. Common options include format=.

Returns

DataFrame
A one-row model-level summary.

Examples

Glance at a fitted Cox model for its overall fit statistics:

import greenwood as gw

# Load data, build a right-censored response, and fit a Cox model
lung = gw.load_dataset("lung", backend="polars")
y = gw.Surv.right(lung["time"], event=(lung["status"] == 2))
cox = gw.CoxPH().fit(y, covariates=lung[["age", "sex"]])

# Glance at overall model-fit statistics
gw.glance(cox, format="polars")
shape: (1, 10)
nneventloglikaiclr_statisticdflr_p_valuefrailty_thetafrailty_lrt_statisticfrailty_lrt_p_value
i64i64f64f64f64i64f64nullnullnull
228165-742.8482461489.69649214.12311120.000857nullnullnull