Skip to contents

The Hadamard construction of g_epistasis() is not restricted to additive-by-additive. Under the orthogonal partition the relationship matrix of an interaction between two effect types is the elementwise product of their relationship matrices, so with G the additive and D the dominance matrix, G_AD = G * D and G_DD = D * D, each rescaled so its diagonal averages one. Higher orders follow the same rule: G_AAA = G * G * G.

Usage

g_epistasis_ad(g, d)

g_epistasis_dd(d)

g_epistasis_order(g, order = 2L)

Arguments

g

additive relationship matrix, as from g_matrix()

d

dominance relationship matrix, as from g_dominance()

order

for g_epistasis_order(), how many additive factors to multiply: 2 is g_epistasis(), 3 is additive-by-additive-by-additive

Value

relationship matrix with the dimnames of the input, rescaled to unit mean diagonal; ridge it before kernel() if the input was singular

Details

Two warnings that belong with the formula rather than after it. The orthogonality that makes these terms separable holds under Hardy-Weinberg and linkage equilibrium; away from it the terms correlate and the partition of variance stops being clean. And every order added is a covariance component the data has to support: a fit with additive, dominance and three epistatic terms asks five variances of a design that usually struggles to give two, and the components collapse to the boundary rather than informing anything. Add an order because a hypothesis calls for it, never because the function exists.

Examples

geno <- list(ids = c("a", "b", "c"),
             m = rbind(c(0, 1, 2), c(2, 1, 0), c(1, 1, 1)))
G <- g_matrix(geno)
D <- g_dominance(geno)
g_epistasis_ad(G, D)["a", "b"]
#> [1] -1.5