lm.fit {base} | R Documentation |
Fitter Functions for Linear Models
Description
These are the basic computing engines called by lm
used
to fit linear models. These should usually not be used
directly unless by experienced users.
Usage
lm.fit (x, y, offset = NULL, method = "qr", tol = 1e-7, ...)
lm.wfit(x, y, w, offset = NULL, method = "qr", tol = 1e-7, ...)
lm.fit.null (x, y, method = "qr", tol = 1e-7, ...)
lm.wfit.null(x, y, w, method = "qr", tol = 1e-7, ...)
Arguments
x |
design matrix of dimension |
y |
vector of observations of length |
w |
vector of weights (length |
offset |
numeric of length |
method |
currently, only |
tol |
tolerance for the |
... |
currently disregarded. |
Details
The functions lm.{w}fit.null
are called by lm.fit
or
lm.wfit
respectively, when x
has zero columns.
Value
a list with components
coefficients |
|
residuals |
|
fitted.values |
|
effects |
|
weights |
|
rank |
integer, giving the rank |
df.residual |
degrees of freedom of residuals |
qr |
the QR decomposition, see |
See Also
lm
which you should use for linear least squares regression,
unless you know better.
Examples
set.seed(129)
n <- 7 ; p <- 2
X <- matrix(rnorm(n * p), n,p) # no intercept!
y <- rnorm(n)
w <- rnorm(n)^2
str(lmw <- lm.wfit(x=X, y=y, w=w))
str(lm. <- lm.fit (x=X, y=y))
str(lm0 <- lm.fit.null (x=X, y=y))
str(lmw0 <- lm.wfit.null(x=X, y=y,w=w))