Skip to contents

Formula: log L = -(n/2) log(2 pi) - n log(sigma) - (1/(2 sigma^2)) (y - X beta)'(y - X beta)

Usage

Mlloglik(X, y, beta = NULL, sigma2 = NULL)

Arguments

X

Design matrix, one record per row.

y

Response vector of length n.

beta

Coefficients; None uses the OLS solution, which is also the MLE.

sigma2

Error variance; None uses the MLE RSS/n.

Value

List with loglik, beta, sigma2, rss, n, p.

References

Montesinos Lopez, Montesinos Lopez and Crossa (2022), Multivariate Statistical Machine Learning Methods for Genomic Prediction, Springer, doi:10.1007/978-3-030-89010-0. Chapter 3, Sect. 3.3 pp. 75-76: the likelihood of the multiple linear regression model, its logarithm as written above, and the maximum likelihood estimators – beta-hat is the OLS solution and sigma2-hat = (1/n)(y - X beta-hat)'(y - X beta-hat), which divides by n and not by n - p. Read from the chapter PDF, not recalled.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
D <- data.frame(x = c(1, 2, 3, 4), y = c(2, 4, 5, 9))
Mlloglik(V, D)
#> $loglik
#> [1] -13.18809
#> 
#> $beta
#> [1] 0.8382353
#> 
#> $sigma2
#> [1] 1.582721
#> 
#> $rss
#> [1] 12.66176
#> 
#> $n
#> [1] 8
#> 
#> $p
#> [1] 1
#> 
#> $method
#> [1] "Gaussian ML log-likelihood, MVSML Sect. 3.3"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"