lm.fit {stats} | 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,
singular.ok = TRUE, ...)
lm.wfit(x, y, w, offset = NULL, method = "qr", tol = 1e-7,
singular.ok = TRUE, ...)
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 |
singular.ok |
logical. If |
... |
currently disregarded. |
Value
a list with components
coefficients |
|
residuals |
|
fitted.values |
|
effects |
(not null fits) |
weights |
|
rank |
integer, giving the rank |
df.residual |
degrees of freedom of residuals |
qr |
(not null fits) the QR decomposition, see |
See Also
lm
which you should use for linear least squares regression,
unless you know better.
Examples
require(utils)
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))