lm2sls: 2SLS Least Squares Estimation of a Linear Model

Description Usage Arguments Value Author(s) See Also Examples

Description

Provides a formula-based interface for 2SLS estimation of a linear model. Computations are done by fit2sls. The returned object has the necessary information for computing a variety of regression diagnostics.

Usage

1
2
3
4
lm2sls(formula, instruments = rhs(formula), data, subset, weights,
  na.action = getOption("na.action"), contrasts = NULL,
  singular.ok = FALSE, model = TRUE, x = TRUE, y = TRUE,
  qr = TRUE, ...)

Arguments

formula

A model formula, as for lm, specifying the response variable and the right-hand side of the model.

instruments

A one-sided formula, specifying the instrumental variables.

data

An optional data frame, list, or environment containing the variables in the model formula and instrumental-variables formula.

subset

See lm.

weights

An optional vector of inverse-variance weights; if absent the weights are set to 1 for all cases.

na.action

See lm.

contrasts

See lm.

singular.ok

If FALSE (the default) perfect collinearity in either stage of the 2SLS regression produces an error.

model

Include the model frame in the returned object.

x

Include the model matrices for the two stages in the returned object.

y

Include the response vector in the returned object.

qr

Include the QR decompositions for the two stages in the returned object.

...

Not used.

Value

An object of class "2sls", with the following elements in addition to those returned by fit2sls:

response.name

a character string with the name of the response variable or possibly the character representation of an expression evaluating to the response.

formula

the model formula.

intruments

the one-sided formula specifying the instrumental variables.

model.matrix

the model matrix corresponding to the right-hand side of the model formula.

y

the response-variable vector.

model.matrix.instruments

the model matrix for the first-stage regression.

wt.var

the name of the weight variable (for a weighted fit).

na.action

the na.action argument.

call

the function call.

contasts

contrasts for the model matrix.

contrasts.instruments

contrasts for the instrumental-variables model matrix.

xlevels

factor levels (if any) for the model matrix.

xlevels.instruments

factor levels (if any) for the instrumental variables model matrix.

terms

the terms object for the model matrix.

terms.instruments

the terms object for the instrumental variables model matrix.

model

the model frame.

Author(s)

John Fox jfox@mcmaster.ca

See Also

fit2sls, lm, formula, 2SLS_Methods, 2SLS_Diagnostics

Examples

1
2
summary(lm2sls(Q ~ P + D, ~ D + F + A, data=Kmenta))     # demand equation
summary(lm2sls(Q ~ P + F + A, ~ D + F + A, data=Kmenta)) # supply equation

john-d-fox/lm2sls documentation built on Nov. 4, 2019, 3:05 p.m.