Compound-symmetry covariance Created 2026-10-07 Updated 2026-10-14
A compound-symmetry covariance matrix has a common diagonal entry and a common off-diagonal entry: . For a group of size , its within-group eigenvalue is and its constant-direction eigenvalue is . Thus and characterize positive semidefiniteness. When , an independent shared random intercept plus individual noise realizes this covariance. A group mean has variance ; a difference of two disjoint subgroup means within the same group cancels .
A subject-specific random intercept and random slope may have a joint bivariate normal distribution with arbitrary positive-definite covariance matrix . With independent normal measurement errors of variance , the marginal covariance between a person's readings at is , plus on the diagonal. Different subjects remain independent. Allowing distinguishes this model from an independent random-intercept and random-slope model.
Independent Gaussian random intercepts and random slopes give marginal within-group covariance . In lme4, separate terms (1 | group) and (0 + x | group) impose zero intercept-slope covariance; (1 + x | group) estimates it. This independence restriction depends on the predictor origin: replacing by transforms the intercept effect to , generally correlated with .
A subject has a random intercept , with responses conditionally independent given and their covariates. Integrating the product of Bernoulli likelihoods over defines the joint subject likelihood and induces within-subject dependence. Its coefficients describe conditional odds ratios for a fixed latent subject effect. Under missing at random with distinct parameters, the observed-response likelihood integrates over the same random effect and sums out unobserved responses. Dependence of dropout on is not generally ignorable merely because conditional independence holds given .
Given Gaussian random intercept and random slope , let the conditional incidence rate be . The normal moment-generating function gives the displayed marginal rate, with . Thus the conditional annual rate ratio for a cluster is , whereas the marginal rate ratio also contains covariance and variance terms. Centering at a chosen year makes intercept heterogeneity refer directly to that year.
For conditional individual response profiles use a logistic random-intercept model for repeated binary outcomes. Introduce a subject effect independently across subjects and independently of treatment and baseline covariates, under the specified model. Conditional on , assume the three responses are independent Bernoulli random variables with
Here is persistent unmeasured subject heterogeneity and its variance. It induces dependence after integration: for distinct visits, the response covariance is , generally positive. This is a complete joint generalized linear mixed model, unlike a mean-only GEE specification.
Under missing at random conditional on the observed responses and baseline variables, with distinct parameters for missingness and outcomes, the missingness model is ignorable for likelihood inference. Let . The outcome observed-data likelihood is
The omitted Bernoulli factors sum to one over missing outcomes. Fit the fixed coefficients and by maximizing this integrated likelihood, with suitable quadrature or another justified integration method. If , use the limiting point-mass model. Correct response and random-effect distributions, identifiable coefficients and regularity are needed; the latent distribution assumption is not merely a convenient working covariance.
For patient , combine the fitted model with the posterior density of proportional to its normal density times that patient's observed Bernoulli factors. Integrating over this posterior gives a patient-specific predicted response profile. The treatment odds ratio for a fixed and the same baseline variables is . This conditional contrast does not by itself identify each person's unobserved causal treatment effect: a parallel-arm trial observes only one treatment per person. Random slopes or heterogeneous treatment effects require further modelling and sufficient information; they are not implied by fitting a random intercept.
The population-averaged logistic regression describes after averaging over unmeasured individual heterogeneity. Its intercept is a marginal log odds at reference baseline values and time zero, its treatment coefficient is a population conditional-on-baseline log odds ratio, and its time coefficient is the change in that marginal log odds per month. Time zero is an extrapolation here because the recorded visits begin later; centring time at the first visit would give a more interpretable intercept.
In the random-intercept logistic model, the intercept is instead the conditional log odds for a subject with . The treatment and time coefficients apply at fixed ; the subject's actual intercept is . Even with a treatment-independent random intercept, the conditional and marginal coefficients generally differ through noncollapsibility of the odds ratio. Indeed, if , marginalization gives
which is not generally a logistic curve with the same linear coefficients. To quantify random-intercept attenuation of marginal logistic slopes, let . Then
For a nondegenerate finite random intercept this derivative lies strictly between zero and one and usually varies with . Thus the marginal treatment contrast is an integrated, attenuated version of the conditional contrast, and the marginal time slope need not be constant. One should not equate the two sets of coefficients, even in a randomized controlled trial without treatment confounding.
For missing completely at random, an unweighted observed-response GEE with cluster-robust standard errors can consistently fit the marginal mean, and a correctly specified integrated GLMM likelihood is valid as well. Under missing at random depending on previous observed outcomes, ordinary unweighted GEE is generally biased because the remaining responses are selected by informative observed history. Correct inverse-observation-weighted estimating equations for longitudinal dropout recover the marginal target under the sequential MAR and positivity assumptions already stated. Covariate-only observation mechanisms are a simpler special case in which correctly conditioned unweighted mean equations can remain valid.
A correctly specified joint response GLMM, fitted by observed-data likelihood, is valid under ignorable missing at random with distinct parameters, including dependence of missingness on observed response history. This is a likelihood property, not a claim that every mixed model automatically fixes missingness. Under missing not at random, neither ordinary GEE, MAR-based weights nor a response-only GLMM is generally valid; the unseen-outcome dependence requires further modelling and sensitivity assumptions.
The common normal distribution for the child-specific random intercepts produces partial pooling. Children with little information borrow strength from the common population, while well-observed children retain more of their individual estimate. For fixed slopes and hyperparameters, let average the three responses after subtracting their slope terms. Multiplying the normal likelihood by the normal intercept prior distribution gives
with conditional variance . Thus small between-child variation produces stronger shrinkage towards . The common mean and variation are themselves learned from all children in this hierarchical Bayesian model.
Model 2 is an errors-in-variables model: the follow-up regression depends on a latent true baseline rather than substituting its noisy observation. A common normal distribution for the true baselines provides partial pooling and allows uncertainty about each baseline to propagate to the regression coefficients and predictions. Conditional on the shared parameters, the child-specific factorization is
The Directed acyclic graph below includes the shared parameters, the two local latent variables, both observed measurements, and the deterministic regression mean. The outer plate repeats over children and the inner plate over follow-up visits. Filled nodes are observed; rectangular mean nodes are deterministic.
Figure 1.
Directed graph of the latent-baseline random-intercept model, including shared priors, baseline measurement error and repeated follow-up visits
. Details.
One complete adapted BUGS specification uses the non-centered form of the random intercept, retaining the original priors and adding proper broad priors for and :
for (i in 1:N) {
  z[i] ~ dnorm(0, 1)
  alpha[i] <- delta + tau*z[i]
  truebase[i] ~ dnorm(theta, baseprec)
  baseline[i] ~ dnorm(truebase[i], noiseprec)
  for (j in 1:3) {
    followmean[i,j] <- alpha[i] + beta*log(time[i,j]) + gamma*truebase[i]
    followup[i,j] ~ dnorm(followmean[i,j], noiseprec)
  }
}
noiseprec ~ dgamma(0.001, 0.001)
beta ~ dunif(-100, 100)
gamma ~ dunif(-100, 100)
delta ~ dunif(-100, 100)
tau ~ dunif(0, 100)
theta ~ dunif(-100, 100)
psi ~ dunif(0, 100)
baseprec <- 1/(psi*psi)
Here is the number of children, baseline and followup contain the observed data, and dnorm uses precision rather than variance. The priors on the newly introduced population baseline mean and standard deviation are explicit choices, not consequences of the likelihood; sensible alternatives can be checked for sensitivity. The code uses the noisy baseline only in its own measurement likelihood, and uses truebase in every follow-up mean.
Measurements from the same person share baseline strength and likely share an individual response to training. An ordinary linear model with independent errors treats all 600 readings as independent conditional on week; that fails to represent their within-person correlation. The regression residuals can remain associated even when the population mean is linear in time. A random intercept captures differences in baseline strength, and a random slope can additionally describe differences in progress.
Unobserved heterogeneity is persistent variation between subjects arising from unmeasured characteristics. A subject-specific latent variable or random intercept can represent it. Subjects with high latent success propensities tend to succeed repeatedly, so their observed outcomes can have positive serial correlation even when outcomes are conditionally independent given that propensity. Apparent persistence therefore need not imply true state dependence.
Write for stirring rate of observation in furnace . The independent random-intercept and random-slope model is
Errors and random effects are independent. The separate R terms (1 | furnace) and (0 + stir | furnace) impose independent random intercepts and random slopes; (1 + stir | furnace) would instead estimate their covariance as well. The estimates are
The corresponding estimated standard deviations are , , and ; they are not additional parameters.
For a furnace with predictor vector , the marginal formulation, obtained by integrating the Gaussian random effects, is
independently across furnaces. In particular,
In stacked notation , , giving the Gaussian linear mixed model marginal law with .
The residual-versus-fitted plot on page 17 has residuals of both signs over the fitted range, with no convincing smooth curvature or clear fan shape. Its quantile-quantile plot is roughly straight in the central region, with some tail departures and a few large negative residuals. There is no decisive visible violation, but investigate those observations. These plots mainly address conditional observation errors; they do not validate the distribution of furnace random effects or independence within furnaces. With only three furnaces, normality and the variance of the random effects are especially difficult to assess.
The generalized additive mixed model fits
where denotes the furnace random intercept and is a centered penalized cubic regression spline. Its wiggly components have a mixed-model representation; there is no explicit furnace-specific random slope in this formula.
The plotted smooth gives no evidence that a nonparametric fixed effect is needed. It is essentially a straight rising line, and s(stir,1) indicates effective degrees of freedom close to one. The wider bands at extreme stirring rates reflect uncertainty, not detected nonlinearity. A linear fixed stirring effect is adequate on this evidence.
If the three supplied Akaike information criterion values are on a common valid likelihood basis, choose strength_model3, the fixed linear slope plus random-intercept model: its AIC is smallest, versus for the additional random slope and for the smooth. The differences are and , respectively, so especially the random-slope comparison represents modest support rather than decisive evidence. Retaining the population slope is consistent with part (c); this choice removes only its random variation.
There is a likelihood-basis caveat in the literal printed commands. lmer fits by REML by default, whereas the Gaussian gamm call defaults to ML; direct AIC on these objects need not compare the same type of likelihood. Moreover the earlier ML ANOVA prints for strength_model, whereas this table prints , so these numbers should not silently be treated as one identical ML fit. To obtain a defensible common comparison, fit all candidates to the same observations by ML:
fit_slope <- update(strength_model, REML = FALSE)
fit_intercept <- update(strength_model3, REML = FALSE)
fit_smooth <- mgcv::gamm(strength ~ s(stir, bs = "cr"),
random = list(furnace = ~ 1), method = "ML")
AIC(fit_slope, fit_intercept, fit_smooth$lme)
The supplied ranking favours the simpler random-intercept model; the displayed original calls alone do not certify that ranking as a consistent ML comparison. This distinction is particularly relevant when the smooth changes the fixed-effect space. The Gaussian gamm ML default and mixed-model representation are documented at stat.ethz.ch/R-manual/R-devel/library/mgcv/html/gamm.html.
There is a genuine syntax error in the printed command: random=list(...) must be a separate argument, following a comma rather than a plus. The intended call is
model2 <- gamm(npres ~ s(age, bs="cr") + s(wbc, bs="cr"), random=list(doctor=~age))
With the default Gaussian family, this generalized additive mixed model is
Here across doctors, is an estimated covariance matrix, and the Gaussian errors have variance and are independent of the random effects. The formula ~age includes a random intercept as well as a random slope; it does not force these two effects to be uncorrelated.
The random intercept allows different prescribing baselines, and the random slope allows doctor-specific linear modifications to the population age curve. Conditional on these effects the observations are independent under the model, whereas two patients of the same doctor have additional covariance . This accounts for clustered data and avoids treating doctor variation as independent patient-level noise. The population smooth and doctor-specific predictions are different targets. With only four doctors, estimates of the random-effect covariance can be imprecise; the Gaussian support issue for counts also remains. The new model accounts for doctor-specific baselines and age slopes.
The random-slope linear mixed model is
with independence between the random effects and errors. The estimates are
Incubators are treated as exchangeable representatives of possible growth environments, so a random slope permits their growth rates to differ while estimating a population mean growth rate. The formula 0+hours deliberately removes a random intercept: larvae are assigned only after hatching, so it is reasonable to assume no incubator-specific baseline at time zero. Random assignment supports this common-baseline assumption in expectation; it does not prove that observed initial sizes or other baseline differences are exactly identical.
For a new incubator, no observations are available to estimate its realized random slope, and its mean effect is zero. Under squared-error loss the best prediction integrates over that effect and the residual error:
This is the plug-in conditional expectation given the population parameters, rather than a prediction using a fitted effect from one of the four existing incubators. Ignoring parameter-estimation uncertainty, the prediction variance for a new individual is ; it is not just the uncertainty in the population mean.
Add a location-specific random intercept to the random-slope linear mixed model:
Take the location effects, incubator slopes and individual errors to be mutually independent, with the original variances and . The random intercept models variation already present at hatching because of the origin of the eggs. Because larvae are subsequently assigned to incubators, location and incubator are crossed random effects, not automatically nested groups. The corresponding code is
fly.model.loc <- lmer(size ~ hours + (0+hours|incubator) + (1|location))
The resulting covariance between two observations contains if they share a location and if they share an incubator. If the three named locations themselves are the only populations of interest, use a fixed location factor instead:
fly.model.loc.fixed <- lmer(size ~ hours + location + (0+hours|incubator))
Choosing between these interpretations depends on the inferential target; with only three locations, a location variance component will be weakly estimated.
The command fits a Gaussian generalized additive mixed model
The population growth curve is a centered penalized regression spline with a cubic regression basis. The incubator term remains a random slope without a random intercept, because ~0+hours removes the intercept. A population linear component is allowed within the smooth's unpenalized part; curvature is penalized rather than being required.
A gamm fit returns a list with gam and lme components. Plot the population smooth and pointwise uncertainty bands with
plot(fly.model2$gam, se=TRUE, residuals=TRUE)
Inspect whether the fitted curve departs materially from an affine function, particularly in regions supported by observations. The effective degrees of freedom near one suggest that the penalization has selected an approximately linear centered smooth. Bands and partial residuals help distinguish convincing curvature from noisy deviations, although pointwise bands are not a simultaneous test of linearity. A formal comparison would need to account for both smoothing selection and the incubator dependence. The smooth plot tests the visual plausibility of a common straight growth curve while retaining incubator-specific slope variation.