# Survival analysis

`stats_survival_analysis` · Runs: Built, not hosted · Level: Checked against a reference: R 4.4.3 survival 3.8-3

Works out the Kaplan-Meier estimate and median survival per group, and tests across groups.

Research and education software; not medical advice, and not for diagnosis or treatment decisions. It computes from the inputs it receives. It does not check the person's data, design or sample.

[Catalogue](https://www.drybench.com/mcp/catalogue) / [Statistics](https://www.drybench.com/mcp/catalogue/statistics)

[Ask your assistant](https://www.drybench.com/mcp/connect) · [Open in Drybench Assay](https://www.drybench.com/assay/app)

```cite
Survival analysis (stats_survival_analysis), Drybench MCP server 1.0.0; kaplan-meier@1.0.0 (Checked against a reference); median-survival@1.0.0 (Checked against a reference); survival-tests@1.0.1 (Checked against a reference); log-rank-hazard-ratio@1.0.0 (Checked against a reference); https://www.drybench.com/mcp/tools/stats-survival-analysis
```

## What it is

Required: unit (independent, not-independent, unspecified); test (log-rank, gehan-breslow). Time-to-event analysis per group: Kaplan-Meier estimate, Greenwood variance and log-log pointwise band, median survival with interval, log-rank or Gehan-Breslow comparison, and two-group log-rank hazard ratio. Bands, median intervals, group test, and hazard ratio require independent units and n >= 3 per group.

Field: [Statistics](https://www.drybench.com/mcp/catalogue/statistics). It is the same calculation as [Drybench Assay](https://www.drybench.com/assay/app), called by an AI assistant through the server.

## What it does

**You give**

- `groups` (required): Groups, each with name and non-empty subjects array.
- `unit` (required): Experimental unit: 'independent' (opens bands, intervals, test, hazard ratio), 'not-independent', or 'unspecified'.
- `test` (required): Between-group survival test: 'log-rank' or 'gehan-breslow'.
- `reference`: Optional 0-based index of hazard-ratio reference group.
- `level`: Confidence coverage level for intervals (0.9, 0.95 default, or 0.99).
- `timeUnit`: Time unit in UCUM ('as-given' default).

**A request and its answer**

Asked with

- `unit`: independent
- `level`: 0.95
- `test`: gehan-breslow
- `reference`: 0
- `timeUnit`: as-given

It answered (computed)

- `coverage`: 0.95
- `independent`: yes
- `timeUnit`: as-given

Computed by this tool when the page was built. The steps between are not recorded, so this is not a worked example. The reply carries more values than are shown here. One answer to one request, not a reference value.

**Limits**

- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
- No other limit is recorded for this tool.

Every reply also carries its app's limits line: "A C50 estimated here describes this assay under these conditions and is not a binding constant."

### Every input, with its units

6 inputs

- `groups` (required): Groups, each with name and non-empty subjects array.
- `unit` (required): Experimental unit: 'independent' (opens bands, intervals, test, hazard ratio), 'not-independent', or 'unspecified'.
- `test` (required): Between-group survival test: 'log-rank' or 'gehan-breslow'.
- `reference`: Optional 0-based index of hazard-ratio reference group.
- `level`: Confidence coverage level for intervals (0.9, 0.95 default, or 0.99).
- `timeUnit`: Time unit in UCUM ('as-given' default).

## The calculation

4 methods, each with its equations, constants and worked example.

### [Kaplan–Meier estimate with Greenwood's variance and a log-log pointwise band](https://www.drybench.com/methods/m/kaplan-meier/1.0.0)

`kaplan-meier@1.0.0`

No equation is recorded for this version.

Kind of method: not recorded.

Worked example: not recorded for kaplan-meier\@1.0.0.

### [Median survival, with its interval from the pointwise band](https://www.drybench.com/methods/m/median-survival/1.0.0)

`median-survival@1.0.0`

No equation is recorded for this version.

Kind of method: not recorded.

Worked example: not recorded for median-survival\@1.0.0.

### [Log-rank and Gehan–Breslow–Wilcoxon tests](https://www.drybench.com/methods/m/survival-tests/1.0.1)

`survival-tests@1.0.1`

No equation is recorded for this version.

Kind of method: not recorded.

Worked example: not recorded for survival-tests\@1.0.1.

### [Hazard ratio, one-step log-rank estimate](https://www.drybench.com/methods/m/log-rank-hazard-ratio/1.0.0)

`log-rank-hazard-ratio@1.0.0`

No equation is recorded for this version.

Kind of method: not recorded.

Worked example: not recorded for log-rank-hazard-ratio\@1.0.0.

## Sources

No source is recorded for this tool's methods.

Read by AI-assisted sessions. No person has checked these readings.

## How it is checked

**Level:** Checked against a reference, the lowest of its 4 methods.

**Checked against:** Kaplan–Meier estimate with Greenwood's variance and a log-log pointwise band: R 4.4.3 survival 3.8-3 (survfit with the log-log band) on the 34 cases of the 0.11.0 fixture: S(t), its standard error and the band within 1e-10 relative; times, numbers at risk, events, censorings, the risk table, refused rows and withheld states exact. Inside R the risk table equals sum(time ≥ t) on all 61 groups checked (2026-10-13). Median survival, with its interval from the pointwise band: R 4.4.3 survival 3.8-3 (quantile.survfit on the log-log band) on the 33 cases of the 0.11.0 fixture with a curve: the median and its bounds within 1e-10 relative, bounds not reached and withheld states exact (2026-10-13). Log-rank and Gehan–Breslow–Wilcoxon tests: R 4.4.3 survival 3.8-3 (survdiff with rho = 0; Gehan–Breslow–Wilcoxon weighted by n\_j by hand in R) on the 34 cases of the 0.11.0 fixture, 21 with a test (15 log-rank, 6 Gehan–Breslow–Wilcoxon): χ² and the expected counts within 1e-9 relative, p within 1e-8 relative, observed counts, df, the few-events flag and withheld states exact. Inside R, unit weights reproduce survdiff on all 26 cases checked, and the Gehan–Breslow–Wilcoxon score equals n\_A·n\_B − 2W on the case without censoring (2026-10-13). The 0.17.0 supplemental set adds 14 exact-rational survival cases for SCI-197, including zero-degree-of-freedom refusal and tied-censoring controls (25 October 2026; no R cross-check). Hazard ratio, one-step log-rank estimate: R 4.4.3 survival 3.8-3 (exp((O − E)/V) from survdiff's observed, expected and variance) on the 34 cases of the 0.11.0 fixture, 18 with an estimate: the hazard ratio and its bounds within 1e-9 relative, the groups compared and withheld states exact. R's coxph (Efron ties) is recorded beside it, not compared (2026-10-13).

**Cases:** Kaplan–Meier estimate with Greenwood's variance and a log-log pointwise band: No case set is linked to this version. Median survival, with its interval from the pointwise band: No case set is linked to this version. Log-rank and Gehan–Breslow–Wilcoxon tests: No case set is linked to this version. Hazard ratio, one-step log-rank estimate: No case set is linked to this version.

**Hostile inputs:** Sent 115 malformed, extreme and misspelt calls. None broke it, and every call with an undeclared argument, or with text in place of a number or a true/false value, was declined with a reason. Run 2026-11-12-2 of 12 November 2026, server 0.11.0.

**Same answer:** Called twice and with its arguments in another order, it gave the same result. Run 2026-11-12-2 of 12 November 2026, server 0.11.0.

**Not checked:** Kaplan–Meier estimate with Greenwood's variance and a log-log pointwise band: Not recorded. Its absence does not mean everything was checked. Median survival, with its interval from the pointwise band: Not recorded. Its absence does not mean everything was checked. Log-rank and Gehan–Breslow–Wilcoxon tests: Not recorded. Its absence does not mean everything was checked. Hazard ratio, one-step log-rank estimate: Not recorded. Its absence does not mean everything was checked.

No independent scientist has yet reviewed this.

### What this project's records still lack

5 things

- A case worked by hand from the source's equation for all four methods.
- The equation for all four methods.
- The constants with their sources for all four methods.
- A case set linked to this version for all four methods.
- A record of what was not checked for all four methods.

### Cite a number from this tool

the cite line

Every reply carries a cite line naming the tool, the server version, each method with its version and level, and the receipt. Quote it with any number taken from the reply.

```cite
stats_survival_analysis, server 1.0.0; kaplan-meier@1.0.0 (Checked against a reference); median-survival@1.0.0 (Checked against a reference); survival-tests@1.0.1 (Checked against a reference); log-rank-hazard-ratio@1.0.0 (Checked against a reference); receipt 642348c2f198/a26a6f47e18d; methods https://www.drybench.com/methods/assay; page https://www.drybench.com/methods/tools/stats-survival-analysis. Quote this line with any number taken from this reply.
```

### Changes to its methods

0 changes

No change is logged for these method versions.
