Generalized estimating equation Created 2026-10-07 Updated 2026-10-14
For independent clusters with mean vector and positive definite working covariance matrix , a generalized estimating equation solves
Correct mean specification and regularity can give a consistent estimator of identifiable mean coefficients despite a misspecified working covariance. A sandwich covariance matrix accounts for actual cluster variation. Mean equations alone cannot identify two parameters that always enter through the same combination.
Heteroskedasticity-consistent standard errors use an estimated regression covariance that remains consistent when error variances vary across observations. For ordinary least squares, the basic sandwich estimate is . The resulting standard errors are square roots of its diagonal entries. This is a regression application of a sandwich covariance matrix.
A population-averaged log-rate model with exposure gives an annual rate ratio . A generalized estimating equation can account for repeated observations within clusters through a working correlation and sandwich covariance matrix. Independent Poisson standard errors do not account for clustering. An exposure-weighted population rate and an equally weighted average of cluster rates are different estimands.
Use a generalized estimating equation with any well-behaved positive-definite working correlation matrix. Let collect the marginal intercept and slopes, let be the vector of three correct marginal means, and put . Write the working covariance as , where the proposed Poisson variance gives ; working independence is also allowed. Solve
At the true mean, each cluster residual has expectation zero, so the estimating equation is unbiased regardless of whether equals the actual covariance. With independent students, sufficient covariate variation and regularity as , this gives consistent mean coefficients.
Replace the model-based covariance by the cluster-level sandwich covariance matrix. Evaluated at the fitted values, define
Then
The residual outer products estimate the actual within-student variability, including correlations and extra-Poisson variance absent from the working model. Use these standard errors for asymptotic Wald tests and confidence intervals; exponentiating the treatment coefficient and its interval gives the mean-count rate ratio and interval. Treating the observations as independent when forming the sandwich meat would miss the within-student dependence. The effective asymptotic replication is the number of students, so a small number of clusters requires further finite-sample care rather than assuming that three measurements per student repair the large-sample approximation.
For a population question use a population-averaged logistic model for repeated binary outcomes. Code for the new treatment and for the control, with visit times months for . Let , , and
Different subjects are independent. Each response has a Bernoulli distribution with this marginal mean, but no independence of a subject's three responses is assumed. The linear time effect and absence of treatment-by-time interaction are substantive mean assumptions; if inappropriate they can be replaced by time indicators and interaction terms.
For complete data, set , , and , where has rows . A working exchangeable correlation matrix has unit diagonal and off-diagonal value ; set . The generalized estimating equation is
With correct means and independent subjects, a positive-definite working covariance matrix and regularity give consistency even if the working correlation is wrong. Write and . The fitted subject-level sandwich covariance matrix is
evaluated at the estimates. This inference is asymptotic in the number of independent subjects, not the number of visits.
For the actual incomplete data, define if visit is observed, with and monotone dropout. Let contain treatment, baseline covariates and responses observed before visit . Under sequential missing at random, specify
The assumption is that the retention decision, conditional on this history, does not additionally depend on unseen current or future outcomes. Fit the , for example by visit-specific logistic regressions. A simple valid choice uses working independence and the inverse-observation-weighted estimating equations for longitudinal dropout:
Terms with are zero and require no missing response. Given the full response vector, sequential missing at random makes . Consequently the weighted score has the same expectation as the complete-data score, proving its mean-zero property. Correct retention probabilities, positivity and a correctly specified marginal mean are required. Use cluster-robust uncertainty, accounting for fitted retention-model coefficients, or resample entire subjects and refit both models. Under missing completely at random, the simpler unweighted observed-response GEE can suffice; ordinary unweighted GEE is not valid under arbitrary history-dependent missing at random.
The treatment coefficient gives a population conditional-on-baseline odds ratio at each visit. To communicate an absolute population treatment benefit, standardize predicted probabilities over the full baseline population, rather than only completers:
A causal reading additionally uses the randomized controlled trial assignment, consistency of the treatment definition, no interference and the dropout assumptions; the statistical model alone does not supply those conditions.
The independence analysis is not justified without further assumptions. Three binary responses from the same subject generally remain correlated after conditioning on baseline covariates and treatment. The fitted independent-Bernoulli likelihood discards that correlation and gives incorrect model-based standard errors and tests if it is present. Positive within-subject correlation commonly makes those errors too small.
There is an important distinction between estimating the mean and estimating uncertainty. If the stated marginal logistic regression is correct and responses are fully observed, the independence score still has zero expectation. With independent subjects and regularity, its root can consistently estimate marginal coefficients despite within-subject dependence; a subject-level sandwich covariance matrix is then needed. True independence is a special case in which the original standard errors would be appropriate.
Dropout creates a separate issue. Restricting that score to observed responses need not preserve its zero expectation if observation depends on the response history or unseen depression outcomes. Therefore both point estimates and uncertainty may be wrong. Neither random treatment assignment nor baseline adjustment alone establishes an ignorable missingness mechanism. We need a model matched to the scientific estimand and explicit assumptions about missing data.
For a regular iid model with a fixed-dimensional interior parameter , identifiability, sufficient differentiability and moment domination, and nonsingular per-observation Fisher information , a consistent maximum-likelihood estimator solves the score equation. Expanding it gives
where . The score has mean zero and covariance under the regularity assumptions. This proves the usual large-sample information bound and asymptotic efficiency within regular parametric inference. The observed curvature and the empirical score covariance consistently estimate when the model is correctly specified.
For smooth constraints with full-row-rank derivative , the Wald test uses
The likelihood-ratio test and score test, evaluated using the constrained fit and nuisance-adjusted efficient information, have the same first-order chi-square law. A quadratic local likelihood expansion explains their asymptotic equivalence. Profile likelihood supplies inference about a parameter of interest with fitted nuisance parameters, and the corresponding chi-square cutoffs give approximate confidence regions.
These conclusions depend on the stated regularity: parameters at a boundary, nonidentifiability, singular information, changing dimension, or parameter-dependent support can give different rates and limits. Under misspecification, the fitted parameter generally approaches a pseudo-true value and its variance is a sandwich covariance matrix, not simply inverse Fisher information.
For a population-averaged rate trend, use the marginal incidence trend with clustered observations model
Fit a generalized estimating equation with village as cluster, a log link and an appropriate working correlation; estimate uncertainty with a village-level sandwich covariance matrix. Then is the fitted annual marginal rate ratio, is the annual percentage rate change, and is the four-year endpoint ratio. Test using cluster-robust uncertainty, with a small-sample correction or village-resampling bootstrap given only 32 independent clusters. Also compare year as a factor with a linear trend, since a single slope can conceal nonlinear behaviour.
Report which population is averaged over. The directly pooled rate is exposure weighted; a mean of village rates gives each village equal weight. For standardized comparisons one can use the same village weights at every year, preventing changing population composition from masquerading as a rate trend.
A conditional random-slope coefficient cannot simply be substituted for the marginal slope: the marginal mean of a Poisson random-slope model contains time-dependent variance terms. A direction, magnitude and confidence interval for the trend across all villages require the missing full dataset. The increase in the two displayed villages does not determine the trend in the other thirty.
Write the logistic regression as
where denotes elective exposure and contains the measured background predictors. At fixed , changing from zero to one changes the log odds by , so the adjusted odds ratio is . If is the estimated coefficient covariance matrix, then
Use the clinic-cluster sandwich covariance matrix if that is how within-clinic dependence is allowed for. The interval is first calculated on the coefficient scale and then exponentiated; one does not add and subtract a standard error directly from the odds ratio. This is a large-sample Wald confidence interval; profile-likelihood limits are another option when the likelihood shape warrants them. If exposure interacts with background variables, there is no single common conditional odds ratio: its logarithm includes the corresponding interaction terms.
A reversal this large calls for an audit, but the aggregate table cannot identify a particular error. Check the outcome and exposure coding, the reference category, the subset used in each analysis, missing-data exclusions, denominators, weights, and whether the reported coefficient actually corresponds to the intended comparison. Reversing an exposure contrast or exponentiating the wrong fitted coefficient would change the reported odds ratio. Conditioning on variables affected by delivery, or including inappropriate interactions, could also change the causal inference rather than merely improve precision.
Start by reproducing the crude odds ratio from an independent two-by-two calculation. Then fit progressively adjusted logistic regressions, recording how the coefficient and analysis population change; inspect within-clinic comparisons, sparse cells and separation. For an ordinary likelihood fit, check the fitted expected event count against the observed count and verify that changing only to cluster-robust standard errors leaves the fitted coefficients unchanged. A sandwich covariance matrix corrects uncertainty for clustered data; it does not by itself turn a crude odds ratio below one into an adjusted odds ratio above one. Adding clinic effects, using weights or changing the model can change the point estimate and must be distinguished from that variance correction.
Programming or reporting error is a possibility to check, not a conclusion proved by the reversal. Strong legitimate confounding remains another explanation.
For the moment approach, write and let be a positive-definite working covariance constructed from the proposed moment formulas. For identifiable mean coefficients , let . Generalized estimating equations take the form
Across independent students, correct mean specification and standard regularity conditions give consistent identifiable mean coefficients even if the working covariance is wrong. Sandwich covariance matrix standard errors use
Residual second-moment estimating equations can estimate identifiable dispersion and association parameters. The marginal mean only identifies , not and separately. Moment restrictions beyond the mean would be needed to separate them; as shown below, the printed restrictions do not generally recover the intended latent parameters.
For the hierarchical approach, maximize the observed-data likelihood after integrating out the random effect. Set , , and . The joint likelihood contribution is
The integral comes from multiplying three conditional Poisson mass functions by the Gamma density and integrating over . Independent students give . Direct numerical maximum likelihood or an expectation-maximization algorithm can be used; in an EM algorithm an all-zero profile has an uncertain latent component membership. Information-based likelihood standard errors apply under regular interior conditions, with special care for parameter boundaries.
The episodes from one patient share treatment, biological susceptibility and prior history, so they are not independent observations. Treating every row as an unrelated subject can substantially understate uncertainty. Two approaches address this within-patient recurrent-event dependence:
A patient-level bootstrap is another way to retain dependence: resample complete histories, not individual episode rows. It is not necessary to assume that robust marginal/working and frailty-conditional effect estimates target exactly the same parameter.
Let
Assumption 2 implies . Although the printed need not converge to , its first-order effect vanishes because . Inverting the Jacobian of the remaining estimating equations gives the influence function
The first-stage condition yields
Hence the asymptotic variance of is the sandwich expression
There is a defect in the printed assumptions: alone does not determine , because depends on and can have a nonzero conditional mean given under unmeasured confounding. Under the standard intended strengthening , the formula simplifies to
The asymptotic variance of itself is .
For independent subjects with repeated Bernoulli observations, specify marginal means . A generalized estimating equation uses their derivative matrix and working covariance matrix to solve . Subject-level sandwich covariance matrices give robust uncertainty when the mean is correctly specified but the working correlation is not. The coefficients describe population odds ratios; this mean specification does not prescribe a complete joint distribution within a subject.
Repeated episodes from one person share susceptibility, treatment and history, so row-wise independence is generally inappropriate. Patient-clustered sandwich covariance matrices estimate uncertainty using whole-patient score contributions under a suitable working model. Shared frailty models instead model persistent latent heterogeneity. These methods require independent sampling units at the patient level and do not necessarily estimate the same marginal versus conditional effect.
A working correlation matrix is a positive-definite proposed correlation structure used to weight a generalized estimating equation, with the diagonal matrix of marginal variances. It need not equal the actual correlation matrix. Correct marginal means and independent sampling clusters keep the estimating equations unbiased; a cluster-level sandwich covariance matrix estimates their actual large-sample covariance. For three exchangeable observations, positive definiteness requires .