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.
Lsei(...)
# S3 method for double
Lsei(...)
# S3 method for lim
Lsei(lim, exact = NULL, parsimonious = FALSE, ...)
# S3 method for limfile
Lsei(file, exact = NULL, parsimonious = FALSE,
verbose = TRUE, ...)
# S3 method for character
Lsei(...)
a list containing:
vector containing the solution of the least squares problem.
scalar, the sum of residuals of equalities and violated inequalities.
scalar, the value of the minimised quadratic function at the solution.
TRUE
if an error occurred.
error text.
lsei.
a list that contains the linear inverse model
specification, as generated by function setup.limfile
.
if not NULL
, a vector containing the numbers of
the equations to be solved exactly; if NULL
, all equations
are considered exact.
if TRUE
, also minimises the sum of squared
unknowns.
name of the inverse input file.
if TRUE
: when reading the file,
prints warnings and messages to the screen.
other arguments passed to function
lsei
from packagelimSolve
.
Karline Soetaert <karline.soetaert@nioz.nl>
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.
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.
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
Lsei(LIMRigaAutumn, parsimonious = TRUE)
Run the code above in your browser using DataLab