Skip to contents

associate_pairs() estimates a named within-row association after fitting two marginal models. It never refits, updates, profiles, or otherwise alters either margin. The reviewed Arc 6 slices implement fixed-effect Gaussian margins paired with literal Bernoulli binomial(link = "logit") or ordinary nbinom2() margins, literal Bernoulli paired with ordinary nbinom2(), two literal Bernoulli margins, and two ordinary nbinom2() margins, on the same complete analysis rows.

Usage

associate_pairs(fit_1, fit_2, kernel, association)

Arguments

fit_1, fit_2

Two fitted drmTMB marginal models. They must use the identical complete analysis data, in the same order.

kernel

A named association kernel. Arc 6 accepts only latent_normal().

association

Association formula. Most Arc 6 pair classes accept only ~ 1. The beta Bernoulli x ordinary-NB2 route accepts an intercept-bearing fixed-effect formula, including multiple predictors, factors, interactions, and explicit transformations. Random effects, offsets, missing values, aliased columns, and . expansion are not supported.

Value

An object of class drm_pair_association.

Details

The fitted parameter eta is a Gaussian-copula latent-normal association. It is neither rho12(), an observed-scale correlation, nor corpairs(). The corpair() formula marker is a distinct interface. The stage-2 Hessian treats the margins as fixed and is not used for uncertainty. For every admitted pair route, vcov() and confint() instead use a two-stage Godambe covariance that propagates fitted-margin uncertainty when the fit-specific calculation succeeds. These alpha-scale routes are interval-feasible. The retained Bernoulli x ordinary-NB2 intercept campaign supports the stronger inference-ready-with-caveats tier. Intercept-only associations also expose bounded eta intervals through confint(object, type = "eta"); predict.drm_pair_association() supplies delta-method eta standard errors and pointwise transformed intervals. Profiles remain unavailable.

Examples

set.seed(20260723)
dat <- data.frame(x = rnorm(80))
z_g <- rnorm(80)
z_b <- 0.35 * z_g + sqrt(1 - 0.35^2) * rnorm(80)
dat$trait_continuous <- 0.2 + 0.5 * dat$x + z_g
dat$trait_binary <- as.integer(z_b > qnorm(0.6))

gaussian_fit <- drmTMB(
  bf(mu = trait_continuous ~ x, sigma = ~ 1),
  family = gaussian(), data = dat
)
binary_fit <- drmTMB(
  bf(mu = trait_binary ~ x), family = binomial(), data = dat
)
assoc <- associate_pairs(
  gaussian_fit, binary_fit,
  kernel = latent_normal(), association = ~ 1
)
association(assoc)
#>          kernel                  estimand       eta   status boundary
#> 1 latent_normal latent-normal association 0.4289665 interior    FALSE
sqrt(diag(vcov(assoc)))
#> Warning: Association uncertainty is interval-feasible; coverage is not yet calibrated
#> for this route.
#>  The two-stage Godambe covariance passed fit-specific diagnostics. Treat the
#>   Wald interval as experimental until a route-specific coverage campaign is
#>   completed.
#>     alpha 
#> 0.1476121 
confint(assoc)
#> Warning: Association uncertainty is interval-feasible; coverage is not yet calibrated
#> for this route.
#>  The two-stage Godambe covariance passed fit-specific diagnostics. Treat the
#>   Wald interval as experimental until a route-specific coverage campaign is
#>   completed.
#>           2.5 %    97.5 %
#> alpha 0.1693156 0.7479442
confint(assoc, type = "eta")
#> Warning: Association uncertainty is interval-feasible; coverage is not yet calibrated
#> for this route.
#>  The two-stage Godambe covariance passed fit-specific diagnostics. Treat the
#>   Wald interval as experimental until a route-specific coverage campaign is
#>   completed.
#>         2.5 %    97.5 %
#> eta 0.1677158 0.6339203