Eigen_lsSolve {EigenR} | R Documentation |
Linear least-squares problems
Description
Solves a linear least-squares problem.
Usage
Eigen_lsSolve(A, b, method = "cod")
Arguments
A |
a |
b |
a vector of length |
method |
the method used to solve the problem, either |
Value
The solution X
of the least-squares problem AX ~= b
(similar to lm.fit(A, b)$coefficients
). This is a matrix if
b
is a matrix, or a vector if b
is a vector.
Examples
set.seed(129)
n <- 7; p <- 2
A <- matrix(rnorm(n * p), n, p)
b <- rnorm(n)
lsfit <- Eigen_lsSolve(A, b)
b - A %*% lsfit # residuals
[Package EigenR version 1.3.0 Index]