Cox proportional-hazards regression by maximum partial likelihood, Breslow or Efron ties, version 1.0.3
stats-cox-regression@1.0.3: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.
What this page can and cannot show
Level: Checked against a reference; statsmodels 0.15.0, Therneau and Rossi printed fits; monotone rule our derivation; strata no printed source. Reference kind: an outside program, statsmodels PHReg; SciPy; mpmath (tolerances), statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1; another program's fit of our model; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, Newton-Raphson in double precision by the record's stopping rule, polished in mpmath 1.4.1 at 60 digits and rounded once; the cone and rank decisions in exact rationals; not an outside program.
Checked by this project, not independently reviewed. Every method on this page has its equations, constants, sources and cases on record, and its cases agree with the stated reference within the stated tolerance. A reader can follow each method's worked example by hand; that shows the stated method gives the stated answer for one set of inputs, and does not test the code. The other cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed them.
Every version of this method · Every method · What the levels mean
Version 1.0.3
Level: Checked against a reference; statsmodels 0.15.0, Therneau and Rossi printed fits; monotone rule our derivation; strata no printed source. Reference kind: an outside program, statsmodels PHReg; SciPy; mpmath (tolerances), statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1; another program's fit of our model; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, Newton-Raphson in double precision by the record's stopping rule, polished in mpmath 1.4.1 at 60 digits and rounded once; the cone and rank decisions in exact rationals; not an outside program. stats-cox-regression@1.0.3
Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.
Verification statement: Partial likelihood, Breslow and Efron ties and Newton–Raphson as in Therneau's survival validation vignette (survival 3.8-12, re-read at source 14 November 2026), whose Test data 1 values it reproduces; the printed Efron LL −3.358979 is a misprint for −3.358975. The forms for several covariates, the Wald, score and likelihood-ratio tests and the Wald intervals are standard forms, not in the vignette. Compared with statsmodels 0.15.0 PHReg (every output on the `-1` cases; the log partial likelihood at 0 and at the fit on 32 cases in `-3`), Fox and Weisberg's printed Rossi fit, and a second implementation in Python by a separate agent of the same model family (79 cases, 28 at the edges). Monotone likelihood is our derivation, for Breslow and Efron only. Strata have no printed source.
From each subject's time to event or censoring, numeric covariates, factors and optional strata, the maximum partial-likelihood coefficients of the Cox model with SE from the observed information, Wald z, p and intervals, hazard ratios, the log partial likelihood at β = 0 and at the fit, and the likelihood-ratio, Wald and score tests; monotone likelihood refused before fitting.
- How results are reported: estimates, SE, z, p, the log partial likelihoods and the tests in full double precision; no baseline survival, no proportional-hazards test, no concordance
- Uncertainty: Wald intervals from the observed information; their coverage is not checked (few events, near monotone likelihood).
- Iterates: newton, at most 100 iterations
- Computes through this project's own routines: the rank test on the chain of difference rows (through the GLM engine's designCondition); the Wald interval's z quantile; the equilibrated information's Cholesky factor (positive definiteness, the condition check, the Newton step); the Newton step and the score test's I⁻¹U; the inverse information for the SE and the condition number; the Wald test's two-sided p; the global tests' p on p df
- Reference, as its record states it: statsmodels 0.15.0 PHReg, Fox and Weisberg's and Therneau's printed values, and a second implementation in Python
- Level confirmed by this project's ruling of 21 November 2026
What this page can and cannot show
What was checked
132 cases in 3 files, linked by this exact version.
Run through the tool at build against an outside program, statsmodels PHReg; SciPy; mpmath (tolerances), statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1; another program's fit of our model; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, Newton-Raphson in double precision by the record's stopping rule, polished in mpmath 1.4.1 at 60 digits and rounded once; the cone and rank decisions in exact rationals; not an outside program: 86 agree within the tolerance the file states, 46 refuse as the case expects, 0 differ, 0 were not run.
File 1, 49 cases
- Where the expected values came from: an outside program, statsmodels PHReg; SciPy; mpmath (tolerances) statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1
- Recorded on: 2026-11-10
- Reference: statsmodels PHReg; SciPy; mpmath (tolerances), statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1; licence BSD-3-Clause
- Tolerance as the file states it: estimates, SE, z, limits, hazard ratios, log partial likelihoods and test statistics relative max(1e-9, 10 × statsmodels' measured error against the 50-digit solve) per case (where units differ under one path, absolute: the larger of that size of the smallest magnitude and 100 × the measured error times the largest, an interval limit's magnitude being |estimate| + half-width; the log partial likelihoods absolute at that size of their magnitude); a coefficient's p that times (z_max² + 1), a test's p that times (x_max/2 + df + 1), a hazard ratio that times max(1, |ln ratio|), their sensitivities; no absolute rule looser than 1e-7 relative on any value it governs; Fox and Weisberg's and Therneau's printed values at half a unit of their print; counts, df, events per coefficient, names, codes and statuses exact
File 2, 4 cases
- Where the expected values came from: another program's fit of our model
- Recorded on: 2026-11-10
- Reference: in-house 50-digit solve (mpmath), statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1; licence BSD-3-Clause
- Tolerance as the file states it: every value relative 1e-9 against the in-house 50-digit solve (the log partial likelihoods absolute at 1e-9 of their magnitude); a coefficient's p that times (z_max² + 1), a test's p that times (x_max/2 + df + 1), a hazard ratio that times max(1, |ln ratio|); counts, df, events per coefficient, names, codes and statuses exact
File 3, 79 cases
- Where the expected values came from: an outside program, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only) 2026-11-14
- Recorded on: 2026-11-14
- Reference: second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14; licence BSD-3-Clause
- Tolerance as the file states it: every number relative 1e-8 (absolute 1e-12 below 1e-4, in its own unit; p absolute 1e-307 below 1e-297); counts, df, statuses, codes and strings exact
Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.
What was not checked
The monotone-likelihood condition is derived for Breslow and Efron only; it does not hold for the exact or discrete partial likelihood. Therneau's printed Efron LL(β̂) for Test data 1 (−3.358979) is a misprint for −3.358975 and is not asserted. An undecided monotone-likelihood test (300 exact pivots) and non-convergence are internal invariants that return an error and no number; if any input reaches the first it becomes the declared refusal SEPARATION_UNDECIDED with Drybench's pre-agreed text (the Cox caps ruling, A2), with that input as its fixture; the Wald intervals' coverage at few events or near monotone likelihood; strata against a printed source (statsmodels, the 50-digit solve and a metamorphic case only); time-varying covariates, (start, stop] input, case weights, robust or clustered SE, frailty, exact or discrete ties, Firth's penalty, residuals, baseline survival and concordance; Cox 1972, Breslow 1974, Efron 1977 and Heinze and Schemper 2001 not read. Fox and Weisberg's appendix (the printed Rossi fit) was read on 11 November 2026 and not re-read in the D-0219 full check.
Equations
Equation 1
at each event time t in a stratum, with risk set R (every subject in that stratum with time ≥ t
a subject censored at t is at risk) and d tied events D: Breslow ℓ += Σ_D x′β − d·log Σ_R exp(x′β)
Efron ℓ += Σ_D x′β − Σ_{k=0}^{d−1} log(Σ_R exp(x′β) − (k/d)·Σ_D exp(x′β))
with wⱼ = exp(xⱼ′β) and, for the k-th tied draw, S0ₖ = Σ_R w − cₖΣ_D w, S1ₖ = Σ_R w·x − cₖΣ_D w·x, S2ₖ = Σ_R w·xx′ − cₖΣ_D w·xx′ (Efron cₖ = k/d
Breslow cₖ = 0): U += Σ_D x − Σₖ S1ₖ/S0ₖ and I = −∂²ℓ/∂β∂β′ += Σₖ (S2ₖ/S0ₖ − (S1ₖ/S0ₖ)(S1ₖ/S0ₖ)′), k = 0 … d − 1
no intercept (it is absorbed into the baseline hazard). Status 1 is the event and 0 censoring. The design X is that of the binomial and Poisson records without the intercept: covariates in the order given (value, or log10 on 'log10'), then each factor's non-reference levels sorted by name as 0/1 indicators
strata enter only through the risk sets. The matrix forms S1 and S2 for several covariates are the record's extension of the vignette's one-covariate source
| Symbol | Meaning and unit |
|---|---|
| x′β | linear predictor |
| d | tied events at t (a count) |
| x | a subject's row of the design |
| β | coefficients |
| t | an event time (in the caller's time unit), as-given |
| R, D | the risk set and the tied events at t |
| S0ₖ, S1ₖ, S2ₖ | weighted sums over the risk set, as defined in the text |
| U, I | score vector and observed information |
Source: Therneau TM. Software validation. Vignette of the R survival package, Dec 2022 (updated), section §2, eqs. (1)–(5); §3.1 (Breslow, Test data 1, the censored subject at risk at t = 1); §3.2 (Efron as sequential draws, the tied subjects at weight 1/2 for the second), the vignette as shipped with survival 3.8-12 on CRAN; read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c111e13904a7. Free to read (LGPL-2 or later (the survival package)), checked 2026-11-11. No erratum found (searched the survival package's CRAN page (version 3.8-12, 2026-09-09)), 2026-11-11.
Equation 2
Newton–Raphson from β = 0
stop when the Newton decrement UᵀI⁻¹U ≤ 1e-20, taking that last step too (the information re-evaluated there)
at most 100 iterations
a step is halved, at most 10 times, while ℓ falls by more than 64·ε·|ℓ| (Drybench ruling, 10 November 2026, J4.3)
covariates centred by their means and exp(x′β) held relative to a running maximum over the risk set (J4.1)
| Symbol | Meaning and unit |
|---|---|
| decrement | UᵀI⁻¹U |
Source: Therneau TM. Software validation. Vignette of the R survival package, Dec 2022 (updated), section §3.1: the Newton–Raphson increments −H⁻¹U from β = 0 (the first iterate 8/5 for Test data 1); the stopping rule, caps, centring and rescale are the library's own, stated, the vignette as shipped with survival 3.8-12 on CRAN; read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c111e13904a7. Free to read (LGPL-2 or later (the survival package)), checked 2026-11-11. No erratum found (searched the survival package's CRAN page (version 3.8-12, 2026-09-09)), 2026-11-11.
Equation 3
Our derivation, published source not yet read (Drybench ruling, 10 November 2026, K2): no finite maximum exists exactly when some δ ≠ 0 has (x_i − x_j)′δ ≥ 0 for every event i and every j in its risk set (the same cone for Breslow and Efron)
decided exactly on an O(n) chain of difference rows (each event time's representative against the other tied events, the next time's representative and the censored subjects between) with the separation LP
rank first on the same rows
| Symbol | Meaning and unit |
|---|---|
| δ | a direction in coefficient space |
Source: Therneau TM. Software validation. Vignette of the R survival package, Dec 2022 (updated), section §3.3 (pp. 9–10): an infinite MLE under the exact partial likelihood, which this method does not offer: Test data 1 is finite under Breslow and Efron (§3.1, §3.2) and infinite under the exact likelihood, so the condition is specific to the ties method; the condition here is the library's derivation for Breslow and Efron only, the vignette as shipped with survival 3.8-12 on CRAN; read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c111e13904a7. Free to read (LGPL-2 or later (the survival package)), checked 2026-11-11. No erratum found (searched the survival package's CRAN page (version 3.8-12, 2026-09-09)), 2026-11-11.
Equation 4
Standard forms, not in the vignette: Wald β̂ᵀI(β̂)β̂, score U(0)ᵀI(0)⁻¹U(0), likelihood ratio 2(ℓ(β̂) − ℓ(0)), each on p df against the χ² upper tail
stratified when strata are given
SE = √diag I(β̂)⁻¹ (the observed information)
per coefficient z = β̂/SE, p = 2(1 − Φ(|z|)), interval β̂ ± z₍₁₊ₗ₎/₂·SE, hazard ratio exp(β̂) with limits exp of the interval's
eventsPerCoefficient = events/p
| Symbol | Meaning and unit |
|---|---|
| p | coefficients (a count) |
| z₍₁₊ₗ₎/₂ | the standard normal quantile Φ⁻¹((1 + l)/2), l the caller's level |
| Φ | the standard normal distribution function |
| ℓ | the log partial likelihood |
Source: Therneau TM. Software validation. Vignette of the R survival package, Dec 2022 (updated), section §2 (U and the Hessian H); §3.1 and §3.2 (U(0), H(0), H(β̂) for Test data 1); the Wald, score and likelihood-ratio tests, the χ² p and the Wald intervals are standard forms, not in the vignette, the vignette as shipped with survival 3.8-12 on CRAN; read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c111e13904a7. Free to read (LGPL-2 or later (the survival package)), checked 2026-11-11. No erratum found (searched the survival package's CRAN page (version 3.8-12, 2026-09-09)), 2026-11-11.
Conventions
What each mode computes:
ties = breslow: Each of the d events tied at one time enters the partial likelihood over the whole risk set at that time, as if no tied subject left the risk set before the others.ties = efron: The d events tied at one time are treated as occurring in an unknown order: for the k-th of them (k = 0, …, d − 1), the risk-set sum is reduced by k/d of the tied subjects' sum.
Constants
Constants: none used.
Worked example
Worked example: one case of stats-cox-regression@1.0.3, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- ties = breslow
- response.time[0] = 1 d
- response.time[1] = 1 d
- response.time[2] = 6 d
- response.time[3] = 6 d
- response.time[4] = 8 d
- response.time[5] = 9 d
- response.status[0] = 1
- response.status[1] = 0
- response.status[2] = 1
- response.status[3] = 1
- response.status[4] = 0
- response.status[5] = 1
- response.eventLabel = death
- replicates = independent
- level = 0.95
- covariates[0].name = x
- covariates[0].values[0] = 1
- covariates[0].values[1] = 1
- covariates[0].values[2] = 1
- covariates[0].values[3] = 0
- covariates[0].values[4] = 0
- covariates[0].values[5] = 0
- covariates[0].scale = linear
Steps
- r = 4.3722813, from response.time, response.status, covariates; by equation 1.
- estimate = 1.4752849, from r; by equation 1; gives coefficients[0].estimate.
- information = 0.63416814, from r; by equation 4.
- se = 1.2557344, from information; by equation 4; gives coefficients[0].se.
- z = 1.1748383, from estimate, se; by equation 4; gives coefficients[0].z.
- hazard-ratio = 4.3722813, from r; by equation 1; gives coefficients[0].hazardRatio.estimate.
The working, as the case writes it:
statsmodels' largest relative error against the 50-digit solve on beta and SE: 1.51e-16
the case tolerance is relative max(1e-9, 10 × that)
effective relative bound under the absolute rules 0.0e+00 (at most 1e-7)
Answer
coefficients[0].estimate= 1.4752849coefficients[0].se= 1.2557344coefficients[0].z= 1.1748383coefficients[0].hazardRatio.estimate= 4.3722813
Where these values came from: an outside program, statsmodels PHReg; SciPy; mpmath (tolerances) statsmodels 0.15.0; scipy 1.18.1; mpmath 1.4.1; Therneau, Software validation (survival package vignette, Dec 2022), section 3.1: beta and the log partial likelihoods at their printed precision; the score statistic U(0)^2/H(0) exact from the printed U(0) and H(0) (1 and 0.625: 1.6); the rest statsmodels 0.15.0.
At build the tool returned this answer within the tolerance the file states: estimates, SE, z, limits, hazard ratios, log partial likelihoods and test statistics relative max(1e-9, 10 × statsmodels' measured error against the 50-digit solve) per case (where units differ under one path, absolute: the larger of that size of the smallest magnitude and 100 × the measured error times the largest, an interval limit's magnitude being |estimate| + half-width; the log partial likelihoods absolute at that size of their magnitude); a coefficient's p that times (z_max² + 1), a test's p that times (x_max/2 + df + 1), a hazard ratio that times max(1, |ln ratio|), their sensitivities; no absolute rule looser than 1e-7 relative on any value it governs; Fox and Weisberg's and Therneau's printed values at half a unit of their print; counts, df, events per coefficient, names, codes and statuses exact.
Who worked this case: not recorded.
What it refuses, and its input ranges
NO_EVENTS_TOTAL: no subject had the event Next: No change of input makes this computable on these data.TOO_FEW_EVENTS: fewer events than one more than the coefficients (events < p + 1), counted across strata (Drybench ruling, 10 November 2026, K5, a labelled judgement: a floor against meaningless Wald inference, not an existence rule) Next: Use fewer predictors, or combine factor levels.RANK_DEFICIENT: the chain of risk-set difference rows is rank-deficient: a predictor is a combination of others or of the strata, or varies only among subjects censored before the first event (Drybench ruling, 10 November 2026, J1, J3) Next: Remove the predictor that is a combination of the others or of the strata.DESIGN_ILL_CONDITIONED: the reciprocal 1-norm condition of the information, equilibrated by powers of two on its diagonal, is below 1e-5 at β = 0 or at the fit, or the information loses positive definiteness during the fit (Drybench ruling, 10 November 2026, J3, a labelled judgement) Next: Remove a predictor that nearly duplicates another, or rescale a covariate.MLE_NOT_FINITE: the partial likelihood is monotone (some direction orders every event at its risk set's maximum), decided exactly before fitting Next: Remove or combine the predictor whose groups have no events, or use a method with a penalised likelihood.LENGTHS_DIFFER(invalid input): two columns of one call differ in lengthREFERENCE_NOT_A_LEVEL(invalid input): a factor's reference is not one of its levelsFACTOR_ONE_LEVEL(invalid input): a factor with one levelTOO_MANY_LEVELS(invalid input): a factor with more than 12 levels, or strata with more than 20 (one condition, one spelling: Drybench's Cox build ruling B1)TOO_MANY_COEFFICIENTS(invalid input): more than 20 coefficients (covariates + levels beyond each reference)NONPOSITIVE_ON_LOG(invalid input): a log10 covariate with a value at or below 0NO_PREDICTORS(invalid input): no covariate and no factor
Changes
No correction is logged for stats-cox-regression@1.0.3.
Tools that use it
Cite this version
Cox proportional-hazards regression by maximum partial likelihood, Breslow or Efron ties. Drybench; stats-cox-regression@1.0.3; https://www.drybench.com/methods/m/stats-cox-regression/1.0.3 (accessed [date]).