R: Solves a linear inverse model using least distance...
Ldei
R Documentation
Solves a linear inverse model using least distance programming
Description
Solves a linear inverse model using least distance programming,
i.e. minimizes the sum of squared unknowns.
Input presented either:
as matrices E, F, A, B, G, H (Ldei.double)
as a list (Ldei.lim) or
as a lim input file (Ldei.limfile)
Usage
Ldei(...)
## S3 method for class 'lim'
Ldei(lim, ...)
## S3 method for class 'limfile'
Ldei(file, verbose = TRUE, ...)
## S3 method for class 'character'
Ldei(...)
## S3 method for class 'double'
Ldei(...)
Arguments
lim
a list that contains the linear inverse model
specification, as generated by function setup.limfile.
file
name of the inverse input file.
verbose
if TRUE: prints warnings and messages to the screen.
...
other arguments passed to function
ldei from packagelimSolve.
Details
Solves the following inverse problem:
min(∑ {Cost_i*x_i}^2)
subject to
Ax=B
Gx>=H
Value
a list containing:
X
vector containing the solution of the least distance problem.
unconstrained.Solution
vector containing the unconstrained
solution of the least distance problem.
residualNorm
scalar, the sum of residuals of equalities and
violated inequalities.
solutionNorm
scalar, the value of the quadratic function
at the solution.
IsError
logical, TRUE, if an error occurred.
Error
ldei error text.
type
ldei.
Author(s)
Karline Soetaert <karline.soetaert@nioz.nl>
References
Lawson C.L.and Hanson R.J. 1974. SOLVING LEAST SQUARES PROBLEMS,
Prentice-Hall
Lawson C.L.and Hanson R.J. 1995. Solving Least Squares Problems.
SIAM classics in applied mathematics, Philadelphia. (reprint of book)
See Also
ldei, the more general function from package limSolve.
Linp, to solve the linear inverse problem by linear programming.
Lsei, to solve the linear inverse problem by lsei (least
squares with equality and inequality constraints).
function ldei from packagelimSolve.
Examples
Ldei(LIMRigaAutumn)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LIM)
Loading required package: limSolve
Loading required package: diagram
Loading required package: shape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LIM/Ldei.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Ldei
> ### Title: Solves a linear inverse model using least distance programming
> ### Aliases: Ldei Ldei.lim Ldei.limfile Ldei.character Ldei.double
> ### Keywords: algebra array optimize
>
> ### ** Examples
>
> Ldei(LIMRigaAutumn)
$X
P1->CO2 Flow(P2,CO2)=ZeroOrder Flow(Z,CO2)=ZeroOrder
17.225012 29.953988 30.195805
Flow(N,CO2)=ZeroOrder Flow(B,CO2)=ZeroOrder Flow(CO2,P1)=ZeroOrder
13.402970 244.992226 31.318203
Flow(CO2,P2)=ZeroOrder Flow(P1,Z)=ZeroOrder Flow(P1,N)=ZeroOrder
54.461797 10.494312 4.122970
Flow(P1,DOC)=ZeroOrder P1->Sedimentation Flow(P2,DOC)=ZeroOrder
1.565910 0.100000 2.723090
Flow(P2,Z)=ZeroOrder Flow(P2,D)=ZeroOrder Flow(P2,Sedimentation)
16.797554 4.457164 0.340000
Flow(N,DOC)=ZeroOrder Flow(N,Z)=ZeroOrder Flow(Z,DOC)=ZeroOrder
0.000000 0.000000 3.963226
Flow(Z,D)=ZeroOrder Z->Sedimentation Flow(D,Z)=ZeroOrder
3.183226 0.780000 12.340390
Flow(D,DOC)=ZeroOrder D->Sedimentation Flow(B,N)=ZeroOrder
0.000000 13.920000 9.440000
B->Sedimentation Flow(DOC,B)=ZeroOrder
0.000000 261.182226
$unconstrained.solution
[1] 73.895069 77.009074 70.779434 66.099004 47.987419 44.447002
[7] 41.332998 3.115635 7.796066 -38.269768 0.100000 -35.155764
[13] 6.229640 -7.279952 0.340000 -46.065834 -4.680430 -41.385404
[19] -13.509592 0.780000 13.509592 -27.875811 12.196674 7.716674
[25] 1.723326 64.177419
$residualNorm
[1] 4.761706e-09
$solutionNorm
[1] 135370.4
$IsError
[1] FALSE
$type
[1] "ldei"
>
>
>
>
>
> dev.off()
null device
1
>