Skip to content

Methods and validation

Every equation this site computes, where it comes from, and the published worked example the test suite reproduces it against. This page exists because of what the tools are asking you to do — put a number they produced into a manuscript with your name on it. The only honest basis for that is to show the working.

Nothing appears on this page that is not asserted by a test, and the tests run on every change. Where a method has no published worked example available, it says so rather than dressing up a self-consistency check as verification.

What the labels mean

Certified reference value
The reference value was computed in extended precision by a standards body. It is the true answer, not another program’s answer.
Published result reproduced
The reference value was published by somebody else, computed with different software. Reproducing it is evidence that both are right.
Checked against hand-worked arithmetic
The reference value was worked out by hand from the formula and the arithmetic is shown in the test. This proves the code matches the formula, not that the formula is the right one.
Internal consistency only
Two code paths that must agree, or a round trip. This catches regressions. It is not validation, and it is labelled separately so it cannot be mistaken for it.

Nonlinear least squares (Levenberg-Marquardt)

Used by both tools

Every curve on this site is fitted by Levenberg-Marquardt: an iterative method that solves the damped normal equations (JᵀWJ + λ·diag(JᵀWJ))δ = JᵀWr for a parameter step, accepting steps that reduce the weighted sum of squares and increasing the damping when they do not. Scaling the damping by the diagonal of JᵀWJ rather than adding λI is Marquardt’s own refinement, and it matters for exactly these models: a plateau parameter measured in absorbance units and a dimensionless Hill slope have diagonal entries six orders of magnitude apart, and undamped-in-one-direction is indistinguishable from not converging.

Parameter standard errors are the square roots of the diagonal of σ²(JᵀWJ)⁻¹ evaluated at the optimum, where σ² = SSE/(n − p). This is the asymptotic covariance: it is exact only for a model that is linear in its parameters, which none of these are. Where that approximation is known to be poor — the confidence interval on an IC50 from a curve with no upper plateau — a profile-likelihood interval is computed and reported alongside it, and the figure states which method produced which number.

The solver is checked against the NIST Statistical Reference Datasets for nonlinear regression, whose values are certified: computed by NIST in extended precision and rounded to eleven significant figures, so they are the true answer rather than another program’s answer. Both logistic datasets are used, from NIST’s deliberately distant starting values, and the certified parameter standard deviations are checked as well as the estimates — which tests the covariance path and not merely the optimiser.

What this should not be trusted for

  • A least-squares fit finds a local minimum. Starting values are derived from the data rather than fixed, and they are chosen so that a serial-dilution assay with plateaus on both sides converges from them reliably — but a badly truncated curve can still have more than one plausible answer, and no optimiser can tell you which one the biology intended.

Checked against

NIST StRD Rat42 (9 points, 3-parameter logistic) and Rat43 (15 points, 4-parameter asymmetric logistic).

QuantityReference valueThis implementationToleranceEvidence
Rat42 b₁ (upper asymptote)7.2462237576E+01agrees to better than 1 part in 10⁹1e-9 relativeCertified reference value
Rat42 residual sum of squares8.0565229338E+00agrees to better than 1 part in 10¹¹1e-11 relativeCertified reference value
Rat42 standard deviation of b₃3.4465663377E-03agrees to better than 1 part in 10⁸1e-8 relativeCertified reference value
Rat43 all four parameters6.996415127E+02, 5.2771253025E+00, 7.5962938329E-01, 1.2792483859E+00agrees to better than 1 part in 10⁸1e-8 relativeCertified reference value
Rat43 residual sum of squares8.786404908E+03agrees to better than 1 part in 10¹¹1e-11 relativeCertified reference value

References

  • Marquardt, D. W. (1963). An algorithm for least-squares estimation of nonlinear parameters. Journal of the Society for Industrial and Applied Mathematics 11(2), 431–441.
  • NIST/ITL Statistical Reference Datasets, Nonlinear Regression. https://www.itl.nist.gov/div898/strd/nls/nls_main.shtml

The four-parameter logistic (4PL)

Used by Dose-response (IC50)

Y = Bottom + (Top − Bottom) / (1 + 10^((LogIC50 − X) · HillSlope))     X = log₁₀(concentration)

