Cross-family dependence: statistical foundations
Status — Experimental (engine), paper-section reference
The cross-family route is Experimental and not release-ready: the evidence is a set of simulated fixtures covering five family pairs (test/test_mixed_family.jl) and there is no interval-coverage study. The maths below is what the code evaluates; the release status is what limits its use. See Evidence & limits. This page is the methods reference for the cross-family bivariate model implemented by fit_mixed_family in src/mixed_family.jl, with the link-scale standardisation in src/link_residual.jl. It documents the shared-latent construction, the Gauss–Hermite marginal likelihood, the link-residual variances rho12 Gaussian model. It is written to paper-section standard; every formula here is the one the code evaluates.
1. Motivation and scope
The bivariate Gaussian model (bf(mu1=…, mu2=…, sigma1=…, sigma2=…, rho12=…)) couples two responses through a residual correlation
The cross-family model removes that restriction. It couples two responses that may come from different families — Gaussian × Poisson, Gamma × Beta, negative-binomial × Binomial, and so on — through a single shared per-observation latent variable, and reports the induced dependence as a correlation on the latent (link) scale, rho12 bivariate Gaussian (Section 7), so it is a strict generalisation rather than a separate object.
Throughout, the two axes are indexed
2. The shared-latent construction
Each observation
Here
Each axis uses its family's canonical link, so
Dispersion sub-model
Dispersion-carrying families also estimate a per-observation log-native dispersion
with design matrix
| Family | Conditional density at node | |
|---|---|---|
Gaussian | residual SD | |
Poisson | — | |
Binomial | — | |
NegBinomial2 | size | |
Beta | SD | |
Gamma | SD |
The full parameter vector is
where
3. The Gauss–Hermite marginal likelihood
Because
with _mf_obs_ll).
Change of variables to Gauss–Hermite form
Gauss–Hermite quadrature approximates
The
evaluated with the numerically stable
Why quadrature, not Laplace
For this model the integrand is genuinely one-dimensional, so a
4. Link-residual standardisation
The loadings
The key quantity is the family's own observation-level variance on its link scale, the distribution-specific variance
so the latent-scale variance of axis link_residual and is reporting-only: it never enters the fit objective.
Per-family derivations
The link-residual map is exactly Nakagawa & Schielzeth's (2010, Table 2; see also Nakagawa, Johnson & Schielzeth 2017) distribution-specific variance for each family's canonical link, evaluated at a representative fitted mean
| Family | Link | Origin | |
|---|---|---|---|
Gaussian | identity | residual variance enters the latent scale directly | |
Poisson | delta-method / lognormal variance of | ||
Binomial | variance of a standard logistic; distribution-free | ||
NegBinomial2 | lognormal-approx. dispersion term, | ||
Gamma | variance of | ||
Beta | variance of |
A few derivations worth spelling out, because they are the ones a reader will want to check:
Gaussian,
. With an identity link the residual is on the link scale, so its variance enters directly. This differs from the GLLVM / gllvmTMB convention, which reports for a Gaussian trait because there the residual variance lives in a separatecovariance block. In this shared-latent parameterisation there is no separate : setting would force for Gaussian × Gaussian. is the value verified by the exact Gaussian × Gaussian ≡rho12parity (Section 7).Poisson,
. Under thelink a Poisson mean with has, to the lognormal / delta-method order used throughout Nakagawa & Schielzeth, an observation-level variance on the log scale of , refined to (the exact lognormal-matching expression that reproducesfor large while staying finite and positive for small ). It is evaluated at the representative mean . Binomial,
. On thelink the observation variance is taken as the variance of the standard logistic distribution, . This is the standard latent-threshold value (the variance of the logistic latent in a logit model) and is distribution-free — it does not depend on or any dispersion. Gamma,
. With alink and shape ,for has variance(the trigamma function is exactly the variance ofof a Gamma deviate). Here is the squared coefficient of variation, the package's Gamma sigma-slot convention.NegBinomial2,
. The lognormal-approximation distribution-specific variance contributed by the size/dispersionon the link, matching gllvmTMB's nbinom2entry.Beta,
. For the variance of is the sum of the trigamma terms of the two Beta shape parameters (precision ), evaluated at.
5. The latent-scale correlation and identifiability
With the latent variances
This is the cross-family generalisation of a residual correlation: it is the correlation of the two latent linear predictors after each axis is standardised by its own total link-scale variance.
Identifiability
Three identifiability facts govern how
so
Gaussian × non-Gaussian: fully identified. When at least one axis is non-Gaussian, that axis has no free residual variance competing with the loading on the same scale (its observation variance
is fixed by the mean / dispersion, not by ). All parameters — , both loadings, the dispersions, and hence — are then separately identified. Gaussian × Gaussian: only
and identified. When both axes are Gaussian the model has a flat ridge in the individual loadings: the marginal is exactly bivariate normal (Section 7), and a bivariate normal is fully described by its means, the two marginal variances , and the covariance. The split of between the loadingand the residual is not separately identified (any on the ridge gives the same marginal variance). What is identified is precisely the marginal-covariance summary: the log-likelihood and the correlation . This is not a defect — is the only cross-axis quantity the data can speak to in the Gaussian × Gaussian case, and it is exactly the bivariate rho12(Section 7). Reported individual loadings on this ridge should not be over-interpreted; the log-likelihood andare the trustworthy outputs.
6. Confidence intervals for {#6.-Confidence-intervals-for-\rho}
Three intervals for
6.1 Fisher- Wald (delta-method)
The default interval. Let
and the
with (NaN, NaN) rather than a spurious number — the same honesty discipline the engine applies whenever the observed information is singular.
6.2 Profile likelihood
The recommended interval when the Wald approximation is doubted (small
The profile deviance at
and the profile-likelihood interval is the set
6.3 Parametric bootstrap
The most robust and most expensive interval, useful as an external check on the two analytic intervals. At the fitted _mf_rand) — refit the model to each replicate, and collect the bootstrap correlations
the empirical (NaN, NaN).
7. Exact reduction to the rho12 bivariate model
When both axes are Gaussian the cross-family model is not an approximation of the bivariate Gaussian — it is algebraically identical to it, and
Take
and marginalising the Gaussian
so
This is exactly the bivariate Gaussian fitted by bf(mu1=…, mu2=…, sigma1=…, sigma2=…, rho12=…), whose residual correlation is
Substituting the Gaussian link-residual
The marginal model is the same as the rho12 bivariate Gaussian model. A finite Gauss–Hermite rule is still a numerical quadrature approximation here: its polynomial-degree exactness does not make a Gaussian-density integrand exact. Thus fitted likelihood values need numerical agreement checks at a stated tolerance. The mathematical equivalence identifies the same
8. Summary of the construction
| Object | Expression | Where |
|---|---|---|
| Linear predictor | §2 | |
| Shared latent | §2 | |
| Dispersion sub-model | §2 | |
| Marginal likelihood | §3 | |
| Link-residual variance | §4 | |
| Latent correlation | §5 | |
| Sign fix | §5 | |
| CIs | Fisher- | §6 |
| Gaussian × Gaussian | rho12 bivariate Gaussian, | §7 |
References
Nakagawa, S., & Schielzeth, H. (2010). Repeatability for Gaussian and non-Gaussian data: a practical guide for biologists. Biological Reviews, 85(4), 935–956. — distribution-specific link-scale variances
. Nakagawa, S., Johnson, P. C. D., & Schielzeth, H. (2017). The coefficient of determination
and intra-class correlation coefficient from generalized linear mixed-effects models revisited and expanded. Journal of the Royal Society Interface, 14(134), 20170213. — the observation/link-scale variance decomposition used here. Skrondal, A., & Rabe-Hesketh, S. (2004). Generalized Latent Variable Modeling: Multilevel, Longitudinal, and Structural Equation Models. Chapman & Hall/CRC. — shared-latent (common-factor) construction for cross-response dependence.
Niku, J., Hui, F. K. C., Taskinen, S., & Warton, D. I. (2019). gllvm: Fast analysis of multivariate abundance data with generalized linear latent variable models in R. Methods in Ecology and Evolution, 10(12), 2173–2182. — GLLVM latent-variable dependence and link-scale standardisation (the gllvmTMB
link_residual_per_traitlineage this implementation mirrors).Golub, G. H., & Welsch, J. H. (1969). Calculation of Gauss quadrature rules. Mathematics of Computation, 23(106), 221–230. — the Gauss–Hermite nodes/weights.
See also
Choosing response families — the families that can appear on either axis.
Which scale are you modelling? — link vs response scale.
Laplace vs variational marginals — why a 1-D quadrature beats a Laplace match for the shape/dispersion parameters.
fit_mixed_family(insrc/mixed_family.jl) — the fitting function this page documents.