A.17 Exposure–response likelihoods: curves, counts, categories and survival
What you will learn
- Write the exposure functions \(f(C)\) and the log-likelihood of each endpoint type: continuous (least squares), binary, ordinal, count, and time-to-event.
- Compute, by hand, a binary likelihood with its ROC area and Brier score, a Poisson and a negative-binomial term, an ordinal probability, a Kaplan–Meier curve with Greenwood intervals, and a Cox partial likelihood.
- Turn a fitted curve into an effect for a change in exposure, with its standard error, by the delta method.
Prerequisites: A.5, A.12 and Chapter 32.
The exposure function
Every endpoint is related to an individual's exposure \(C_i\) (an AUC, a \(C_{\max}\), an average concentration) through a linear predictor
where \(z_{ik}\) are covariates. (This \(\eta_i\) is a predictor, not a random effect; the context tells them apart.) The shapes of \(f\):
| Name | \(f(C)\) |
|---|---|
| linear | \(E_0+\beta C\) |
| log-linear | \(E_0+\beta\ln(C+\text{offset})\) |
| Emax | \(E_0+\dfrac{E_{\max}C}{EC_{50}+C}\) |
| sigmoid Emax | \(E_0+\dfrac{E_{\max}C^{\gamma}}{EC_{50}^{\gamma}+C^{\gamma}}\) |
| hockey-stick | \(E_0+\beta\max(0,\ C-C_t)\) |
\(EC_{50}\) and \(\gamma\) are estimated on the log scale (so they are positive by construction), and their intervals are transformed back: \([e^{\hat\theta-qs},\,e^{\hat\theta+qs}]\). Models without an intercept (proportional odds, Cox) omit \(E_0\). A log-linear model drops subjects with \(C+\text{offset}\le0\) (the placebo subjects), is then fitted to fewer subjects, and is therefore not ranked against the others.
The fraction of the maximal effect at exposure \(C\) is \(100\,C/(EC_{50}+C)\) for an Emax curve: at \(C=EC_{50}/2\), \(EC_{50}\), \(2EC_{50}\) and \(5EC_{50}\) it is \(33\,\%\), \(50\,\%\), \(67\,\%\) and \(83\,\%\). Example: with \(EC_{50}=2\), the exposures \(0.5,\ 1,\ 2,\ 5\) give \(20\,\%,\ 33\,\%,\ 50\,\%,\ 71\,\%\) of \(E_{\max}\).
Continuous endpoints: least squares
Minimising the sum of squares \(\mathrm{SSR}=\sum(y_i-\hat y_i)^2\) with \(n\) subjects and \(k\) regression parameters, \(\mathrm{df}=n-k\):
with \(J\) the Jacobian of the fitted values (page A.3). Fit statistics: \(R^2=1-\mathrm{SSR}/\mathrm{SST}\), \(R^2_{\text{adj}}=1-(1-R^2)(n-1)/\mathrm{df}\), RMSE \(=\sqrt{\mathrm{SSR}/n}\); the log-likelihood \(\ell=-\tfrac n2\bigl[\ln2\pi+\ln(\mathrm{SSR}/n)+1\bigr]\); and the F test of the exposure effect
with \(\mathrm{SSR}_0\) the residual sum of squares of the model without exposure (intercept and covariates only) and \(d_1\) the number of exposure parameters. A hockey-stick threshold \(C_t\) is found by profiling \(\mathrm{SSR}(C_t)\) over a grid between the 5th and 90th percentiles of exposure and refining by golden-section search; its interval is the set of \(C_t\) values whose SSR is within \(\mathrm{SSR}_{\min}(1+F_{1,\mathrm{df}}/\mathrm{df})\).
Studentised residuals \(r_i=(y_i-\hat y_i)/\bigl(\hat\sigma\sqrt{1-h_{ii}}\bigr)\) use the leverage \(h_{ii}\), the diagonal of \(J(J^{\mathsf T}J)^{-1}J^{\mathsf T}\).
Binary, ordinal and count endpoints: likelihood
These are fitted by maximum likelihood with the covariance taken as the inverse of the observed information (a finite-difference Hessian). The contribution of subject \(i\):
| Endpoint | Log-likelihood contribution |
|---|---|
| binary (logit) | \(y_i\eta_i-\ln(1+e^{\eta_i})\) |
| ordinal (proportional odds) | \(\ln\bigl[\operatorname{expit}(\alpha_{y_i}-\eta_i)-\operatorname{expit}(\alpha_{y_i-1}-\eta_i)\bigr]\), with \(\operatorname{logit}P(Y\le j)=\alpha_j-\eta_i\) and ordered cut-points \(\alpha_j=\alpha_{j-1}+e^{\tau_j}\) |
| count, Poisson | \(y_i\ln\mu_i-\mu_i-\ln y_i!\), \(\ \mu_i=\exp\bigl(\eta_i+\ln\text{offset}_i\bigr)\) |
| count, negative binomial (NB2), \(\kappa=e^{\tau}\) | \(\ln\Gamma(y+\kappa)-\ln\Gamma(\kappa)-\ln y!+\kappa\ln\dfrac{\kappa}{\kappa+\mu}+y\ln\dfrac{\mu}{\kappa+\mu}\) |
Over-dispersion. For a Poisson fit, \(\hat\phi=\dfrac1{n-k_p}\sum_i\dfrac{(y_i-\hat\mu_i)^2}{\hat\mu_i}\). With the default setting the covariance is multiplied by \(\hat\phi\) (a quasi-Poisson analysis) when \(\hat\phi>1.5\).
Fit statistics. Deviance \(=-2\ell\); likelihood-ratio test of the exposure effect \(\chi^2=2(\ell-\ell_0)\sim\chi^2_d\) against the model without exposure; McFadden \(R^2=1-\ell/\ell_{\text{null}}\). For a binary endpoint with fitted probabilities \(\hat p_i=\operatorname{expit}(\hat\eta_i)\),
and the Hosmer–Lemeshow statistic over deciles of \(\hat p\), \(\chi^2=\sum_g\dfrac{(O_g-E_g)^2}{E_g(1-E_g/m_g)}\) with \(\mathrm{df}=\max(G_{\text{used}}-2,1)\).
A worked illustration
Binary. Four subjects with exposures \(C=0.5,\ 1,\ 2,\ 3\), responses \(y=0,\ 0,\ 1,\ 1\), and a logit slope model \(\eta=-1.2+0.8C\) (the coefficients are illustrative, not fitted):
| \(C\) | \(y\) | \(\eta\) | \(\hat p=\operatorname{expit}\eta\) | log-likelihood term |
|---|---|---|---|---|
| 0.5 | 0 | −0.8 | 0.3100 | \(-\ln(1+e^{-0.8})=-0.3711\) |
| 1 | 0 | −0.4 | 0.4013 | \(-0.5130\) |
| 2 | 1 | 0.4 | 0.5987 | \(0.4-\ln(1+e^{0.4})=-0.5130\) |
| 3 | 1 | 1.2 | 0.7685 | \(1.2-\ln(1+e^{1.2})=-0.2633\) |
\(\ell=-1.6604\) (deviance \(3.321\)). The ranks of \(\hat p\) are \(1,2,3,4\); the two responders have ranks 3 and 4, so \(c=(7-3)/(2\times2)=1\): every responder is ranked above every non-responder. The Brier score is \(\tfrac14(0.0961+0.1610+0.1611+0.0536)=0.118\). A perfect ROC area on four subjects says nothing about discrimination in general: it is a property of a tiny, ordered sample.
Counts. An observed \(y=4\) with a fitted mean \(\mu=3\): Poisson term \(4\ln3-3-\ln24=-1.784\); NB2 with \(\kappa=2\) (variance \(\mu+\mu^2/\kappa=7.5\) against the Poisson's 3): \(\ln\Gamma(6)-\ln\Gamma(2)-\ln24+2\ln\tfrac25+4\ln\tfrac35=-2.266\). The over-dispersed model gives the same observation less probability density at its centre and more in the tails, which is the point.
Ordinal. Three categories, cut-points \(\alpha=(-1,\ 1)\) and \(\eta=0.5\): \(P(Y\le1)=\operatorname{expit}(-1.5)=0.1824\), \(P(Y\le2)=\operatorname{expit}(0.5)=0.6225\), so \(P(Y=1)=0.1824\), \(P(Y=2)=0.4400\), \(P(Y=3)=0.3775\) (sum 1). A subject in category 2 contributes \(\ln0.4400=-0.821\).
Time-to-event endpoints
Kaplan–Meier. At each distinct event time \(t\) with \(n_t\) at risk and \(d_t\) events,
Intervals with \(z=\Phi^{-1}(1-\alpha/2)\): plain \(\hat S\pm z\hat S\sqrt{\hat V_G}\); log \(\hat S\,e^{\pm z\sqrt{\hat V_G}}\); log–log \(\bigl[\hat S^{\,e^{zs}},\ \hat S^{\,e^{-zs}}\bigr]\) with \(s=\sqrt{\hat V_G}/\lvert\ln\hat S\rvert\). The median survival is the first time at which \(\hat S\le0.5\).
Worked illustration. Eight subjects with times \(3,\ 5,\ 5,\ 8,\ 10,\ 12,\ 15,\ 18\) and event indicators \(1,\ 1,\ 0,\ 1,\ 1,\ 0,\ 1,\ 0\) (0 = censored):
| \(t\) | at risk \(n_t\) | events \(d_t\) | \(\hat S(t)\) | Greenwood \(\hat V_G\) |
|---|---|---|---|---|
| 3 | 8 | 1 | 0.8750 | 0.01786 |
| 5 | 7 | 1 | 0.7500 | 0.04167 |
| 8 | 5 | 1 | 0.6000 | 0.09167 |
| 10 | 4 | 1 | 0.4500 | 0.17500 |
| 15 | 2 | 1 | 0.2250 | 0.67500 |
(At \(t=5\) one subject has an event and one is censored; both are in the risk set of 7, and the censored one leaves it afterwards, so at \(t=8\) five remain.) The median survival is \(10\), where \(\hat S=0.45\) first falls below 0.5. At \(t=10\) the three intervals are: plain \((0.081,\ 0.819)\); log \((0.198,\ 1.022)\); log–log \((0.108,\ 0.751)\). The log form can exceed 1 and the plain form can fall below 0 — only the log–log form is guaranteed to stay inside \((0,1)\), which matters when events are few and the curve is far from 0.5.
Log-rank test across \(K\) groups. At each event time with \(n_{kt}\) at risk in group \(k\), \(d_{kt}\) events, \(n_t=\sum n_{kt}\), \(d_t=\sum d_{kt}\),
At each event time, the expected events in a group are its share of the risk set times the events that occurred: at \(t=3\) in the data above, a group that holds 3 of the 8 subjects at risk is expected to have \(1\times3/8=0.375\) of the one event.
Cox proportional hazards. With \(\eta_i=f(C_i)+\sum\gamma_kz_{ik}\) (no intercept), the Breslow partial likelihood is
The hazard ratio is \(e^{\hat\beta}\) with interval \(e^{\hat\beta\pm zs}\). The partial likelihood conditions on the event times and compares, at each event, the subject who had it with everyone still at risk.
Worked illustration. The same eight subjects with a covariate \(x=1,\ 2,\ 1.5,\ 3,\ 2.5,\ 0.5,\ 3.5,\ 1\) and \(\eta=\beta x\). At \(\beta=0\) every \(\eta_j=0\) and each event contributes \(-\ln n_t\), so
The partial likelihood rises to a maximum \(\ell_p(\hat\beta)=-7.4242\) at \(\hat\beta=0.310\) (\(\ell_p(0.2)=-7.4598\), \(\ell_p(0.4)=-7.4472\), \(\ell_p(0.6)=-7.6508\)). The curvature gives \(\mathrm{SE}=0.417\), so \(\mathrm{HR}=e^{0.310}=1.36\) and the Wald statistic is \(z=0.744\); the likelihood-ratio statistic is \(2(-7.4242+7.7142)=0.580\) on 1 df (\(p=0.446\)): with 5 events, the data say almost nothing. (An invented set of numbers; the point is the arithmetic, and how little 5 events support.)
Approximate check of proportional hazards (Schoenfeld-type): for each event the residual \(r_i=x_i-\dfrac{\sum_{j\in R(T_i)}x_je^{\eta_j}}{\sum_{j\in R(T_i)}e^{\eta_j}}\), with \(\rho=\operatorname{corr}(r,\operatorname{rank}(T))\) and \(d\) events, \(\chi^2=d\rho^2\sim\chi^2_1\).
Effects and curves: the delta method
For a change in exposure from \(a\) to \(b\) (the interquartile range, a unit, a standard deviation or a doubling, over the active subjects), the effect is a function of the estimates:
with \(\mathrm{SE}(\Delta)\) by the delta method (page A.12) and the interval formed on the link scale and back-transformed. Example: an Emax curve with \(E_{\max}=-10\) and \(EC_{50}=2\) changes by \(\Delta=-10\bigl(\tfrac{3}{5}-\tfrac13\bigr)=-2.67\) between exposures 1 and 3. The size of that change depends on where on the curve it is taken: the same increment between 10 and 12 is \(-10\bigl(\tfrac{12}{14}-\tfrac{10}{12}\bigr)=-0.24\), which is why a single "effect per unit" misleads for a saturating curve.
Common mistakes
- Reading an odds ratio or a hazard ratio as a risk ratio.
- Reporting a Kaplan–Meier interval that leaves \([0,1]\).
- Using the Poisson model on over-dispersed counts and trusting the standard errors.
- Quoting an "effect per unit exposure" from a saturating curve without saying where it was taken.
- Comparing information criteria between models fitted to different subjects (the log-linear model, which drops the placebo subjects).
Review checklist
- Can you write each endpoint's log-likelihood and say what its linear predictor is?
- Can you compute a Kaplan–Meier estimate and a Greenwood interval by hand?
- Can you state the partial likelihood of a Cox model and compute it for a tiny data set?
- Can you turn a fitted curve into an effect for a stated change in exposure?
Navigation
See the previous page, the next page and the mathematical reference.