lm_fit: Linear Model Fitter

Description Usage Arguments Details Value Examples

View source: R/lm_fit.r

Description

A basic linear model fitter.

Usage

1
2
lm_fit(x, y, offset = NULL, tol = 1e-07, singular.ok = TRUE,
  check.rank = TRUE, ...)

Arguments

x

The input data matrix.

y

The vector/matrix of independent variable(s).

offset

A vector to be included in the predictors.

tol

Numerical tolerance for the QR.

singular.ok

logical; if FALSE, then the function will error if a singular (rank-degenerate) model is detected.

check.rank

logical; if TRUE, then the rank-revealing algorithm will be used. Otherwise the model is assumed to be full rank.

...

Extra arguments; ignored with a warning, as in lm.fit()

Details

The outputs are identical to those of R's lm.fit(), though the internals differe significantly.

By default, lm_fit() will behave exactly as R's lm.fit() though with a very different backend. R uses the very old and deprecated LINPACK (library, not the benchmark) routines for fitting a linear model, whereas linmod uses more recent LAPACK routines. The former exclusively uses level 1 BLAS, while the latter makes use of level 3 BLAS, which allows for better performance by better utilizing CPU cache.

Value

A list containing the elements:

coefficients
residuals
effects
rank
fitted.values
assign
qr
df.residual

where qr is a list consisting of the elements:

qr
qraux
pivot
tol
rank

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(linmod)

n <- 10
p <- 3
x <- matrix(rnorm(n*p), n, p)
y <- rnorm(n)

lm_fit(x, y)

## End(Not run)

wrathematics/linmod documentation built on May 4, 2019, 10:52 a.m.