lm.fit {stats} | R Documentation |
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.
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, ...)
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. |
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 |
lm
which you should use for linear least squares regression,
unless you know better.
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))