powered by
mnls computes the minimum norm solution to the least squares problem.
mnls
mnls(x, y, rcond = 1e-10)
design matrix of dimension n by p.
n
p
response vector of length n, or response matrix of dimension n by q.
q
reciprocal condition number to determine the effective rank of x.
x
The least squares solution, as a p by q matrix. It has an attribute called rank, which is the effective rank of x.
rank
The underlying C code calls the LAPACK routine DGELSY.
# NOT RUN { x <- matrix(rnorm(500L), 100L, 5L) x <- cbind(x, x[, 1L] + x[, 2L], x[, 1L] - x[, 3L]) b <- -3L : 3L y <- c(x %*% b) mnls(x, y) # different to b # }
Run the code above in your browser using DataLab