This is the equation GraphPad Prism calls “log(inhibitor) vs. response — Variable slope”, in Prism’s own parameterisation and with Prism’s own parameter names. That choice is deliberate: it means a number produced here can be compared with a number produced there without anybody having to work out a sign convention or a change of base first. The R package drc writes the same curve with a natural logarithm and with the slope’s sign reversed, so its b is −HillSlope·ln(10) and its e is the IC50 — a mapping worth knowing if you are checking against a paper that used drc.

The fit is performed on LogIC50 rather than on IC50. Not for convenience: a concentration cannot be negative, so fitting IC50 directly means either a constrained optimiser or a fit that can wander into meaningless territory, and the log parameter is unbounded. It also makes the likelihood closer to quadratic, which is what makes the asymptotic standard error a reasonable description of the uncertainty. The consequence, which is correct and often surprises people, is that the confidence interval on the IC50 is asymmetric: it is symmetric on the log scale and back-transformed.

What this should not be trusted for

  • The Hill slope is a shape parameter, not a mechanism. A fitted slope near 1 is consistent with single-site binding and does not demonstrate it; a slope of 2 is consistent with cooperativity and also with two overlapping processes, with a mis-specified vehicle control, or with a serial dilution error.
  • An IC50 is only meaningful when the curve actually reaches both plateaus. If the highest concentration tested has not levelled off, Top and LogIC50 trade off against each other and both are extrapolations. The tool reports the correlation between them and warns when it exceeds 0.99, which is the arithmetic signature of exactly that situation.

Checked against

The `ryegrass` dataset from the R package drc: ryegrass root length against ferulic acid concentration, 24 observations at 7 concentrations. The published four-parameter log-logistic fit is reproduced through the whole pipeline — paste, parse, derive starting values, fit — not by calling the solver directly. The 24 data values were taken from the drc source distribution itself rather than transcribed from a web page.

QuantityReference valueThis implementationToleranceEvidence
ryegrass IC50 (drc calls it ED50)3.05795agrees to better than 3 parts in 10⁶2e-5 relativePublished result reproduced
ryegrass upper plateau (drc: d)7.79296agrees to better than 3 parts in 10⁶2e-5 relativePublished result reproduced
ryegrass lower plateau (drc: c)0.48141agrees to better than 3 parts in 10⁶2e-5 relativePublished result reproduced
ryegrass Hill slope (drc reports −b = 2.98222)2.98222agrees to better than 3 parts in 10⁶2e-5 relativePublished result reproduced
ryegrass residual standard error, on 20 degrees of freedom0.5196256agrees to better than 1 part in 10⁸1e-6 relativePublished result reproduced
4PL recovery from noiseless synthetic datathe generating parameters, exactlyrecovered to 1e-8 relative, R² = 11e-8 relativeChecked against hand-worked arithmetic

References

  • GraphPad Prism Curve Fitting Guide: Equation — log(inhibitor) vs. response, Variable slope. https://www.graphpad.com/guides/prism/latest/curve-fitting/reg_dr_inhibit_variable.htm
  • Ritz, C., Baty, F., Streibig, J. C. & Gerhard, D. (2015). Dose-Response Analysis Using R. PLoS ONE 10(12), e0146021.
  • Inderjit, Streibig, J. C. & Olofsdotter, M. (2002). Joint action of phenolic acid mixtures and its significance in allelopathy research. Physiologia Plantarum 114(3), 422–428. — the source of the ryegrass dataset.

The IC50 confidence interval, by profile likelihood

Used by Dose-response (IC50)

the interval is {θ : SSE(θ) ≤ SSE_min · (1 + F(1, n−p, 0.95)/(n−p))}

Two intervals are reported for the IC50 and they usually disagree, so it is worth being explicit about which is which. The asymptotic interval is estimate ± t·SE on the log scale, back-transformed. It assumes the sum-of-squares surface is a paraboloid near the optimum. For a well-sampled sigmoid with plateaus at both ends, it is close to right.

The profile-likelihood interval makes no such assumption. LogIC50 is stepped away from its fitted value; at each step the OTHER parameters are re-fitted with LogIC50 held fixed; and the interval is the range over which the resulting sum of squares stays inside the F-distributed threshold above. Where the surface is genuinely curved — which is what a truncated dose-response curve produces — the two intervals differ substantially, and the profile one is the one to quote. It can also be one-sided, correctly: a curve with no upper plateau has no finite upper confidence limit for its IC50, and reporting “not determined” for that bound is more useful than reporting the value at which the optimiser happened to stop.

