GLS
utilizes lm.fit
and Cholesky decomposition to fit a
generalized least squares regression
GLS(y, X, R = NULL, L = NULL, coef_only = FALSE)
response variable
design matrix
residual covariance or correlation matrix (can be sparse), ignored
if L
is provided.
lower triangular matrix of the Cholesky decomposition of R
(optional).
reduces the output of the model to the estimated coefficients (and the generalized residual sums of squares) only.
GLS
a list
of
coef
: a table of estimates and standard errors
R2
: the R-squared of the model fit
sigma2
: the residual variance
GSSE
: the generalized residual sum of squares (objective function
score)
coef_vcov
: the error variance matrix of the estimates
Note that the size of R
does not matter (i.e. if R
is
multiplied by a scalar, the results don't change). Note also that the
R-squared is estimated as 1-GSSE/GSST, where GSSE is the generalized
residual sum of squares (i.e. the objective function score of the model)
and GSST is the generalized total sum of squares (i.e. the objective
function score of the model when only the intercept is included in the
model)