nlsystemfit            package:systemfit            R Documentation

_N_o_n_l_i_n_e_a_r _E_q_u_a_t_i_o_n _S_y_s_t_e_m _E_s_t_i_m_a_t_i_o_n

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

     Fits a set of structural nonlinear equations using Ordinary Least
     Squares (OLS), Seemingly Unrelated Regression (SUR), Two-Stage
     Least Squares (2SLS), Three-Stage Least Squares (3SLS).

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

      nlsystemfit( method="OLS", eqns, startvals,
                          eqnlabels=c(as.character(1:length(eqns))), inst=NULL,
                          data=list(), solvtol=.Machine$double.eps, pl=0,
                          maxiter=1000 )

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

  method: the estimation method, one of "OLS", "SUR", "2SLS", "3SLS".

    eqns: a list of structural equations to be estimated.

startvals: a list of starting parameter values for the minimization.

eqnlabels: an optional list of character vectors of names for the
          equation labels.

    inst: one-sided model formula specifying instrumental variables or
          a list of one-sided model formulas if different instruments
          should be used for the different equations (only needed for
          2SLS, 3SLS and GMM estimations).

    data: an optional data frame containing the variables in the model.
          By default the variables are taken from the environment from
          which nlsystemfit is called.

      pl: print.level argument that is passed to the 'nlm' function. 

 solvtol: tolerance level used in the step tolerance and gradient
          tolerances arguments for 'nlm' and the tolerance for
          detecting linear dependencies in the columns of X in the 'qr'
          function calls.

 maxiter: the maximum number of iterations for the 'nlm' function.

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

     The nlsystemfit function relies on 'nlm' to perform the
     minimization of the objective functions and the 'qr' set of
     functions.

     A system of nonlinear equations can be written as:


                  epsilon_{t} = q( y_t, x_t, theta )


                           z_{t} = Z( x_t )


     where epsilon_{t} are the residuals from the y observations and
     the function evaluated at the parameter estimates. 

     The objective functions for the methods are:

       Method  Instruments          Objective Function                 Covariance of theta
       OLS         no                      r'r                  (X(diag(S)^{-1}bigotimes I)X)^{-1}
       SUR         no       r'(diag(S)_{OLS}^{-1}bigotimes I)r     (X(S^{-1}bigotimes I)X)^{-1}
       2SLS        yes              r'(I bigotimes W)r          (X(diag(S)^{-1}bigotimes I)X)^{-1}
       3SLS        yes        r'(S_{2SLS}^{-1} bigotimes W)r    (X(diag(S)^{-1}bigotimes W)X)^{-1}

     where, r is a column vector for the residuals for each equation, S
     is variance-covariance matrix between the equations
     (hat{sigma}_{ij} = (hat{e}_i' hat{e}_j) / sqrt{(T - k_i)*(T -
     k_j)}), X is matrix of the partial derivates with respect to the
     parameters, W is a matrix of the instrument variables
     Z(Z'Z)^{-1}Z, Z is a matrix of the instrument variables, and I is
     an nxn identity matrix.

     The SUR and 3SLS methods requires two solutions. The first
     solution for the SUR is an OLS solution to obtain the
     variance-covariance matrix. The 3SLS uses the variance-covatiance
     from a 2SLS solution, then fits all the equations simultaneously.  

     The user should be aware that the function is *VERY* sensative to
     the starting values and the nlm function may not converge. The nlm
     function will be called with the 'typsize' argument set the
     absolute values of the starting values for the OLS and 2SLS
     methods. For the SUR and 3SLS methods, the 'typsize' argument is
     set to the absolute values of the resulting OLS and 2SLS parameter
     estimates from the nlm result structre. In addition, the starting
     values for the SUR and 3SLS methods are obtained from the OLS and
     2SLS parameter estimates to shorten the number of iterations. The
     number of iterations reported in the summary are only those used
     in the last call to nlm, thus the number of iterations in the OLS
     portion of the SUR fit and the 2SLS portion of the 3SLS fit are
     not included.

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

     'nlsystemfit' returns a list of the class 'nlsystemfit.system' and
     contains all results that belong to the whole system. This list
     contains one special object: "eq". It is a list and contains one
     object for each estimated equation. These objects are of the class
     'nlsystemfit.equation' and contain the results that belong only to
     the regarding equation.

     The objects of the class 'nlsystemfit.system' and
     'nlsystemfit.equation' have the following components (the elements
     of the latter are marked with an asterisk (*)):

      eq: a list object that contains a list object for each equation.

  method: estimation method.

  resids: an n times g matrix of the residuals.

       g: number of equations.

       n: total number of observations.

       k: total number of coefficients.

       b: vector of all estimated coefficients.

      se: estimated standard errors of 'b'.

       t: t values for 'b'.

       p: p values for 'b'.

    bcov: estimated covariance matrix of 'b'.

    rcov: estimated residual covariance matrix.

   drcov: determinant of 'rcov'.

 rcovest: residual covariance matrix used for estimation (only SUR and
          3SLS).

    rcor: estimated residual correlation matrix.

  nlmest: results from the nlm function call

solvetol: tolerance level when inverting a matrix or calculating a
          determinant.

      eq: a list that contains the results that belong to the
          individual equations.

eqnlabel*: the equation label of the ith equation (from the labels
          list).

formula*: model formula of the ith equation.

      n*: number of observations of the ith equation.

      k*: number of coefficients/regressors in the ith equation.

     df*: degrees of freedom of the ith equation.

      b*: estimated coefficients of the ith equation.

     se*: estimated standard errors of 'b'.

      t*: t values for 'b'.

      p*: p values for 'b'.

   covb*: estimated covariance matrix of 'b'.

predicted*: vector of predicted values of the ith equation.

residuals*: vector of residuals of the ith equation.

    ssr*: sum of squared residuals of the ith equation.

    mse*: estimated variance of the residuals (mean of squared errors)
          of the ith equation.

     s2*: estimated variance of the residuals (hat{sigma}^2) of the ith
          equation.

   rmse*: estimated standard error of the residulas (square root of
          mse) of the ith equation.

      s*: estimated standard error of the residuals (hat{sigma}) of the
          ith equation.

     r2*: R-squared (coefficient of determination).

  adjr2*: adjusted R-squared value.

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

     Jeff D. Hamann jeff.hamann@forestinformatics.com

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

     Gallant, R. H. (1987) _Nonlinear Equation Estimation_, John Wiley
     and Sons, 610 pp.

     SAS Institute (1999) _SAS/ETS User's Guide, Version 8_, Cary NC:
     SAS Institute 1546 pp.

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

     'systemfit', 'nlm', and 'qr'

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

     library( systemfit )
     data( ppine )

     hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev + h4*cr)
     dg.formula <- dg ~ exp( d0 + d1*log(dbh) + d2*hg + d3*cr + d4*ba  )
     labels <- list( "height.growth", "diameter.growth" )
     inst <- ~ tht + dbh + elev + cr + ba
     start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001, h4=0.08,
                       d0=-0.5, d1=0.009, d2=0.25, d3=0.005, d4=-0.02 )
     model <- list( hg.formula, dg.formula )

     model.ols <- nlsystemfit( "OLS", model, start.values, data=ppine, eqnlabels=labels )
     print( model.ols )

     model.3sls <- nlsystemfit( "3SLS", model, start.values, data=ppine,
                                         eqnlabels=labels, inst=inst )
     print( model.3sls )

