Lsei                   package:LIM                   R Documentation

_S_o_l_v_e_s _a _l_i_n_e_a_r _i_n_v_e_r_s_e _m_o_d_e_l _u_s_i_n_g _t_h_e _l_e_a_s_t _s_q_u_a_r_e_s _m_e_t_h_o_d.

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     Lsei(...)
     Lsei.double(...)
     Lsei.lim(lim, exact=NULL, parsimonious = FALSE, ...)
     Lsei.limfile(file, exact=NULL, parsimonious = FALSE, 
                  verbose=TRUE, ...)
     Lsei.character(...)

_A_r_g_u_m_e_n_t_s:

    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
          package'limSolve'. 

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     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. 

_A_u_t_h_o_r(_s):

     Karline Soetaert <k.soetaert@nioo.knaw.nl>

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     '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 package'limSolve'

_E_x_a_m_p_l_e_s:

       Lsei.lim(LIMRigaAutumn,parsimonious=TRUE)

