systemfit             package:systemfit             R Documentation

_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 linear structural equations using Ordinary Least
     Squares (OLS), Weighted Least Squares (WLS), Seemingly Unrelated
     Regression (SUR), Two-Stage Least Squares (2SLS), Weighted
     Two-Stage Least Squares (W2SLS) or Three-Stage Least Squares
     (3SLS).

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

     systemfit( method, eqns, eqnlabels=names(eqns),
                inst=NULL, data=list(), R.restr=NULL,
                q.restr=matrix(0,max(nrow(R.restr),0),1),
                TX=NULL, maxiter=1, tol=1e-5,
                rcovformula=1, centerResiduals = FALSE, formula3sls="GLS",
                probdfsys=!(is.null(R.restr) & is.null(TX)),
                single.eq.sigma=(is.null(R.restr) & is.null(TX)),
                solvetol=.Machine$double.eps,
                saveMemory=( nrow(data) * length(eqns) > 1000 &&
                   length(data) > 0 ) )

     systemfitClassic( method, formula, eqnVar, timeVar, data,
                       pooled = FALSE, ... )

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

  method: the estimation method, one of "OLS", "WLS", "SUR", "WSUR",
          "2SLS", "W2SLS", "3SLS", or "W3SLS" (see details); iterated
          estimation methods can be specified by setting argument
          'maxiter' larger than 1 (e.g. 500).

    eqns: a list of structural equations to be estimated; a regression
          constant is implied if not explicitly omitted.

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, W2SLS and 3SLS estimations).

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

 R.restr: an optional j x k matrix to impose linear restrictions on the
          parameters by 'R.restr' * b = 'q.restr' (j = number of
          restrictions, k = number of all parameters, b = vector of all
          parameters).

 q.restr: an optional j x 1 matrix to impose linear restrictions (see
          'R.restr'); default is a j x 1 matrix that contains only
          zeros.

      TX: an optional matrix to transform the regressor matrix and,
          hence, also the coefficient vector (see details).

 maxiter: maximum number of iterations for WLS, SUR, W2SLS and 3SLS
          estimations.

     tol: tolerance level indicating when to stop the iteration (only
          WLS, SUR, W2SLS and 3SLS estimations).

rcovformula: formula to calculate the estimated residual covariance
          matrix (see details).

centerResiduals: logical. Subtract the means from the residuals of each
          equation before calculating the estimated residual covariance
          matrix.

formula3sls: formula for calculating the 3SLS estimator, one of "GLS",
          "IV", "GMM", "Schmidt" or "EViews" (see details).

probdfsys: use the degrees of freedom of the whole system (in place of
          the degrees of freedom of the single equation) to calculate
          prob values for the t-test of individual parameters.

single.eq.sigma: use different sigma^2s for each single equation to
          calculate the covariance matrix and the standard errors of
          the coefficients (only OLS and 2SLS).

solvetol: tolerance level for detecting linear dependencies when
          inverting a matrix or calculating a determinant (see 'solve'
          and 'det').

