Skip to contents

\(l(beta, V; y) = -1/2 [n log(2 pi) + log|V| + (y - X beta)' V^-1 (y - X beta)]\) with beta profiled out at its GLS value \((X' V^-1 X)^-1 X' V^-1 y\), which is the maximiser for any fixed V; what is returned is therefore the profile log-likelihood in V. V must be positive definite – an inadmissible set of variance components is refused, not returned.

Usage

Mlfit(y, X, V)

Arguments

y

Response, length n.

X

Fixed-effects design, n by p.

V

Marginal variance \(Z D Z' + R\), n by n.

Value

List with estimate (log-likelihood), loglik, neg2loglik, logdet_V, quadratic_form, aic, bic, n, p.

Details

The Cholesky route is used for both the determinant and the quadratic form, so a non-positive-definite V fails at the factorisation rather than producing a finite nonsense value.

References

Hartley and Rao (1967), Biometrika 54(1-2), 93-108, doi:10.1093/biomet/54.1-2.93 .

Examples

Mlfit(y = 5L, X = 5L, V = 5L)
#> $estimate
#> [1] -1.723657
#> 
#> $loglik
#> [1] -1.723657
#> 
#> $neg2loglik
#> [1] 3.447315
#> 
#> $logdet_V
#> [1] 1.609438
#> 
#> $quadratic_form
#> [1] 0
#> 
#> $aic
#> [1] 7.447315
#> 
#> $bic
#> [1] 3.447315
#> 
#> $n
#> [1] 1
#> 
#> $p
#> [1] 1
#> 
#> $method
#> [1] "ML log-likelihood of a linear mixed model"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"