GLS: Generalized least square

View source: R/GLS.R

GLSR Documentation

Generalized least square

Description

GLS utilizes lm.fit and Cholesky decomposition to fit a generalized least squares regression

Usage

GLS(y, X, R = NULL, L = NULL, coef_only = FALSE)

Arguments

y

response variable

X

design matrix

R

residual covariance or correlation matrix (can be sparse), ignored if L is provided.

L

lower triangular matrix of the Cholesky decomposition of R (optional).

coef_only

reduces the output of the model to the estimated coefficients (and the generalized residual sums of squares) only.

Details

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)

Value

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

Author(s)

Geir H. Bolstad


GHBolstad/evolvability documentation built on Feb. 12, 2023, 5:06 a.m.