| query_relationship | R Documentation |
Retrieves relationship coefficients between individuals from a pedmat object. For compact matrices, automatically handles lookup of merged full-siblings.
query_relationship(x, id1, id2 = NULL)
x |
A pedmat object created by |
id1 |
Character, first individual ID. |
id2 |
Character, second individual ID. If |
For compact matrices (compact = TRUE), this function automatically
maps individuals to their family representatives. For methods A, D, and AA,
it can compute the correct relationship even between merged full-siblings
using the formula:
A: a_{ij} = 0.5 * (a_{is} + a_{id}) where s, d are parents
D: d_{ij} = a_{ij}^2 (for full-sibs in same family)
AA: aa_{ij} = a_{ij}^2
If id2 is provided: numeric value (relationship coefficient)
If id2 is NULL: named numeric vector (id1's row)
Returns NA if individual not found
Inverse matrices (Ainv, Dinv, AAinv) are not supported because inverse matrix elements do not represent meaningful relationship coefficients.
pedmat, expand_pedmat
tped <- tidyped(small_ped)
A <- pedmat(tped, method = "A", compact = TRUE)
# Query specific pair
query_relationship(A, "A", "B")
# Query merged full-siblings (works with compact)
query_relationship(A, "Z1", "Z2")
# Get all relationships for one individual
query_relationship(A, "A")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.