Lsei: Solves a linear inverse model using the least squares method.

View source: R/Lsei.R

LseiR Documentation

Solves a linear inverse model using the least squares method.

Description

Solves a linear inverse model using the least squares method

Input presented as:

  • matrices E, F, A, B, G, H (Lsei.double) or

  • a list (Lsei.lim) or

  • as a lim input file (Lsei.limfile)

Useful for solving overdetermined lims.

Usage

Lsei(...)
## S3 method for class 'double'
Lsei(...)
## S3 method for class 'lim'
Lsei(lim, exact = NULL, parsimonious = FALSE, ...)
## S3 method for class 'limfile'
Lsei(file, exact = NULL, parsimonious = FALSE, 
             verbose = TRUE, ...)
## S3 method for class 'character'
Lsei(...)

Arguments

lim

a list that contains the linear inverse model specification, as generated by function setup.limfile.

exact

if not NULL, a vector containing the numbers of the equations to be solved exactly; if NULL, all equations are considered exact.

parsimonious

if TRUE, also minimises the sum of squared unknowns.

file

name of the inverse input file.

verbose

if TRUE: when reading the file, prints warnings and messages to the screen.

...

other arguments passed to function lsei from packagelimSolve.

Details

Solves the following inverse problem:

\min(||AAx-BB||^2)

, the approximate equations subject to

Ex=F

, the mass balances

Gx>=H

, the constraints.

and where E and F make up the equations from A and B, as specified by vector exact.

AA and BB are the equations from A and B, NOT in vector exact.

in case exact = NULL, there are no approximate equations.

in case parsimonious = TRUE, then the sum of squared unknowns is also minimised. This means that AA is augmented with the unity matrix (of size Nunknowns) and BB contains Nunknowns additional zeros.

For overdetermined lim problems, for instance, the inverse equations may be split up in the mass balance equations which have to be exactly met and the other equations which have to be approximated.

This is, it is assumed that the first *NComponents* equations, the mass balances, should be met exactly and the call to the function is: Lsei(lim,exact = 1:lim$NComponents,...)

If the lim is underdetermined, an alternative is to use Ldei instead.

This will return the parsimonious solution.

The results should be similar with Lsei(...,parsimonious=TRUE).

In theory both Lsei.lim and Ldei should return the same value for underdetermined systems.

Value

a list containing:

X

vector containing the solution of the least squares problem.

residualNorm

scalar, the sum of residuals of equalities and violated inequalities.

solutionNorm

scalar, the value of the minimised quadratic function at the solution.

IsError

TRUE if an error occurred.

Error

error text.

type

lsei.

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

References

K. H. Haskell and R. J. Hanson, An algorithm for linear least squares problems with equality and nonnegativity constraints, Report SAND77-0552, Sandia Laboratories, June 1978.

K. H. Haskell and R. J. Hanson, Selected algorithms for the linearly constrained least squares problem - a users guide, Report SAND78-1290, Sandia Laboratories,August 1979.

K. H. Haskell and R. J. Hanson, An algorithm for linear least squares problems with equality and nonnegativity constraints, Mathematical Programming 21 (1981), pp. 98-118.

R. J. Hanson and K. H. Haskell, Two algorithms for the linearly constrained least squares problem, ACM Transactions on Mathematical Software, September 1982.

See Also

lsei, the more general function from package limSolve

Linp, to solve the linear inverse problem by linear programming

Ldei, to solve the linear inverse problem by least distance programming

function lsei from packagelimSolve

Examples

  Lsei(LIMRigaAutumn, parsimonious = TRUE)

LIM documentation built on May 11, 2022, 5:05 p.m.

Related to Lsei in LIM...