
Linear mixed-model estimation
morie_mixed_models.RdHenderson's mixed-model equations, BLUE/BLUP via the V matrix, EM and REML estimation of the variance components.
Usage
morie_one_way(groups)
morie_mme(X, Z, y, Sigma_inv, R_inv = NULL)
morie_blue_blup_v(X, Z, y, Sigma, R = NULL)
morie_em_lmm(X, Z, y, D0 = NULL, sigma2_0 = 1, n_iter = 200L, tol = 1e-10)
morie_lmm_loglik(X, Z, y, D, R = NULL, beta = NULL)
morie_reml_loglik(X, Z, y, D, R = NULL)Arguments
- y
numeric response vector
- X
fixed-effect design matrix
- Z
random-effect design matrix
- groups
argument
groups; not described in the source.- Sigma_inv
argument
Sigma_inv; not described in the source.- R_inv
argument
R_inv; not described in the source.- Sigma
argument
Sigma; not described in the source.- R
argument
R; not described in the source.- D0
argument
D0; not described in the source.- sigma2_0
argument
sigma2_0; not described in the source.- n_iter
argument
n_iter; not described in the source.- tol
argument
tol; not described in the source.- D
argument
D; not described in the source.- beta
argument
beta; not described in the source.
Value
A list holding the fitted quantities for the method called: point estimates, fitted values and any diagnostics it produces. See the individual method descriptions above for the components each returns.
Details
These functions mirror, in R, the implementations in the Python package
morie; the two are checked against each other by the parity
tests in tests/testthat/.
Examples
set.seed(1)
n <- 12; q <- 3
X <- cbind(1, rnorm(n))
Z <- diag(q)[sample(1:q, n, replace = TRUE), ]
u <- rnorm(q, 0, 1)
y <- as.numeric(X %*% c(1, 0.5) + Z %*% u + rnorm(n, 0, 0.3))
morie_mme(X, Z, y, Sigma_inv = diag(q))
#> $blue
#> [1] 1.7088626 0.5702941
#>
#> $blup
#> [1] -0.15068478 0.11947382 0.03121096
#>