tsls                   package:sem                   R Documentation

_T_w_o-_S_t_a_g_e _L_e_a_s_t _S_q_u_a_r_e_s

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

     Fits an equation in a structural-equation model by two-stage least
     squares. This
 is equivalent to direct instrumental-variables
     estimation when the number of
 instruments is equal to the number
     of predictors.

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


     tsls(object, ...)
     tsls.formula(model, instruments, data, subset, na.action, contrasts=NULL)
     tsls.default(y, X, Z, names=NULL)

     print.tsls(x, ...)
     summary.tsls(object, digits=4, ...)
     anova.tsls(object, model.2, s2, dfe, ...)

     fitted.tsls(object, ...)
     residuals.tsls(object, ...)
     coefficients.tsls(object, ...)

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

   model: model formula for structural equation to be estimated; a
          regression
 constant is implied if not explicitly omitted.

instruments: one-sided model formula specifying instrumental variables.

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

  subset: an optional vector specifying a subset of observations to be
          used in 
 fitting the model.

na.action: a function that indicates what should happen when the 
 data
          contain `NAs'. 
 The default is set by the `na.action'
          option.

contrasts: an optional list. See the `contrasts.arg' of 
          `model.matrix.default'.

       y: Response-variable vector.

       X: Matrix of predictors, including a constant (if one is in the
          model).

       Z: Matrix of instrumental variables, including a constant (if
          one is in the model).

   names: optional character vector of names for the columns of the `X'
          matrix.

x, object, model.2: objects of class `tsls' returned by `tsls.formula',
          
 containing nested models
 to be compared by an incremental
          F-test. One model should be nested in the other; the
 order
          of models is immaterial.

      s2: an optional estimate of error variance for the denominator of
          the F-test. 
 If missing, the error-variance estimate is
          taken from the larger model.

     dfe: optional error degrees of freedom, to be specified when an
          estimate of error
 variance is given.

  digits: number of digits for summary output.

     ...: not for the user.

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

     `tsls.formula' returns an object of class `tsls', with the
     following components:
 

       n: number of observations.

       p: number of parameters.

coefficients: parameter estimates.

       V: estimated covariance matrix of coefficients.

       s: residual standard error.

residuals: vector of residuals.

response: vector of response values.

       X: model matrix.

       Z: instrumental-variables matrix.

response.name: name of response variable, or expression evaluating to
          response.

 formula: model formula.

instruments: one-sided formula for instrumental variables.

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

     John Fox jfox@mcmaster.ca

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

     Fox, J. (1979)
 Simultaneous equation models and two-stage
     least-squares.
 In Schuessler, K. F. (ed.)
 Sociological
     Methodology 1979, Jossey-Bass.

     Greene, W. H. (1993)
 Econometric Analysis, Second Edition,
     Macmillan.

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

     `sem'

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


     data(Kmenta)
     attach(Kmenta)

     summary(tsls(Q ~ P + D, ~ D + F + A))     # demand equation

     ##  2SLS Estimates
     ##  
     ##  Model Formula: Q ~ P + D
     ##  
     ##  Instruments: ~D + F + A
     ##  
     ##  Residuals:
     ##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
     ##  -3.43e+00 -1.24e+00 -1.89e-01 -2.49e-13  1.58e+00  2.49e+00 
     ##  
     ##              Estimate Std. Error t value  Pr(>|t|)
     ##  (Intercept)  94.6333    7.92084  11.947 1.076e-09
     ##  P            -0.2436    0.09648  -2.524 2.183e-02
     ##  D             0.3140    0.04694   6.689 3.811e-06
     ##  
     ##  Residual standard error: 1.9663 on 17 degrees of freedom

     summary(tsls(Q ~ P + F + A, ~ D + F + A)) # supply equation

     ##  2SLS Estimates
     ##  
     ##  Model Formula: Q ~ P + F + A
     ##  
     ##  Instruments: ~D + F + A
     ##  
     ##  Residuals:
     ##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
     ##  -4.87e+00 -1.26e+00  6.42e-01 -5.64e-12  1.47e+00  3.49e+00 
     ##  
     ##              Estimate Std. Error t value  Pr(>|t|)
     ##  (Intercept)  49.5324   12.01053   4.124 7.954e-04
     ##  P             0.2401    0.09993   2.402 2.878e-02
     ##  F             0.2556    0.04725   5.410 5.785e-05
     ##  A             0.2529    0.09966   2.538 2.193e-02
     ##  
     ##  Residual standard error: 2.4576 on 16 degrees of freedom


     anova(tsls(Q ~ P + F + A, ~ D + F + A),
         tsls(Q ~ 1, ~ D + F + A))

     ##  Analysis of Variance
     ##  
     ##  Model 1:  Q ~ P + F + A   Instruments: ~D + F + A
     ##  Model 2:  Q ~ 1   Instruments: ~D + F + A
     ##  
     ##          Res.Df     RSS Df Sum of Sq      F  Pr(>F)
     ##  Model 1     16  96.633                            
     ##  Model 2     19 268.114  3   171.481 4.0507 0.02553