saveMemory: logical. Save memory by omitting some calculation that are
          not crucial for the basic estimation (e.g McElroy's R^2)?

 formula: formula to be estimated (for each equation).

  eqnVar: variable name indicating the equation to which the
          observation belongs.

 timeVar: variable name indicating the time.

  pooled: logical, restrict coefficients to be equal in all equations.

     ...: arguments passed to 'systemfit'.

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

     'systemfitClassic' is a wrapper function for 'systemfit' that can
     be applied to panel-like data in long format if the regressors are
     the same for all equations.

     If argument 'method' is "WSUR" or "W3SLS", the "SUR" or "3SLS"
     estimation uses a residual variance covariance matrix that is
     calculated from a "WLS" or "W2SLS" estimation, respectively (and
     not from an "OLS" or "2SLS" estimation as for a standard "SUR" or
     "3SLS" estimation). The "WSUR" method is the default method of
     command "TSCS" in the software LIMDEP that carries out "SUR"
     estimations in which all coefficient vectors are constrained to be
     equal (personal information from W.H. Greene, 2006/02/16). If no
     cross-equation restrictions are imposed, "WSUR" and "W3SLS"
     generate identical results compared to "SUR" and "3SLS",
     respectively.

     The matrix 'TX' transforms the regressor matrix (X) by X^{*} = X *
     'TX'. Thus, the vector of coefficients is now b = 'TX' cdot b^{*}
     , where b is the original (stacked) vector of all coefficients and
     b^{*} is the new coefficient vector that is estimated instead.
     Thus, the elements of vector b are b_i = sum_j TX_{ij} cdot
     b^{*}_j 
      The 'TX' matrix can be used to change the order of the
     coefficients and also to restrict coefficients (if 'TX' has less
     columns than it has rows). However restricting coefficients by the
     'TX' matrix is less powerfull and flexible than the restriction by
     providing the 'R.restr' matrix and the 'q.restr' vector. The
     advantage of restricting the coefficients by the 'TX' matrix is
     that the matrix that is inverted for estimation gets smaller by
     this procedure, while it gets larger if the restrictions are
     imposed by 'R.restr' and 'q.restr'.

     If iterated (WLS, SUR, W2SLS or 3SLS estimation with 'maxit'>1),
     the convergence criterion is

 sqrt{ frac{ sum_i (b_{i,g} - b_{i,g-1})^2 }{ sum_i b_{i,g-1}^2 }} < 'tol'

     (b_{i,g} is the ith coefficient of the gth iteration step).

     The formula to calculate the estimated covariance matrix of the
     residuals (hat{Sigma}) can be one of the following (see Judge et
     al., 1985, p. 469): 
      if rcovformula=0:

            hat{sigma}_{ij} = frac{hat{e}_i' hat{e}_j}{T}

     if rcovformula=1 or rcovformula='geomean':

 hat{sigma}_{ij} = frac{hat{e}_i' hat{e}_j} {sqrt{(T - k_i)*(T - k_j)}}

     if rcovformula=2 or rcovformula='Theil':

 hat{sigma}_{ij} = frac{hat{e}_i' hat{e}_j}{T - k_i - k_j + tr[X_i(X_i'X_i)^{-1}X_i'X_j(X_j'X_j)^{-1}X_j']}

     if rcovformula=3 or rcovformula='max':

   hat{sigma}_{ij} = frac{hat{e}_i' hat{e}_j} {T - max( k_i, k_j)}

     If i = j, formula 1, 2 and 3 are equal. All these three formulas
     yield unbiased estimators for the diagonal elements of the
     residual covariance matrix. If i neq j, only formula 2 yields an
     unbiased estimator for the residual covariance matrix, but it is
     not neccessarily positive semidefinit. Thus, it is doubtful
     whether formula 2 is really superior to formula 1 (Theil, 1971, p.
     322).

     The formulas to calculate the 3SLS estimator lead to identical
     results if the same instruments are used in all equations. If
     different instruments are used in the different equations, only
     the GMM-3SLS estimator ("GMM") and the 3SLS estimator proposed by
     Schmidt (1990) ("Schmidt") are consistent, whereas "GMM" is
     efficient relative to "Schmidt" (see Schmidt, 1990).

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

     'systemfit' returns a list of the class 'systemfit' 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
     'systemfit.equation' and contain the results that belong only to
     the regarding equation.

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

  method: estimation method.

       g: number of equations.

       n: total number of observations.

       k: total number of coefficients.

      ki: total number of linear independent coefficients.

      df: degrees of freedom of the whole system.

    iter: number of iteration steps.

       b: vector of all estimated coefficients.

      bt: coefficient vector transformed by 'TX'.

      se: estimated standard errors of 'b'.

       t: t values for 'b'.

       p: p values for 'b'.

    bcov: estimated covariance matrix of 'b'.

   btcov: covariance matrix of 'bt'.

    rcov: estimated residual covariance matrix.

   drcov: determinant of 'rcov'.

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

   olsr2: System OLS R-squared value.

  mcelr2: McElroys R-squared value for the system (only SUR and 3SLS).

       y: vector of all (stacked) endogenous variables

       x: matrix of all (diagonally stacked) regressors

       h: matrix of all (diagonally stacked) instrumental variables
          (only 2SLS and 3SLS)

    data: data frame of the whole system (including instruments)

 R.restr: the restriction matrix.

 q.restr: the restriction vector.

      TX: matrix used to transform the regressor matrix.

 maxiter: maximum number of iterations.

     tol: tolerance level indicating when to stop the iteration

rcovformula: formula to calculate the estimated residual covariance
          matrix

formula3sls: formula for calculating the 3SLS estimator.

probdfsys: system degrees of freedom to calculate prob values?.

single.eq.sigma: different sigma^2s for each single equation?.

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

data.name: name of the data.frame used for estimation.

      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.

   inst*: instruments of the ith equation (only 2SLS and 3SLS).

      n*: number of observations of the ith equation.

      k*: number of coefficients/regressors in the ith equation
          (including the constant).

     ki*: number of linear independent coefficients in the ith equation
          (including the constant differs from 'k' only if there are
          restrictions that are not cross-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'.

      y*: vector of endogenous variable (response values) of the ith
          equation.

      x*: matrix of regressors (model matrix) of the ith equation.

      h*: matrix of instrumental variables of the ith equation (only
          2SLS and 3SLS).

   data*: data frame (including instruments) of the ith equation.

 fitted*: vector of fitted 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,
      Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

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

     Greene, W. H. (2003) _Econometric Analysis, Fifth Edition_,
     Prentice Hall.

     Judge, George G.; W. E. Griffiths; R. Carter Hill; Helmut
     Luetkepohl and Tsoung-Chao Lee (1985) _The Theory and Practice of
     Econometrics, Second Edition_, Wiley.

     Kmenta, J. (1997) _Elements of Econometrics, Second Edition_,
     University of Michigan Publishing.

     Schmidt, P. (1990) _Three-Stage Least Squares with different
     Instruments for different equations_, Journal of Econometrics 43,
     p. 389-394.

     Theil, H. (1971) _Principles of Econometrics_, Wiley, New York.

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

     'lm' and 'nlsystemfit'

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

     data( "Kmenta" )
     eqDemand <- consump ~ price + income
     eqSupply <- consump ~ price + farmPrice + trend
     system <- list( demand = eqDemand, supply = eqSupply )

     ## OLS estimation
     fitols <- systemfit("OLS", system, data=Kmenta )
     print( fitols )

     ## OLS estimation with 2 restrictions
     Rrestr <- matrix(0,2,7)
     qrestr <- matrix(0,2,1)
     Rrestr[1,3] <-  1
     Rrestr[1,7] <- -1
     Rrestr[2,2] <- -1
     Rrestr[2,5] <-  1
     qrestr[2,1] <-  0.5
     fitols2 <- systemfit("OLS", system, data = Kmenta,
                           R.restr = Rrestr, q.restr = qrestr )
     print( fitols2 )

     ## iterated SUR estimation
     fitsur <- systemfit("SUR", system, data = Kmenta, maxit = 100 )
     print( fitsur )

     ## 2SLS estimation
     inst <- ~ income + farmPrice + trend
     fit2sls <- systemfit( "2SLS", system, inst = inst, data = Kmenta )
     print( fit2sls )

     ## 2SLS estimation with different instruments in each equation
     inst1 <- ~ income + farmPrice
     inst2 <- ~ income + farmPrice + trend
     instlist <- list( inst1, inst2 )
     fit2sls2 <- systemfit( "2SLS", system, inst = instlist, data = Kmenta )
     print( fit2sls2 )

     ## 3SLS estimation with GMM-3SLS formula
     inst <- ~ income + farmPrice + trend
     fit3sls <- systemfit( "3SLS", system, inst = inst, data = Kmenta,
        formula3sls = "GMM" )
     print( fit3sls )

     ## Examples how to use systemfitClassic()
     ## Repeating the OLS and SUR estimations in Theil (1971, pp. 295, 300)
     data( "GrunfeldTheil" )
     formulaGrunfeld <- invest ~ value + capital
     # OLS
     theilOls <- systemfitClassic( "OLS", formulaGrunfeld, "firm", "year",
        data = GrunfeldTheil )
     summary( theilOls )
     # SUR
     theilSur <- systemfitClassic( "SUR", formulaGrunfeld, "firm", "year",
        data = GrunfeldTheil, rcovformula = 0 )
     summary( theilSur )

     ## Further examples are in the documentation to the data sets
     ## 'KleinI' and 'GrunfeldGreene'.

