## Marker-derived GBLUP for genotyped animals.
set.seed(2)
ids <- paste0("animal", seq_len(12))
markers <- matrix(sample(c(-1, 0, 1), 12 * 80, replace = TRUE), nrow = 12,
dimnames = list(ids, NULL))
G <- A.mat(markers)
## Blend slightly with the identity so this small illustrative G is positive
## definite, then construct APY precision for a six-animal core.
G <- 0.95 * G + 0.05 * diag(nrow(G))
dimnames(G) <- list(ids, ids)
Ginv.apy <- APY(G, core = ids[seq_len(6)])
phenotypes <- data.frame(
id = factor(rep(ids, each = 3), levels = ids),
y = rnorm(length(ids) * 3)
)
fit <- mmes(y ~ 1,
random = ~vsm(ism(id), Gu = Ginv.apy),
rcov = ~units,
data = phenotypes,
control = mmes_control(diagnostics = list(verbose = FALSE)))
## In a single-step evaluation, this APY approximation supplies G^{-1} for
## the genotyped block correction; it is not itself the complete H^{-1}.
Run the code above in your browser using DataLab