Bare-bones linear model fitting function
fastLm estimates the linear model using the
function of the
GNU GSL library.
1 2 3 4 5 6 7
a vector containing the explained variable.
a model matrix.
a symbolic description of the model to be fit.
an optional data frame containing the variables in the model.
Linear models should be estimated using the
lm function. In
lm.fit may be appropriate.
fastLmPure function provides a reference use case of the
library via the wrapper functions in the RcppGSL package.
fastLm function provides a more standard implementation of
a linear model fit, offering both a default and a formula interface as
Lastly, one must be be careful in timing comparisons of
lm and friends versus this approach based on
Armadillo. The reason that
do something like
lm.fit faster than the functions in
the stats package is because they use the Lapack version
of the QR decomposition while the stats package uses a modified
Linpack version. Hence
Armadillo uses level-3 BLAS code
whereas the stats package uses level-1 BLAS. However,
Armadillo will choke on rank-deficient model matrices whereas
the functions from the stats package will handle them properly due to
the modified Linpack code. Statisticians want a pivoting scheme of
“pivot only on (apparent) rank deficiency” and numerical
analysts have no idea why statisticians want this so it is not part of
conventional linear algebra software.
fastLmPure returns a list with three components:
a vector of coefficients
a vector of the (estimated) standard errors of the coefficient estimates
a scalar denoting the degrees of freedom in the model
fastLm returns a richer object which also includes the
residuals and call similar to the
The GNU GSL library is being written by team of authors with the overall development, design and implementation lead by Brian Gough and Gerard Jungman. RcppGSL is written by Romain Francois and Dirk Eddelbuettel.
GNU GSL project: http://www.gnu.org/software/gsl
1 2 3 4 5 6 7 8 9