lm.fit {base} | 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, ...)
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, ...)
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. |
The functions lm.{w}fit.null
are called by lm.fit
or
lm.wfit
respectively, when x
has zero columns.
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 |
lm
which you should use for linear least squares regression,
unless you know better.
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))