Learn R Programming

sem (version 2.1-0)

tsls: Two-Stage Least Squares

Description

Fits a regression equation, such as 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.

Usage

## S3 method for class 'formula':
tsls(formula, instruments, data, subset, na.action, contrasts=NULL, ...)
## S3 method for class 'default':
tsls(y, X, Z, names=NULL, ...)

## S3 method for class 'tsls':
print(x, ...)
## S3 method for class 'tsls':
summary(object, digits=4, ...)
## S3 method for class 'tsls':
anova(object, model.2, s2, dfe, ...)

## S3 method for class 'tsls':
fitted(object, ...)
## S3 method for class 'tsls':
residuals(object, ...)
## S3 method for class 'tsls':
coef(object, ...)
## S3 method for class 'tsls':
vcov(object, ...)

Arguments

formula
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 argument 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, for anova 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.
...
arguments to be passed down.

Value

  • tsls.formula returns an object of class tsls, with the following components:
  • nnumber of observations.
  • pnumber of parameters.
  • coefficientsparameter estimates.
  • Vestimated covariance matrix of coefficients.
  • sresidual standard error.
  • residualsvector of residuals.
  • responsevector of response values.
  • Xmodel matrix.
  • Zinstrumental-variables matrix.
  • response.namename of response variable, or expression evaluating to response.
  • formulamodel formula.
  • instrumentsone-sided formula for instrumental variables.

References

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.

See Also

sem

Examples

Run this code
summary(tsls(Q ~ P + D, ~ D + F + A, data=Kmenta))     # demand equation

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

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

Run the code above in your browser using DataLab