Lsei {LIM} | R Documentation |
Solves a linear inverse model using the least squares method
Input presented as:
Useful for solving overdetermined food webs.
Lsei(...) Lsei.double(...) Lsei.lim(lim, exact=NULL, parsimonious = FALSE, ...) Lsei.limfile(file, exact=NULL, parsimonious = FALSE, verbose=TRUE, ...) Lsei.character(...)
lim |
a list that contains the linear inverse model specification, as generated by function Setup |
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 |
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 specified by 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 0s
For overdetermined food web 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 food web is underdetermined, an alternative is to use Ldei
instead.
This will return the parsimonious food web.
The results should be similar with Lsei(...,parsimonious=TRUE)
.
In theory both Lsei.lim
and Ldei
should return the same value for underdetermined systems.
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 |
if an error occurred |
Error |
error text |
type |
lsei |
Karline Soetaert <k.soetaert@nioo.knaw.nl>
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.lim(LIMRigaAutumn,parsimonious=TRUE)