Contest models: from the multinomial to competitive breeding values
Source:vignettes/contest-models.Rmd
contest-models.RmdThis vignette derives the two estimators BreedingR uses for competitive ability measured through grouped contests: the Laplace estimator of the genetic variance of contest strength, and the composite-likelihood test for a rival-dependent (differential) indirect effect. The object throughout is a group contest: several competitors share a group, a fixed number of discrete outcomes is divided among them, and the division is observed.
1. The contest likelihood
A group holds competitors . Competitor enters with a known exposure (a dose, a number of trials) and carries a latent strength . The outcomes of the group are divided by a biased lottery: each outcome falls to with probability
Write and take the exposure as an offset . With two competitors this is the Bradley-Terry model (Bradley and Terry, 1952); with more it is Plackett-Luce (Luce, 1959; Plackett, 1975), equivalently the conditional logit. The strengths are defined only up to a common scale: multiplying every in a group by the same constant leaves every unchanged, because the constant factors out of numerator and denominator. Only differences of are identifiable, and an anchor is required (a zero-mean random term supplies one).
2. Reduction to a pair, by exact conditioning
Take a pair and condition on their joint count . The claim is that the conditional distribution of is Binomial and depends on no other competitor. Start from the multinomial mass function and hold every count except fixed:
Every factor that does not involve (the , the terms, the fixed other counts) is identical in the numerator and in every summand of the denominator, so it cancels:
$$\Pr\!\left(y_{ig}=a \mid y_{ig}+y_{jg}=m\right) \;=\; \frac{\dbinom{m}{a}\,p_{ig}^{\,a}\,p_{jg}^{\,m-a}} {\displaystyle\sum_{a'=0}^{m}\dbinom{m}{a'}\,p_{ig}^{\,a'}\,p_{jg}^{\,m-a'}}.$$
The denominator is a binomial expansion, , so
The result is exact, not an approximation: conditioning on the pair total removes the rest of the group from the problem, because the other competitorsโ probabilities do not survive the cancellation. Taking the log-odds,
Section 3 shows that the pair is also the only place where a rival-dependent effect is identifiable.
3. What is estimable: the aliasing of a uniform indirect effect
Give each competitor a direct log-strength and an indirect effect it exerts on its groupmates. Write the realized log-strength of in group as its own ability plus the effects the others exert on it:
where is the effect of on . Two cases.
Uniform indirect effect. acts on every groupmate alike, . Then
Substituting into the choice probability, the group constant cancels as the common scale did in Section 1:
because multiplies numerator and denominator. Only the combination enters. Hence the reparametrization
leaves , and therefore every probability and the whole likelihood, exactly unchanged. Direct and uniform-indirect effects are perfectly aliased: no estimator separates them, at any sample size. (On the share scale, with outcomes as proportions summing to one, the same collinearity appears as a direct-indirect correlation pinned at , where the gradient does not vanish and a delta-method standard error is meaningless.)
Differential (rival-dependent) indirect effect. acts differently depending on who the rival is, for instance by the rivalโs lineage. Model the departure from uniform as
Now form the pair contrast (2.1). The own abilities and the uniform parts enter ; the group constant and any term common to and cancel in the difference, but the class-specific term does not, because it is asymmetric in and :
The pair is where the differential effect becomes visible: a uniform shift adds the same amount to and and cancels in the difference, while a rival-dependent shift survives. The estimable quantity is the change in โs log-odds of winning an outcome from when is of a different class, over and above the two competitorsโ abilities.
4. Composite likelihood
Break every group into its pairs and multiply the pair binomials as if independent:
The pairs are not independent: a competitor appears in many of them, and within a group the counts are constrained to sum to . So (4.1) is a composite likelihood (Lindsay, 1988; Varin, Reid and Firth, 2011), not a likelihood. Two properties of a likelihood have to be examined separately: the consistency of the estimator, and the distribution of the ratio statistic.
Consistency holds. Each factor is a genuine conditional probability (Section 2), so each per-pair score has mean zero at the true parameter: . The composite score is a sum of these,
so the estimating equation is unbiased and its root is consistent under the usual regularity conditions. Unbiasedness of the score requires the marginals to be correct, not the pairs to be independent; this is what justifies the composite construction.
The second Bartlett identity fails. For a true likelihood, the expected negative Hessian equals the variance of the score, . For the composite likelihood the two objects differ:
a sum of per-pair informations, whereas
The off-diagonal terms are nonzero because pairs sharing a competitor are dependent, so . Two consequences follow.
The curvature is not the precision. The variance of is the Godambe (sandwich) matrix (Godambe, 1960), not . A standard error read off the composite Hessian is invalid.
-
The likelihood-ratio statistic is not . For a true likelihood . For a composite likelihood the same Taylor expansion gives (Kent, 1982)
where are the eigenvalues of . When (a true likelihood) every and the mixture collapses to . Here the are unknown, so the reference distribution is unknown and a table does not apply.
5. Calibration by permutation
Because the are unknown, and because overdispersion (a batch or handling effect shared within a group) inflates beyond what the multinomial predicts, the null distribution of the statistic is obtained empirically. The null must reproduce everything that shapes the statistic (the dependence among pairs, the overdispersion, the group sizes, the exposures) and break only the association under test, between the rivalโs class and the outcome. A permutation that relabels which groups are class-mixed, among groups of the same size, with the counts and exposures untouched, does this: it severs class from outcome while preserving the dependence structure and the dispersion. The empirical -value is
whose floor is for permutations. A parametric bootstrap that samples from the fitted multinomial is not a valid null here: it takes the multinomial as the truth and so omits the overdispersion, making the null too tight. It is kept as a diagnostic: the gap between the permutation null and the parametric null measures the overdispersion the multinomial cannot hold.
6. The variance components, by Laplace
The differential test estimates as location parameters. The companion question, how much of contest strength is heritable, puts a pedigree-structured random effect on the strengths and asks for its variance. With , (additive, tied by the pedigree) and (a permanent competitor effect), the variance is a marginal likelihood over the random effects,
There is no closed form: the integral is in the dimension of the pedigree. In the Gaussian linear model the integral of a normal density against a normal prior is itself normal and closes, which is what makes REML available there; with a multinomial likelihood it does not close and has to be approximated.
Laplaceโs method (Tierney and Kadane, 1986). Write the integrand as with
where is the multinomial log-likelihood. Expand to second order about its minimizer (the joint mode). The gradient vanishes there by definition of the mode, , so the first-order term of the Taylor expansion is zero and the expansion is
with the multinomial information (below). The remaining integral is Gaussian and closes, , giving
The multinomial information . From , with on the log scale,
so each group contributes the block . Two facts follow. First, is sparse: entry is nonzero only if and shared a group. The sparsity comes from the design, and it is what makes the method affordable: is sparse, and a single sparse Cholesky factorization delivers both the Newton step for the mode and the that (6.1) needs. Second, is a weighted graph Laplacian: its rows sum to zero (), so is singular on its own; the precision term is what makes positive definite.
The role of . It is the price of having estimated the mode rather than known it; without it comes out systematically underestimated. It is not the REML penalty. Writing the Gaussian restricted likelihood in the standard form,
the Laplace term corresponds to (through the identity ), which is the maximum-likelihood term. The restricted term proper is , which penalizes the fixed effects for having been estimated, and (6.1) does not carry it. The estimator is therefore marginal (ML) over the random effects, not REML; REML would additionally integrate the fixed effects, which the same expansion could do. When the design has an offset and no free fixed effect, as the contest model does with exposure entering as an offset, the distinction does not change the numbers, but it does as soon as a fixed effect enters.
The variance components are then estimated by minimizing (6.1) over , re-finding the mode at each trial value. The surface of an additive/permanent model has a ridge: trading for at fixed sum barely moves the fit. A point estimate is therefore not enough, and the interval on the heritable fraction is read from a profile of (6.1) along that fraction. The profile is valid here because the multinomial is a true likelihood and the profile-likelihood ratio keeps its asymptotic calibration; this is the point at which the composite likelihood of Section 4 and the likelihood of this section part ways, since there removes the calibration and here it holds.
7. Heritability of a contest-derived effect
Suppose the differential effects of Sections 3 to 5 are shown to exist and the question becomes whether they are heritable. The estimates are a first stage, so this is a two-stage problem, and the way the first stage is carried into the second decides the answer.
The measurement-error model. Write
where is the Godambe sandwich of Section 4, clustered by group, which is what makes it valid under both the pair dependence and any overdispersion. The marginal covariance of the observed vector is then
enters with its coefficient fixed, and that is the whole point. It is tempting to fit with free, on the argument that a free near one would confirm the sandwich. It does not work, and the reason is structural rather than numerical: with free is the multiplicative model for heterogeneity and is the additive one (Thompson and Sharp, 1999), and the two components and are not simultaneously identifiable whenever the are not strongly heterogeneous, because is then close to proportional to and the two columns of the design in variance space collapse. Fitted with free on simulated contests, settles between 2.4 and 4.8, goes to the zero boundary, and returns essentially 1.0 against a true 0.6. Fixing the coefficient at one is what Piepho, Mรถhring, Schulz-Streeck and Ogutu (2012) call the fully efficient two-stage analysis, the only version that reproduces a single-stage fit; carrying a diagonal approximation instead is the standard shortcut of the two-stage literature in breeding (Garrick, Taylor and Fernando, 2009, state plainly that they ignore the off-diagonal of the error covariance).
With the coefficient fixed, (7.1) is an ordinary restricted likelihood in two free components,
with the intercept alone, since is identified only up to an additive constant and the restricted likelihood projects that direction out.
What it delivers depends on how badly the second Bartlett identity fails, so it has to be measured against that severity rather than reported as one number. Taking the median of as the severity index, ten replicates in each of four regimes on simulated contests with a half-sib pedigree give:
| regime | severity | (true 0.30) | (true) | coverage |
|---|---|---|---|---|
| no environmental variance | 1.4 | 0.24 | 0.85 (1.00, a boundary) | 0.93 |
| interior | 1.4 | 0.31 | 0.63 (0.60) | 0.93 |
| interior, overdispersed | 2.2 | 0.30 | 0.69 (0.60) | 0.92 |
| interior, strongly overdispersed | 4.8 | 0.18 | 0.38 (0.40) | 0.90 |
The two ends of that table read in opposite directions, and neither alone would have been safe to generalise. Where the identity fails mildly, is recovered and runs optimistic by 0.03 to 0.09, because comes back low and cannot exceed one, so replicates that reach the zero boundary are truncated and pull the mean up. Where it fails at the severity a real contest design can reach, is instead almost unbiased and it is that deflates, by about forty percent. So on a real design the heritability is the reading to trust and the additive variance is a floor, and on a well-behaved one it is the other way round. Interval coverage holds throughout, and the gap against the unweighted analysis widens exactly where it should: its coverage falls to 0.55 in the last row.
The same severity governs the identifiability discussed above. The free-scale fit breaks (returns ) in the first three regimes and stops breaking in the fourth, because heavy overdispersion makes the genuinely heterogeneous and stops being nearly proportional to . That is the Thompson and Sharp mechanism seen from the outside: the non-identifiability is a property of the design, not of the fitter.
Three readings that look like diagnostics and are not. Each was measured on simulated contests with a known truth, and each says less than it appears to.
- A weighted animal model with , reading the residual variance as a calibration check. The residual it returns is not the scale of : it satisfies, to within a few percent, the identity . Since is small next to the dispersion of , everything the pedigree fails to explain, the environmental variance of included, is divided by a small number and reappears magnified. Replacing by a synthetic phenotype whose error is exactly independent reproduces the same inflated residual, which settles that it never measured calibration.
- The share of the sandwich mass sitting off the diagonal. It can exceed the diagonal mass several times over and still be harmless: the off-diagonal is dominated by one global mode, the non-identifiable constant, and the restricted likelihood projects that direction out. The whitened quadratic forms built from the full matrix and from its diagonal agree to within about seven percent.
- Shrinkage from the ridge on . By the Ghosh-Louis result (Louis, 1984), a shrunken set of estimates understates the dispersion of the parameters, so the ridge biases the genetic fraction downward, never upward. Lowering it by two orders of magnitude restores the regression of on to a slope of one and leaves the variance components no better.
The coupled alternative, and why it is not simply better. The obvious objection to any two-stage scheme is that a single stage would avoid the transport question altogether: put inside the composite likelihood with the pedigree prior and integrate by the Laplace machinery of Section 6. That construction is available, and on the surface it looks strictly preferable. It is not, and the reason is the same broken identity as in Section 4, arriving in a place where it is much harder to see.
Expand the composite log-likelihood about its maximum, with . Integrating against the prior , , gives a closed form,
so in this regime the coupled estimator is exactly maximum likelihood on with covariance . But the sampling truth, by Section 4, is . Equating the two, the coupled estimator solves
It replaces the measurement variance by the curvature of the composite likelihood, which is precisely the object the second Bartlett identity would have licensed and which, in a composite likelihood, is wrong by exactly . When the bias vanishes identically; when they differ it is of the order of the quantity being estimated. Which component absorbs it depends on the pattern of and not its size: white loads entirely onto , carrying the pedigree pattern loads entirely onto , and a numerical projection of (7.2) with the same mean diagonal sends a true to in the first case and in the second. The bias does not vanish under the null either: with it is unchanged, so a non-heritable effect can be returned as heritable.
This is why the two-stage form above is preferred here. It injects the sandwich, which is valid under the pair dependence by construction; the coupled form manufactures the same quantity internally out of and gets it wrong. The two-stage error is also visible, whereas the coupled one hides inside a well-behaved number. What the coupled form does genuinely repair is the ridge: with a penalty on the first stage returns , and cannot be written in the form at all, which is the mechanism behind reaching the zero boundary. Coupling generates that shrinkage from the pedigree prior instead, where already accounts for it.
The construction that would carry both advantages is the coupled form with a curvature adjustment applied to before the Laplace step, in the manner of Chandler and Bate (2007) or Pace, Salvan and Sartori (2011): rescaling so the effective curvature becomes makes the variance the estimator replaces equal to the sandwich, which zeroes by construction rather than calibrating around it. The obstacle is not cost but the rank of , at most the number of groups and exactly singular along the flat directions, so the trace-based adjustments, which never invert , are the safe form.
The general theory for what a two-step estimator costs when the first step is itself estimated is Murphy and Topel (1985); the standing warning against using first-stage predictions as a second-stage phenotype without carrying their uncertainty is Hadfield, Wilson, Garant, Sheldon and Kruuk (2010), and carrying as above is what answers it. Where only the inference on is wanted and not the point estimate, a cluster-robust variance in the second stage (Hedges, Tipton and Johnson, 2010), clustered by group as the first-stage sandwich already is, is the cheaper route.
Doing this to your own data
The data you need is one row per competitor per group: who competed, in which group, with how much exposure, and how many outcomes they took.
library(BreedingR)
set.seed(7)
# One row per competitor per group. Substitute your own columns.
n_grupos <- 200
contests <- do.call(rbind, lapply(seq_len(n_grupos), function(g) {
quem <- sample(1:40, 4)
dose <- runif(4, 0.5, 2)
forca <- exp(c(0.9, 0.3, -0.2, -0.6, rep(0, 36))[quem])
p <- dose * forca / sum(dose * forca)
data.frame(group = as.character(g), competitor = as.character(quem),
dose = dose, wins = as.vector(rmultinom(1, 12, p)))
}))
head(contests, 4)## group competitor dose wins
## 1 1 19 1.0100935 1
## 2 1 31 1.9580938 4
## 3 1 28 0.7487832 3
## 4 1 2 1.1886555 4
competition_strength() estimates the strength of each
competitor per unit of exposure. It is the fit of Section 1, and it
reports who it could not measure.
bt <- competition_strength(contests$wins, contests$group,
contests$competitor, exposure = contests$dose)
head(round(sort(bt$log_strength, decreasing = TRUE), 3), 5)## 1 20 2 9 25
## 0.994 0.308 0.298 0.281 0.279
Competitors 1 and 2 were planted at 0.9 and 0.3 on this scale and come back near those values, which is the check worth running on any design of your own before trusting a ranking from it: simulate your own group sizes and exposures with strengths you chose, and see whether they come back.
Read identifiable before anything else.
A competitor outside the strongly connected component of the contest
graph has a strength that came from the prior and not from the data
(Ford, 1957). It has no standard error, and it does not belong in a
published ranking.
sum(!bt$identifiable) # how many are prior shrinkage rather than measurement## [1] 0
The strength then becomes a phenotype like any other, and it carries its own precision, so it goes in as a weight rather than as a bare number:
d2 <- data.frame(id = names(bt$strength), y = bt$log_strength, w = 1 / bt$se^2)
d2 <- d2[bt$identifiable, ] # measured competitors only
model(y ~ animal(id), d2, pedigree, weights = "w")That two-stage route is the one Section 7 dissects, and the warning
there applies here: weighting by 1/se^2 alone uses the
composite curvature, which overstates the precision. Where the groups
are large and the same competitors meet repeatedly, use the
cluster-robust variance instead, and read the additive variance rather
than the heritability as the finding.
What this design cannot answer, however much data you collect. If you are asking whether a competitor harms its rivals uniformly, Section 3 settles it: that effect is exactly aliased with its own ability, and no estimator separates the two. Only a rival-dependent effect is estimable, and only through the pair contrast.
competition_strength() fits the strengths by the MM
algorithm of Hunter (2004), which is the EM-MAP of Caron and Doucet
(2012) with a Gamma prior and contains Zermeloโs (1929) iteration as the
flat-prior case. It flags competitors outside the strongly connected
component of the contest graph, where the estimate is prior shrinkage
rather than measurement (Ford, 1957). The variance-component estimator
of Section 6 and the differential test of Sections 4 and 5 are
analysis-level constructions built on the sparse pieces the package
exposes (a_inverse(), sparse_chol(),
sparse_solve(), selected_inverse()).
References
- Bradley, R.A. & Terry, M.E. (1952). Rank analysis of incomplete block designs I. Biometrika 39:324-345.
- Caron, F. & Doucet, A. (2012). Efficient Bayesian inference for generalized Bradley-Terry models. Journal of Computational and Graphical Statistics 21:174-196.
- Chandler, R.E. & Bate, S. (2007). Inference for clustered data using the independence loglikelihood. Biometrika 94:167-183.
- Ford, L.R. (1957). Solution of a ranking problem from binary comparisons. American Mathematical Monthly 64:28-33.
- Garrick, D.J., Taylor, J.F. & Fernando, R.L. (2009). Deregressing estimated breeding values and weighting information for genomic regression analyses. Genetics Selection Evolution 41:55.
- Godambe, V.P. (1960). An optimum property of regular maximum likelihood estimation. Annals of Mathematical Statistics 31:1208-1211.
- Hadfield, J.D., Wilson, A.J., Garant, D., Sheldon, B.C. & Kruuk, L.E.B. (2010). The misuse of BLUP in ecology and evolution. The American Naturalist 175:116-125.
- Hedges, L.V., Tipton, E. & Johnson, M.C. (2010). Robust variance estimation in meta-regression with dependent effect size estimates. Research Synthesis Methods 1:39-65.
- Hunter, D.R. (2004). MM algorithms for generalized Bradley-Terry models. Annals of Statistics 32:384-406.
- Kent, J.T. (1982). Robust properties of likelihood ratio tests. Biometrika 69:19-27.
- Lindsay, B.G. (1988). Composite likelihood methods. Contemporary Mathematics 80:221-239.
- Louis, T.A. (1984). Estimating a population of parameter values using Bayes and empirical Bayes methods. Journal of the American Statistical Association 79:393-398.
- Luce, R.D. (1959). Individual Choice Behavior. Wiley, New York.
- Murphy, K.M. & Topel, R.H. (1985). Estimation and inference in two-step econometric models. Journal of Business and Economic Statistics 3:370-379.
- Pace, L., Salvan, A. & Sartori, N. (2011). Adjusting composite likelihood ratio statistics. Statistica Sinica 21:129-148.
- Piepho, H.-P., Mรถhring, J., Schulz-Streeck, T. & Ogutu, J.O. (2012). A stage-wise approach for the analysis of multi-environment trials. Biometrical Journal 54:844-860.
- Plackett, R.L. (1975). The analysis of permutations. Applied Statistics 24:193-202.
- Thompson, S.G. & Sharp, S.J. (1999). Explaining heterogeneity in meta-analysis: a comparison of methods. Statistics in Medicine 18:2693-2708.
- Tierney, L. & Kadane, J.B. (1986). Accurate approximations for posterior moments and marginal densities. Journal of the American Statistical Association 81:82-86.
- Varin, C., Reid, N. & Firth, D. (2011). An overview of composite likelihood methods. Statistica Sinica 21:5-42.
- Zermelo, E. (1929). Die Berechnung der Turnier-Ergebnisse als ein Maximumproblem der Wahrscheinlichkeitsrechnung. Mathematische Zeitschrift 29:436-460.