Checked against

There is no published worked example of a profile-likelihood interval on an IC50 to reproduce, so what is tested is the BEHAVIOUR the method exists for: that the two intervals agree when the asymptotic assumption holds, and diverge in the specific way they should when it does not. Both figures below come from the same dataset, once complete and once with its upper plateau removed.

QuantityReference valueThis implementationToleranceEvidence
Well-sampled curve: profile half-width against asymptotic half-widththe two should agree closely0.01414 against 0.01414 decades — they differ by 0.05%asserted to agree within 10%Checked against hand-worked arithmetic
Truncated curve (no upper plateau): profile intervalmarkedly asymmetric, and wider than the asymptotic one−0.1806 / +0.4203 decades against a symmetric ±0.2501 — a 2.33× lopsidedness, with the upper bound 1.68× the symmetric claimasserted asymmetric by more than 1.5×Checked against hand-worked arithmetic
Truncated curve: correlation between Top and log IC50near 1, which is what "the parameters are trading off" looks like0.998, and the warning firesasserted above 0.99Checked against hand-worked arithmetic

References

  • Bates, D. M. & Watts, D. G. (1988). Nonlinear Regression Analysis and Its Applications. Wiley. §6.1.
  • Ritz, C. & Streibig, J. C. (2005). Bioassay analysis using R. Journal of Statistical Software 12(5).

The Kaplan-Meier product-limit estimator

Used by Kaplan-Meier survival

Ŝ(t) = ∏ over tᵢ ≤ t of (nᵢ − dᵢ) / nᵢ

The survival curve is the running product, over every time at which an event occurred, of the fraction of the risk set that survived it. nᵢ is the number still at risk immediately before tᵢ and dᵢ the number of events at tᵢ. Censored subjects leave the risk set without producing a step, which is the entire point of the estimator: somebody lost to follow-up at 14 months contributes their fourteen months of survival and nothing about what happened afterwards.

The convention for a tie between an event and a censoring at the same recorded time is that the censoring is treated as occurring immediately after. So a subject censored at t is still counted in nᵢ for an event at t. This matters more often than it sounds — study data is routinely recorded to the day or the week, so exact ties are common rather than exceptional — and the opposite convention shifts the curve visibly.

Checked against

Two datasets, both with published results. The `aml` maintenance data distributed with the R survival package (23 patients, two arms), and the Freireich et al. (1963) trial of 6-mercaptopurine against placebo in childhood leukaemia (42 patients) — the most reproduced dataset in survival analysis. The 6-MP arm’s twelve censored remission times are taken from Gehan (1965) §11, which prints them individually, rather than reconstructed from a summary table.

QuantityReference valueThis implementationToleranceEvidence
aml median survival, maintained and non-maintained31 and 23 weeks31 and 23exactPublished result reproduced
aml median 95% confidence limits, maintained armlower 18, upper not reachedlower 18, upper reported as not reachedexactPublished result reproduced
6-MP and placebo median remission23 and 8 weeks23 and 8exactPublished result reproduced
6-MP risk set at the first three event times21, then 17, then 15reproduced, which independently pins the censoring times at 6 and 9exactPublished result reproduced
6-MP cumulative failures and censorings at weeks 4, 9, 14, 19, 24 (Gehan 1965 §11’s grouped table)failures 0, 4, 6, 7, 9 and censorings 0, 2, 4, 6, 7 against placebo failures 7, 13, 17, 19, 21all fifteen counters reproduced exactlyexactPublished result reproduced

References

  • Kaplan, E. L. & Meier, P. (1958). Nonparametric estimation from incomplete observations. Journal of the American Statistical Association 53(282), 457–481.
  • Freireich, E. J. et al. (1963). The effect of 6-mercaptopurine on the duration of steroid-induced remissions in acute leukemia. Blood 21(6), 699–716.
  • Gehan, E. A. (1965). A generalized Wilcoxon test for comparing arbitrarily singly-censored samples. Biometrika 52(1–2), 203–223.
  • Gehan, E. A. & Freireich, E. J. (2011). The 6-MP versus placebo clinical trial in acute leukemia. Clinical Trials 8(3), 288–297.

