Confidence Intervals¶
synfit reports 95% confidence intervals on both individual parameters and the fitted curve for single-drug analyses.
Parameter Confidence Intervals¶
After fitting, each parameter (IC₅₀, Hill, effect₀, effect∞) is reported with a 95% CI:
where \(\text{SE}(\hat{\theta}_i) = \sqrt{\text{Cov}(\hat{\theta})_{ii}}\) and \(z_{0.975} \approx 1.96\).
IC₅₀ / EC₅₀¶
The potency parameter is optimized in log-space (\(\log_{10}\text{C}_{50}\)), so the CI is first computed on the log scale and then transformed back:
This yields an asymmetric CI in linear space, which is the correct behaviour — potency estimates are right-skewed.
Curve Confidence Band¶
The dose-response plot shows a shaded region around the fitted curve representing the 95% confidence band. This is computed using the delta method:
where \(\mathbf{J}(x)\) is the Jacobian (row vector of partial derivatives of the Hill curve with respect to each fitted parameter, evaluated at concentration \(x\)).
The band is:
When a Gaussian linear or quadratic variance model is active, the displayed band is a prediction band: observation noise \(\sigma^2(\hat{y})\) is added inside the square root. That variance is anchored at the lower asymptote.
Analytic Jacobian¶
For efficiency and numerical stability, the Jacobian is computed analytically rather than by finite differences. Defining:
the partial derivatives for the 4-parameter model are:
| Parameter | \(\partial \hat{y} / \partial \theta\) |
|---|---|
effect_0 |
\(1 - f\) |
effect_inf |
\(f\) |
log_c50 |
\(-(\text{effect}_0 - \text{effect}_\infty) \cdot s \cdot \text{hill} \cdot \ln 10 \cdot g\) |
hill |
\(-(\text{effect}_0 - \text{effect}_\infty) \cdot s \cdot \ln 10 \cdot g \cdot (\log_{10}\text{C}_{50} - \log_{10} x)\) |
For the 5-parameter model, an additional term for the asymmetry parameter \(s\) is included.
Covariance Estimation¶
The parameter covariance matrix is estimated from the observed Fisher information at the optimum:
where \(\mathbf{H}\) is the Hessian of the negative log-likelihood (data term only, excluding the soft boundary prior). The Hessian is computed via central finite differences at the MLE.
The Hessian is evaluated under the active error and variance model. For example, a Gaussian fit with a linear or quadratic \(\sigma^2(\mu)\) model uses that fitted weighting when estimating parameter covariance; a lognormal fit estimates covariance in log-response likelihood space.
If the Hessian is singular or the resulting covariance has negative diagonal entries (non-positive-definite), CIs are not reported.
When CIs Are Unavailable¶
CIs may be absent when:
- The Hessian is numerically singular (nearly flat likelihood surface)
- The fit converged at or near a boundary
- The data has too few points relative to the number of parameters
In these cases, the analysis detail page shows parameter estimates without brackets.
Further Reading¶
- Wikipedia: Delta method — the propagation technique used for curve CIs and IC₅₀ transformation
- Wikipedia: Observed information — the Hessian-based covariance estimate
Implementation details
Covariance estimation (synfit.fitting.FitBase._estimate_covariance):
- Computes the Hessian of
-log_prob_data(no prior) via nestedapprox_fprimecalls with step size1e-5. - Symmetrises with
0.5 * (H + H.T). - Returns
np.linalg.inv(H)orNoneif inversion fails or any diagonal entry is negative.
Parameter CIs (synfit.data.FitResult.param_ci):
- Reads
param_covandparam_namesfrom the result. - Computes
val ± z * sqrt(diag(cov))for each parameter. - For
log_c50, adds ac50key via monotonic transform10^x.
Curve CIs (synfit.data.FitResult.predict_ci):
- Builds the analytic Jacobian matrix
J(n_conc × n_params). - Computes
var_y = einsum("ij,jk,ik->i", J, pcov, J). - Returns
(y_hat - z*std, y_hat + z*std).
Plotting (synfit.plotting.dose_response_plot):
- Calls
result.predict_ci(conc_fine)and renders the band withfill_between. - Displays parameter CIs in the annotation box if available.