Longitudinal Targeted Maximum Likelihood · Tutorial 368 of 501
Logistic Fluctuations for Binary Outcomes
Learn how an initial outcome prediction and a clever covariate define a logistic fluctuation whose score equation targets a binary terminal outcome.
Advanced
10 min read
What You'll Learn
Define an offset logistic fluctuation for a binary terminal outcome.
Derive its score equation directly from the Bernoulli log-likelihood.
Explain how the clever covariate enters the targeting equation.
Check when a finite, unique fluctuation coefficient exists.
Calculate and interpret targeted predictions in explicit examples.
Recognize common numerical and modeling failures.
Why Use a Logistic Fluctuation?
For a binary terminal outcome, an initial outcome regression gives predicted probabilities between zero and one. Targeted maximum likelihood estimation updates those predictions in a direction chosen to make the empirical efficient-score equation hold. A logistic fluctuation does this while keeping every updated prediction in the probability range and retaining the initial prediction as the starting point.
The update uses the initial prediction as an offset, not as a parameter to be freely refitted. The clever covariate supplies the direction of the update: observations with different values of that covariate can receive different changes on the log-odds scale. This tutorial derives the resulting score equation for a binary terminal outcome. It does not derive the full recursive targeting algorithm.
Definition: Let \(Y\in\{0,1\}\) be a terminal outcome, let \(Q_0(O)\in(0,1)\) be its initial predicted conditional mean for an observed record \(O\), and let \(H(O)\) be a specified clever covariate. The one-parameter logistic fluctuation is
$$
Q_{\epsilon}(O)
=
\operatorname{expit}\!\left\{\operatorname{logit} Q_0(O)+\epsilon H(O)\right\},
\qquad
\operatorname{expit}(x)=\frac{1}{1+e^{-x}},
\quad
\operatorname{logit}(u)=\log\frac{u}{1-u}.
$$
The scalar \(\epsilon\) is estimated by maximizing the Bernoulli likelihood with \( \operatorname{logit}Q_0(O)\) as a fixed offset and \(H(O)\) as the covariate.
For a sample of \(n\) records, write \(Q_{0i}=Q_0(O_i)\) and \(H_i=H(O_i)\). In a regime-specific analysis, \(H_i\) is the cumulative clever covariate appropriate to the target parameter and observed-data structure; it incorporates the relevant regime indicators and treatment and censoring probabilities. For instance, in a single-decision, uncensored setting with treatment \(A\) and regime value \(d(W)\), one such covariate is \(H=I\{A=d(W)\}/P\{A=d(W)\mid W\}\). In a longitudinal setting the corresponding covariate accumulates the required factors over time. In the fluctuation below, regard the initial predictions and clever covariates as fixed inputs.
Deriving the Score Equation
For a Bernoulli observation, the log-likelihood contribution at probability \(Q_{\epsilon i}\) is \(Y_i\log Q_{\epsilon i}+(1-Y_i)\log(1-Q_{\epsilon i})\). Summing over observations gives the fluctuation log-likelihood
$$
\ell(\epsilon)
=
\sum_{i=1}^{n}
\left[
Y_i\log Q_{\epsilon i}
+(1-Y_i)\log(1-Q_{\epsilon i})
\right].
$$
To differentiate, note that \( \operatorname{logit}Q_{\epsilon i}=\operatorname{logit}Q_{0i}+\epsilon H_i\), so
$$
\frac{\partial Q_{\epsilon i}}{\partial\epsilon}
=
H_i Q_{\epsilon i}(1-Q_{\epsilon i}).
$$
The derivative of the Bernoulli log-likelihood with respect to its probability is \(Y_i/Q_{\epsilon i}-(1-Y_i)/(1-Q_{\epsilon i})\). By the chain rule, the \(i\)th contribution to the score is
$$
\left\{\frac{Y_i}{Q_{\epsilon i}}-\frac{1-Y_i}{1-Q_{\epsilon i}}\right\}
H_iQ_{\epsilon i}(1-Q_{\epsilon i})
=
H_i(Y_i-Q_{\epsilon i}).
$$
Thus the likelihood score equation for the fluctuation coefficient is
The equation is an empirical residual balance in the direction \(H\). It is not generally the unweighted condition \(\sum_i(Y_i-Q_{\epsilon i})=0\). The offset protects the initial regression as the reference point; the estimated coefficient moves its log-odds only along the specified clever-covariate direction.
Result: If \(H_i\) and \(Q_{0i}\in(0,1)\) are fixed, then
$$
\ell''(\epsilon)
=
-\sum_{i=1}^{n}H_i^2Q_{\epsilon i}(1-Q_{\epsilon i})\leq 0.
$$
If at least one \(H_i\ne0\), the inequality is strict for every finite \(\epsilon\), so \(\ell\) is strictly concave and there can be at most one finite solution to the score equation.
To prove the result, differentiate the score term by term. The derivative of \(H_i(Y_i-Q_{\epsilon i})\) is \(-H_i\partial Q_{\epsilon i}/\partial\epsilon=-H_i^2Q_{\epsilon i}(1-Q_{\epsilon i})\). Since \(0<Q_{\epsilon i}<1\), every nonzero-\(H_i\) term is strictly negative. Therefore the second derivative is nonpositive, and is strictly negative if any \(H_i\ne0\). A strictly concave differentiable log-likelihood has a strictly decreasing score, so it has at most one root. \(\square\)
Strict concavity does not ensure that a finite root exists. A useful sufficient condition in the common case \(H_i\geq0\) is that the records with \(H_i>0\) include at least one success and at least one failure. As \(\epsilon\to-\infty\), \(Q_{\epsilon i}\to0\) for those records, and the score tends to \(\sum_{H_i>0}H_iY_i>0\). As \(\epsilon\to+\infty\), their predictions tend to one, and the score tends to \(-\sum_{H_i>0}H_i(1-Y_i)<0\). The score is continuous and strictly decreasing, so the intermediate value theorem gives a unique finite root. This establishes existence under the stated condition, not merely uniqueness.
Worked Example: A Common Offset and an Exact Update
Suppose four observations have initial predictions \(Q_{0i}=0.4\) and clever covariates \(H_i=1\). The outcomes are \(1,1,0,0\). Find the fluctuation coefficient and updated predictions.
Since all covariates equal one, all updated probabilities equal \(q_{\epsilon}=\operatorname{expit}\{\operatorname{logit}(0.4)+\epsilon\}\). The score equation is
$$
(1-q_{\epsilon})+(1-q_{\epsilon})-q_{\epsilon}-q_{\epsilon}
=2-4q_{\epsilon}=0.
$$
Thus \(q_{\epsilon}=1/2\). The initial odds are \(0.4/0.6=2/3\), and the updated odds are \(1\). Therefore
$$
\epsilon
=
\operatorname{logit}(1/2)-\operatorname{logit}(0.4)
=
0-\log(2/3)
=
\log(3/2)
\approx0.4055.
$$
Checking the score at this value gives \(2(1-1/2)-2(1/2)=0\). Each observation is updated from \(0.4\) to \(0.5\), and the score root is unique because the covariates are nonzero.
Worked Example: Unequal Initial Predictions
Consider two observations with \(H_1=H_2=1\), initial predictions \(Q_{01}=0.2\) and \(Q_{02}=0.6\), and outcomes \(Y_1=1\) and \(Y_2=0\). Solve the score equation.
Let \(x=e^\epsilon\), which is positive. The initial odds are \(1/4\) and \(3/2\), so the updated predictions are
$$
Q_{\epsilon 1}=\frac{x}{4+x},
\qquad
Q_{\epsilon 2}=\frac{3x}{2+3x}.
$$
The score equation is \(1-Q_{\epsilon 1}-Q_{\epsilon 2}=0\). Multiplying by the positive denominators \((4+x)(2+3x)\) gives
$$
(4+x)(2+3x)-x(2+3x)-3x(4+x)=0.
$$
Expanding the three terms gives \(8+14x+3x^2-(2x+3x^2)-(12x+3x^2)=0\), or \(8-3x^2=0\). Hence \(x=\sqrt{8/3}\approx1.6330\), and
$$
\epsilon=\log\sqrt{8/3}\approx0.4904.
$$
The updated probabilities are \(x/(4+x)\approx0.2899\) and \(3x/(2+3x)\approx0.7101\). Their sum is one, so the score \(1-Q_{\epsilon1}-Q_{\epsilon2}\) is zero, as required. Both a success and a failure have positive covariate, so the root is finite; strict concavity makes it unique.
Worked Example: The Clever Covariate Determines the Direction
For three observations, take \(H=(1,1,2)\), \(Y=(0,0,1)\), and initial predictions \(Q_0=(1/3,1/3,1/5)\). Verify the score root.
At \(\epsilon=\log 2\), the first two initial odds, \(1/2\), are multiplied by \(e^\epsilon=2\), giving updated odds \(1\) and probabilities \(1/2\). The third initial odds are \(1/4\); they are multiplied by \(e^{2\epsilon}=4\), again giving odds \(1\) and probability \(1/2\). The score is
$$
1(0-1/2)+1(0-1/2)+2(1-1/2)=-1/2-1/2+1=0.
$$
Thus \(\epsilon=\log2\) solves the equation. Since at least one covariate is nonzero, strict concavity shows it is the only finite root. This example illustrates that the coefficient acts in log-odds units multiplied by each observation's own \(H_i\), rather than applying one identical probability-scale change to everyone.
Numerical Checks and Common Pitfalls
The score is monotone decreasing whenever at least one covariate is nonzero, which makes one-dimensional root-finding straightforward when a finite root exists. A reliable implementation can evaluate the score and its derivative, use Newton's method with a safeguarded step, and verify the final residual. The score and curvature are
$$
U(\epsilon)=\sum_i H_i(Y_i-Q_{\epsilon i}),
\qquad
U'(\epsilon)=-\sum_i H_i^2Q_{\epsilon i}(1-Q_{\epsilon i}).
$$
A numerical answer should satisfy \(|U(\hat\epsilon)|\) within a stated computational tolerance, and the updated predictions should remain in \((0,1)\).
A common failure is separation: when \(H_i\geq0\) for every observation and at least one \(H_i>0\), if all observations with \(H_i>0\) are successes, then \(U(\epsilon)>0\) for every finite \(\epsilon\) and approaches zero only as \(\epsilon\to+\infty\). If they are all failures, the analogous behavior occurs as \(\epsilon\to-\infty\). The likelihood then has no finite maximizing coefficient, even though an optimizer may report a very large finite value. Check the weighted outcome pattern and the score at large positive and negative trial values rather than treating every optimizer output as a valid root.
Using the wrong score. The score contains \(H_i\); omitting it no longer targets the intended direction.
Adding an intercept automatically. An extra intercept changes the fluctuation model and imposes another score equation. Use it only when the targeting specification calls for it.
Applying \(H_i\) twice. In this fluctuation, \(H_i\) is the logistic covariate, so differentiation already supplies one factor \(H_i\). Also using \(H_i\) as a case weight generally produces a different equation involving \(H_i^2\).
Taking logits at a boundary. If a fitted initial probability equals zero or one, its logit is infinite. In practice, predictions may need to be bounded away from those endpoints before fitting the offset model.
Ignoring unstable clever covariates. Very large covariates can produce high curvature variation and numerically extreme updates. Inspect their range and the resulting predictions; the fluctuation does not repair positivity problems in the underlying treatment or censoring models.
How This Fluctuation Fits Among Alternatives
An ordinary logistic regression may estimate an intercept and several slopes afresh. The offset fluctuation instead holds the initial logit prediction fixed and estimates the coefficient on the specified clever covariate. That constraint is essential to this targeted update: it preserves the initial regression apart from the chosen direction. A generic weighted regression is not automatically equivalent, because using \(H_i\) as a case weight as well as a covariate changes the score.
For a binary outcome, the logistic link is useful because every finite update remains a valid probability. A linear-probability fluctuation can instead produce predictions below zero or above one. The logistic fluctuation also has limitations: its score equation targets a particular empirical direction, it depends on the supplied initial regression and clever covariate, and it cannot overcome a lack of support or guarantee a finite solution under separation. This is a targeted update, not a substitute for checking nuisance-model behavior and positivity.
Check Your Understanding
Work each question from the score equation; brief solutions follow so the numerical checks are explicit.
If \(H_i=0\) for every observation, what does the fluctuation score identify about \(\epsilon\)?
For one observation with \(H=2\), \(Q_0=1/4\), and \(Y=1\), can the score be zero at a finite \(\epsilon\)? Explain.
For \(H=1\), \(Q_0=1/2\), and \(\epsilon=\log 3\), calculate the updated probability.
Why can using \(H_i\) as both the fluctuation covariate and a case weight give the wrong targeting equation?
Solutions. (1) The score is identically zero for every \(\epsilon\), so the data provide no information about that coefficient; the update itself is also identically zero. (2) No. The score is \(2\{1-Q_\epsilon\}\), which is positive for every finite \(\epsilon\) because \(Q_\epsilon<1\); it tends to zero only as \(\epsilon\to+\infty\). (3) The initial odds are one, and multiplying them by \(e^{\log3}=3\) gives odds three, hence \(Q_\epsilon=3/(1+3)=3/4\). (4) The logistic covariate contributes a factor \(H_i\) when the likelihood is differentiated. Weighting by \(H_i\) as well contributes another factor, producing a score proportional to \(H_i^2(Y_i-Q_{\epsilon i})\), not the intended \(H_i(Y_i-Q_{\epsilon i})\).