Why weights enter the score equation
In discrete-time survival analysis, each person contributes one record for every interval in which they remain at risk. The pooled logistic model represents the event probability in an interval as a function of the treatment history and other terms in a marginal structural model (MSM). When treatment weights are supplied, they change how strongly each at-risk interval contributes to fitting that model.
The central calculation is direct: multiply an interval’s ordinary logistic score contribution by its weight. This tutorial derives that calculation and works through its implications. It treats the weights as supplied values; it does not derive treatment-weight models. A weighted objective is generally a pseudo-likelihood, not a probability likelihood for a new sample.
The design vector summarizes whatever treatment-history terms and other prespecified MSM terms are being fitted. The exact representation of the interval baseline component is a separate modeling choice. For correct timing, \(W_{it}\) must correspond to the treatment history relevant to interval \(t\): a treatment assigned before the interval may be used for it, but a treatment assigned after the interval cannot be used to weight its contribution.
Deriving the weighted score
For an at-risk record, the ordinary Bernoulli log-likelihood contribution is \(D_{it}\log(p_{it})+(1-D_{it})\log(1-p_{it})\). In the weighted fit, multiply this contribution by \(W_{it}\). Summing over all at-risk records gives the weighted objective:
This sum is an objective for estimation, not generally the log-likelihood of independent observations drawn from a literal weighted sample. Within-person records can be dependent, and the treatment weights need not be integers.
To verify the result, write \(\eta_{it}=x_{it}^{\mathsf T}\beta\), so that \(p_{it}=\exp(\eta_{it})/\{1+\exp(\eta_{it})\}\). The unweighted record contribution can be rewritten as \(D_{it}\eta_{it}-\log(1+\exp(\eta_{it}))\). Its derivative with respect to \(\beta\) is
Multiplication by the constant \(R_{it}W_{it}\), followed by summation, gives the stated score. A fitted coefficient vector solves \(U_W(\hat\beta)=0\), if a finite solution exists. The derivation establishes the score equation; existence and uniqueness of a finite solution are not guaranteed. \(\square\)
The equation makes the scaling explicit: without a weight, an interval contributes \(R_{it}x_{it}(D_{it}-p_{it})\); with a weight, the contribution is \(R_{it}W_{it}x_{it}(D_{it}-p_{it})\). A weight of two doubles that record’s contribution at the current parameter value. It does not change the record’s observed event indicator or fitted probability by itself.
Worked Example: Scaling Three Interval Contributions
Consider three at-risk records with an intercept-only model, so each design vector is \(x=1\). At a trial parameter value, suppose the fitted event probability is \(p=0.2\) for each record. Their event indicators are \(1,0,1\), and their supplied weights are \(2,0.5,3\), respectively. Calculate the weighted score.
For an intercept-only model, the score contribution is \(W(D-p)\). The first record contributes \(2(1-0.2)=1.6\). The second contributes \(0.5(0-0.2)=-0.1\). The third contributes \(3(1-0.2)=2.4\), not 1.5; the weight is three and the event residual is \(0.8\).
Thus the total score is \(1.6-0.1+2.4=3.9\). The unweighted score would be \(0.8-0.2+0.8=1.4\). The discrepancy illustrates why the weighted and unweighted score equations need not have the same solution: each interval’s residual is multiplied by its own weight.
What the score equation says about fitted parameters
The score equation balances weighted residuals. For an intercept-only model, the balance is between the weighted number of observed events and the sum of weighted fitted probabilities. With treatment terms in the design, there is a corresponding balance for each design component. These are algebraic properties of the fitted equation, not by themselves evidence that the causal assumptions needed for an MSM are satisfied.
To derive this result, when the model has a common probability \(p\), the score is
Setting the score to zero gives \(p=E_W/S\). A finite logistic intercept requires \(0<p<1\), which is equivalent to \(0<E_W<S\). If \(E_W=0\), the solution would require \(p=0\); if \(E_W=S\), it would require \(p=1\). Neither value corresponds to a finite logistic intercept. This proves the result and also shows how weighted event and non-event totals determine the intercept. \(\square\)
Worked Example: Solving a Weighted Intercept Equation
Suppose four at-risk records have event indicators \(1,0,0,0\) and weights \(2,1,3,2\). Fit an intercept-only pooled logistic model by solving its weighted score equation.
The total weight is \(S=2+1+3+2=8\). The weighted event total is \(E_W=2(1)+1(0)+3(0)+2(0)=2\). Therefore the fitted probability is \(\hat p=E_W/S=2/8=0.25\). The fitted intercept is
Checking the score at this probability gives \(2(1-0.25)+1(0-0.25)+3(0-0.25)+2(0-0.25)=1.5-0.25-0.75-0.5=0\). The weighted equation is satisfied. The calculation uses weighted totals, not the unweighted event fraction \(1/4\) as a general shortcut; the two happen to agree here only because the sole event record has weight two and the total weight is eight.
Worked Example: A Weighted Binary Treatment Term
Suppose a model has design vector \(x=(1,A)^{\mathsf T}\), where \(A\) is a binary treatment indicator. Across records with \(A=0\), the total weight is 4 and the weighted event total is 1. Across records with \(A=1\), the corresponding totals are 5 and 3. Fit the two parameters in \(\operatorname{logit}(p)=\beta_0+\beta_A A\).
For the \(A=0\) records, the intercept part of the score is \(1-4p_0\), where \(p_0=\operatorname{expit}(\beta_0)\). For the \(A=1\) records, the intercept part is \(3-5p_1\), where \(p_1=\operatorname{expit}(\beta_0+\beta_A)\). The treatment part of the score is \(3-5p_1\), because \(A=0\) records contribute zero to that component.
Setting the treatment score to zero gives \(p_1=3/5=0.6\). The intercept score then requires \(1-4p_0+3-5p_1=0\), so \(p_0=1/4=0.25\). Equivalently, each treatment-group contribution balances separately: \(1-4(0.25)=0\) and \(3-5(0.6)=0\). Thus
The score check is explicit: the intercept component is \(\{1-4(0.25)\}+\{3-5(0.6)\}=0+0=0\), and the treatment component is \(3-5(0.6)=0\). This example shows that the weighted treatment contrast is built from weighted event and interval totals, rather than raw counts.
Assumptions, diagnostics, and alternatives
The score derivation requires only a well-defined design vector and supplied, finite weights that do not depend on the outcome-model parameter \(\beta\). For its usual survival interpretation, records must be constructed so that a person contributes only while at risk, and each event is represented in its event interval. Subjects, rather than person-interval records, are the independent sampling units; repeated intervals from one person should not be treated as independent people when making inferential claims.
A causal interpretation requires more than solving the equation. It depends on the relevant consistency, sequential exchangeability, and positivity assumptions, as well as suitable treatment-weight construction and an adequately specified MSM. Weighting does not repair a violation of these assumptions. It also does not guarantee a stable fit: a few intervals with very large weights can dominate the score, while extreme concentration of weight on a small portion of the sample makes results sensitive to those records.
Useful checks include verifying that weights are finite and nonnegative, confirming that each weight is aligned with the treatment history available at the start of its interval, and inspecting how much of the total weight is carried by a small number of people or intervals. Compare weighted and unweighted fits as a sensitivity check, not as a test that one is correct. Also inspect convergence and whether the fitted probabilities and coefficients are finite. A score that does not approach zero at the reported estimate can indicate a coding, optimization, or data-structure error.
The ordinary pooled logistic fit is the main contrast: it uses the same interval structure but sets all weights to one. A weighted Cox MSM is a different outcome-model approach, developed for continuous-time survival analysis; its estimating equation is not this logistic score. Neither approach is automatically preferable in every setting. Here the weighted pooled logistic equation is appropriate when the discrete-interval event probability is the target model and the supplied weights are appropriate for the causal analysis.
Finally, a common scaling of all weights does not change the coefficient solution: if every \(W_{it}\) is replaced by \(cW_{it}\) for a fixed \(c>0\), the new score is \(cU_W(\beta)\), which has the same zeros. But changing weights differently across intervals generally changes the zeros. The weights therefore define the relative influence of records in the estimating equation, not just a numerical rescaling of the entire fit.
Check Your Understanding
Use the score equation to answer each question. Solutions follow in brief.
- For one at-risk record with \(D=0\), \(p=0.3\), and \(W=4\), what is its intercept score contribution?
- In an intercept-only fit, the total weight is 10 and the weighted event total is 7. What are the fitted probability and intercept?
- Why is it incorrect to use a treatment value assigned after an interval to choose that interval’s treatment weight?
- If all weights are doubled, does the coefficient solution change? Explain using the score.
Solutions. (1) \(4(0-0.3)=-1.2\). (2) \(\hat p=7/10=0.7\), so \(\hat\beta=\log(0.7/0.3)=\log(7/3)\approx0.847\). (3) That treatment value is not part of the treatment history available at the interval’s start; using it misaligns the weight with the interval contribution. (4) No: doubling every weight doubles the whole score, preserving its zeros, so it does not change the coefficient solution when that solution exists.