Skip to contents

Formula: Y = X beta + Z b + eps (eq. 5.1) with b ~ N(0, D), eps ~ N(0, R) and Cov(eps, b) = 0, so E(Y) = X beta and Var(Y) = Z D Z' + R. Returns the GLS/BLUE of beta, the BLUP of b and the marginal variance.

Usage

Msm010(X, Z, y, D, R = NULL)

Arguments

X

Fixed-effects design matrix.

Z

Random-effects design matrix.

y

Response vector.

D

Random-effects covariance matrix.

R

Residual covariance matrix; identity when NULL.

Value

List with estimate, beta, blup, V, loglik, method.

References

Montesinos Lopez, Montesinos Lopez & Crossa (2022), Multivariate Statistical Machine Learning Methods for Genomic Prediction, Springer, eq. (5.1) p.141. DOI 10.1007/978-3-030-89010-0.

Examples

set.seed(11)
g <- rep(1:5, each = 4)
X <- cbind(1, rnorm(20)); Z <- model.matrix(~ factor(g) - 1)
y <- as.numeric(X %*% c(2, 1) + Z %*% rnorm(5, sd = 0.7) + rnorm(20))
f <- Msm010(X, Z, y, D = diag(0.5, 5))
f$beta
#> [1] 1.5617975 0.8602308