Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lm.gls

Fit Linear Models by Generalized Least Squares


Description

Fit linear models by Generalized Least Squares

Usage

lm.gls(formula, data, W, subset, na.action, inverse = FALSE,
       method = "qr", model = FALSE, x = FALSE, y = FALSE,
       contrasts = NULL, ...)

Arguments

formula

a formula expression as for regression models, of the form response ~ predictors. See the documentation of formula for other details.

data

an optional data frame, list or environment in which to interpret the variables occurring in formula.

W

a weight matrix.

subset

expression saying which subset of the rows of the data should be used in the fit. All observations are included by default.

na.action

a function to filter missing data.

inverse

logical: if true W specifies the inverse of the weight matrix: this is appropriate if a variance matrix is used.

method

method to be used by lm.fit.

model

should the model frame be returned?

x

should the design matrix be returned?

y

should the response be returned?

contrasts

a list of contrasts to be used for some or all of

...

additional arguments to lm.fit.

Details

The problem is transformed to uncorrelated form and passed to lm.fit.

Value

An object of class "lm.gls", which is similar to an "lm" object. There is no "weights" component, and only a few "lm" methods will work correctly. As from version 7.1-22 the residuals and fitted values refer to the untransformed problem.

See Also


MASS

Support Functions and Datasets for Venables and Ripley's MASS

v7.3-54
GPL-2 | GPL-3
Authors
Brian Ripley [aut, cre, cph], Bill Venables [ctb], Douglas M. Bates [ctb], Kurt Hornik [trl] (partial port ca 1998), Albrecht Gebhardt [trl] (partial port ca 1998), David Firth [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.