Calculates the MLE of the coefficients of the usual linear regression model (LM).
lm_fit(y, X, w)
y | Vector of observations of length |
---|---|
X | Mean covariate matrix of size |
w | Optional positive weights vector of length |
MLE estimate of beta
as a vector of length p
.
The LM model is defined as $$ \boldsymbol{y}_i \mid \boldsymbol{x}_i \stackrel{\mathrm{ind}}{\sim} \mathcal{N}(\boldsymbol{x}_i'\boldsymbol{\beta}, 1/w_i), $$ where for each subject \(i\), \(y_i\) is the response, \(\boldsymbol{x}_i \in \mathbb{R}^p\) is the mean covariate vector, and \(w_i\) is an optional positive weight (defaults to 1).
Warning: This R wrapper function provides a direct interface to the C++ source code. Incorrect argument specification may lead to abrupt termination of the R session.