sparse_lm: Fit Linear Model using sparse matrices

Description Usage Arguments Value See Also

View source: R/sparse_lm.R

Description

sparse_lm uses sparse matrices and a iterative solver to fit linear models. The sparse iterative solvers are from the Eigen C++ library. Currently, only the Conjugate Gradient algorithm has been implemented with a diagonal preconditioner.

Usage

1
sparse_lm(X, y, x0, maxiter = 4L * ncol(X), tol = .Machine$double.eps)

Arguments

X

a sparse matrix of the class dgCMatrix-class.

y

a numeric vector with response variable.

x0

a numeric vector of length ncol(X) with an initial guess. If it's not provided it will default to a zero-vector.

maxiter

an integer scalar with the maximum number of iterations. A good choice is usually 4 * ncol(X).

tol

a numeric scalar with the relative error tolerance.

Value

A list with the elements

coefficients

The estimated coefficients from solver.

itr

A scalar denoting the number of iterations.

error

A scalar denoting the the relative error at the last iteration.

fitted.values

A vector with the fitted values.

residuals

The vector with the residuals.

See Also

See Eigen C++ library for documentation on Eigen library and Conjugate Gradient for more information about this method.


tstev/tstevR documentation built on May 18, 2020, 10:57 p.m.