Learn R Programming

lmeVarComp (version 1.1)

mnls: Minimum Norm Least Squares

Description

mnls computes the minimum norm solution to the least squares problem.

Usage

mnls(x, y, rcond = 1e-10)

Arguments

x

design matrix of dimension n by p.

y

response vector of length n, or response matrix of dimension n by q.

rcond

reciprocal condition number to determine the effective rank of x.

Value

The least squares solution, as a p by q matrix. It has an attribute called rank, which is the effective rank of x.

Details

The underlying C code calls the LAPACK routine DGELSY.

Examples

Run this code
# 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