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. Supported pairs include 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)

# S3 method for class 'drm_pair_association'
update(object, ...)

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. The current implementation accepts only latent_normal().

association

Association formula. Most supported 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.

object

A frozen-margin association object. Its update() method always refuses the call; refit the margins and construct a new association.

...

Reserved arguments. The association update() method refuses all update requests.

Value

An object of class drm_pair_association. fitted(object) returns the two fitted marginal response values or probabilities. summary(object) returns the association summary, diagnostics, and provenance (or a NULL association summary when the boundary is unresolved). simulate(object) returns one paired-response data frame for nsim = 1, or a list of such data frames for larger nsim.

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 intervals are computable, but their coverage has not been measured for every supported pair. For the Bernoulli x ordinary-NB2 intercept-only model, simulation supports interval use with caveats. 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. fitted() returns the two stored marginal response values or probabilities, not the fitted latent association. simulate() returns paired outcomes from the fitted marginal predictions and latent-normal association; it requires a resolved interior or near-boundary association and cannot be used for an unresolved boundary. profile(), quantile(), residuals(), sigma(), update(), rho12(), corpairs(), and emmeans are unavailable for this frozen-margin object. Use association() and predict() for the association estimand, and vcov() and confint() for the supported Wald uncertainty summaries. Refitting requires fitting the margins again and constructing a new association object.

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