make_cross_kernel() builds a correlation-scale
positive-semidefinite block relatedness matrix
K_star = rbind(cbind(A_H, C_HP), cbind(t(C_HP), A_P)), where A_H
and A_P are within-lineage relatedness matrices and C_HP is the
cross-lineage bridge induced by the association matrix W. Pass
K_star to a kernel_*() term (for example
kernel_latent(..., K = K_star)) or to
phylo_latent(..., vcv = K_star, unique = TRUE). This helper only
builds the input kernel; extract_Gamma() reads the fitted
cross-lineage block.
Arguments
- A_H, A_P
Numeric square correlation matrices for the host and partner lineages. Both must be symmetric, positive semidefinite, and have unit diagonal.
- W
Numeric association matrix with
nrow(W) == nrow(A_H)andncol(W) == nrow(A_P). IfWhas row or column names, they are aligned toA_H/A_Pnames before the kernel is built.- rho
Scalar bridge strength in
[-1, 1]. Larger absolute values put more covariance in the off-diagonal host-partner block.- eps
Positive numerical floor used when taking symmetric square roots and scaling an all-zero or near-zero
W.
Value
A numeric correlation matrix with the host block first and the
partner block second. The matrix carries lightweight metadata for
downstream extractors, including the fixed rho used to build the
host-partner bridge.
Examples
A_H <- matrix(c(
1.0, 0.3, 0.1,
0.3, 1.0, 0.2,
0.1, 0.2, 1.0
), 3, 3, byrow = TRUE)
A_P <- matrix(c(1.0, 0.25, 0.25, 1.0), 2, 2)
W <- matrix(c(1, 0, 0.5, 0, 1, 0.25), 3, 2, byrow = TRUE)
K_star <- make_cross_kernel(A_H, A_P, W, rho = 0.4)
min(eigen(K_star, symmetric = TRUE, only.values = TRUE)$values)
#> [1] 0.5732877