Greenwood’s variance, and the confidence band

Used by Kaplan-Meier survival

Var(Ŝ(t)) = Ŝ(t)² · Σ over tᵢ ≤ t of dᵢ / (nᵢ(nᵢ − dᵢ))

Greenwood’s formula is the standard variance estimator for the product-limit estimate, and the standard error it gives is what the confidence band is built from. The band is not computed on the survival scale directly, though, because an interval of Ŝ ± 1.96·SE runs outside [0, 1] wherever the curve is near either end — and a survival probability of 1.04 is not a defensible thing to draw. The interval is therefore computed on a transformed scale and mapped back, which keeps it inside the unit interval by construction.

A confidence band around a survival curve is pointwise: it is a 95% interval for the survival probability at each individual time, not a 95% region containing the whole true curve. The probability that the true curve stays inside the band everywhere is considerably less than 95%. This is a widely-made reading error and it is why the figure labels the band rather than leaving it to be inferred.

Checked against

The `aml` dataset again. Greenwood standard errors are exact closed-form quantities, so as well as reproducing what R prints, three of them are worked out by hand in the test comments — the arithmetic is written out, so the test checks the code against the formula rather than against another program.

QuantityReference valueThis implementationToleranceEvidence
Standard error at the first event, maintained arm (n = 11, d = 1)0.08670.086678417204145, i.e. (10/11)·√(1/110)exact to the published 4 significant figures; the closed form to 1e-12Checked against hand-worked arithmetic
Pooled aml, 90% plain interval at t = 5standard error 0.0588, interval 0.816 to 1.000reproduced, including the clip at 1.0004 significant figuresPublished result reproduced
Pooled aml, 90% plain interval at t = 8standard error 0.0790, interval 0.696 to 0.956reproduced4 significant figuresPublished result reproduced

References

  • Greenwood, M. (1926). The natural duration of cancer. Reports on Public Health and Medical Subjects 33, 1–26. HMSO.
  • Kalbfleisch, J. D. & Prentice, R. L. (2002). The Statistical Analysis of Failure Time Data, 2nd ed. Wiley. §1.4.

The log-rank test

Used by Kaplan-Meier survival

At each event time the test compares the events observed in each group with the number expected if survival were identical across groups, given the sizes of the risk sets at that moment. Summing those differences and standardising by their covariance gives a statistic that is chi-square distributed with one fewer degree of freedom than there are groups.

The test asks one question — are these curves the same? — and answers only that. It gives no effect size, and it has most of its power when the hazard ratio is roughly constant over time. Two curves that cross can produce a thoroughly non-significant log-rank p-value while being obviously and importantly different, because the early and late differences cancel in the sum. A p-value from this test should always be read next to the curves, never instead of them.

What this should not be trusted for

  • The test is unadjusted. It compares whole groups and knows nothing about age, stage, batch or any other covariate, so it cannot separate a treatment effect from a difference in who ended up in which group. That is a job for a proportional-hazards model, which this tool does not fit.

Checked against

Both survival datasets. The k-group quadratic form is the only code path, even for two groups, so these two-group benchmarks also validate the covariance matrix that a three-group comparison depends on.

QuantityReference valueThis implementationToleranceEvidence
aml observed events, maintained and non-maintained7 and 117 and 11exactPublished result reproduced
aml expected events under the null10.69 and 7.3110.69 and 7.31the 2 decimals the source printsPublished result reproduced
aml log-rank chi-square, 1 degree of freedom3.43.396389the 2 significant figures the source printsPublished result reproduced
aml log-rank p-value0.06530.06533934 decimal placesPublished result reproduced
6-MP against placebo, log-rank chi-square16.7916.792942 decimal placesPublished result reproduced
Three groups, two of them identical, collapsed back to twothe same score and covariance as the two-group comparisonagrees to 1e-10 — the score is linear and the covariance bilinear under merging1e-10Internal consistency only

References

  • Mantel, N. (1966). Evaluation of survival data and two new rank order statistics arising in its consideration. Cancer Chemotherapy Reports 50(3), 163–170.
  • Peto, R. & Peto, J. (1972). Asymptotically efficient rank invariant test procedures. Journal of the Royal Statistical Society A 135(2), 185–207.

The Gehan-Breslow-Wilcoxon test

Used by Kaplan-Meier survival

U = Σ over event times of nₜ·(d₁ₜ − dₜ·n₁ₜ/nₜ)

The same accumulation as the log-rank, with each event time weighted by the number of subjects still at risk at that moment rather than weighted equally. Early times, when the risk set is large, therefore count for more — which makes this the more powerful test when the curves separate early and converge later, and the less powerful one when a constant hazard ratio holds throughout. Which of the two to use is a decision about where the difference is expected to be, and it has to be made before either p-value is seen; both are printed on the figure precisely so that neither can be quietly swapped in after the fact.

That weight is not an arbitrary choice of emphasis. With wₜ = nₜ the score collapses to an exact identity: it becomes Gehan’s W statistic, the sum over every pair of subjects — one from each group — of +1 when the first demonstrably outlived the second, −1 for the reverse, and 0 when the censoring pattern leaves the pair unorderable. On uncensored data that is the ordinary Wilcoxon rank-sum test, which is where the name comes from. The identity is what this implementation is validated against: Gehan’s 1965 paper works his test through on the 6-MP data used elsewhere on this page and prints W = 335 − 64 = 271, which the score reproduces exactly.

The variance is a different matter, and the distinction matters enough to state plainly. Gehan’s original refers W to a permutation distribution: the variance of W over all the ways the observed pattern of failures and censorings could have been split between two groups of the given sizes. What this tool computes — and what “Gehan-Breslow-Wilcoxon” denotes in Prism and in SAS PROC LIFETEST — is the sum of per-event-time hypergeometric variances, the same covariance the log-rank uses with the weights squared into it. The two are different null distributions for the same statistic, not two attempts at one number, and they do not agree to the printed digits: on Gehan’s own worked example his variance gives chi-square 13.01 and this one gives 13.46.

What this should not be trusted for

  • The chi-square this tool reports is not the number Gehan’s 1965 paper would give for the same data, and the difference is the variance rather than the statistic: his permutation variance against the hypergeometric one used here and by the standard packages. On his worked example that is 13.01 against 13.46 — the same conclusion by a wide margin, but not the same figure, and a manuscript quoting one against a reader recomputing the other should know which is which.
  • Two tests of one null hypothesis appear on the figure. Reporting whichever of them came out smaller is not a test of anything, and no amount of labelling in this tool can prevent it; the choice belongs to the analysis plan, not to the output.
  • The weighting makes the test sensitive to early differences and correspondingly blind to late ones. A treatment whose benefit only appears after two years can produce a thoroughly non-significant Gehan-Breslow p-value on data where the log-rank sees the effect clearly.

Checked against

Gehan’s own worked example, §11 of the 1965 paper: the Freireich et al. 6-mercaptopurine trial, 21 patients per arm, twelve censored on 6-MP and none on placebo. It is the example the test was introduced with, so the intermediate quantities are printed as well as the answer, and the intermediate ones are asserted here too.

QuantityReference valueThis implementationToleranceEvidence
Gehan’s W statistic over all 441 pairwise comparisons335 − 64 = 271the weighted score is −271 exactly (the sign is the events-minus-expected convention, not a discrepancy)1e-9Published result reproduced
The three column sums of the paper’s grouped variance table6860, 7180 and 6300all three reproduced from the paper’s formula (4.3)exact integersPublished result reproduced
Gehan’s permutation standard deviation, ungrouped data75.175.129, from his formula (4.3) implemented in the test filethe 3 significant figures the source printsPublished result reproduced
Gehan’s normal deviate Z, ungrouped data3.613.6071 — this tool’s score referred to Gehan’s own variancethe 3 significant figures the source printsPublished result reproduced
This tool’s chi-square on the same data (hypergeometric variance)no published value exists for this variant of the test13.457852, recomputed in the test by a scalar loop that touches neither the covariance matrix nor the solver1e-10 between the two code pathsInternal consistency only

References

  • Gehan, E. A. (1965). A generalized Wilcoxon test for comparing arbitrarily singly-censored samples. Biometrika 52(1–2), 203–223.
  • Breslow, N. (1970). A generalized Kruskal-Wallis test for comparing K samples subject to unequal patterns of censorship. Biometrika 57(3), 579–594.
  • Tarone, R. E. & Ware, J. (1977). On distribution-free tests for equality of survival distributions. Biometrika 64(1), 156–160.