kclass: kclass Instrumental variable estimator.

Description Usage Arguments Details Value See Also Examples

View source: R/kclass.R

Description

kclass fits instrumental variables models using k-class estimators.

Usage

1
2
3
kclass(formula, data, ..., weights = NULL, subset = NULL, offset = NULL,
  model = TRUE, x = FALSE, y = TRUE, z = FALSE, xz = FALSE,
  savefirst = FALSE)

Arguments

formula

formula specification: y ~ X1 + X2 | Z1 + Z2. If the right side is missing, the returned result is an OLS estimator.

data

a data frame or list containing the variables named in the formula.

...

additional parameters passed to kclass.fit.

weights

an optional vector of weights to be used in estimation.

subset

optional subset of observations to be used in fitting.

offset

known components with coefficient 1 to be included in the predictor. This should be NULL or a vector of length equal to the number of cases.

model,x,y,z

logicals indicating whether to return the model frame, regressors, response, and instruments used.

savefirst

logical if the first stage fitted values (or projected matrix) should be saved.

Details

K-class estimators are a generic class of instrumental regression estimators. The k is a parameter that informs the calculation of coefficients. In particular, it informs the weight of the instruments. K-class estimators include two-stage least squares (TSLS) where k=1, limited information maximum likelihood (LIML) where k is the minimum eigenvalue of the LIML matrix, and FULLER in which k is the LIML k plus an additional alpha parameter. In principal, k can take on any value, though values other than those above are not generally used.

Value

kclass returns an object of class "kclass". The function summary is used to print a summary table of results. The generic accessor functions coefficients, fitted.values, residuals, and effects provide those values.

A kclass object is a list containing the following properties:

call the matched call used to create the estimators.
coefficients a named vector of coefficients.
residuals the residuals, calculated as the response less fitted values.
fitted.values the fitted mean values. In OLS this is X'b.
weights the specified weights.
df.residual the residual degrees of freedom.
terms the model terms object.
model if requested, the model frame used.
x if requested, the endogenous variables used.
y if requested, the response variable used.
z if requested, the exogenous instruments used.

See Also

AER::ivreg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(rkclass)

#mroz
data(mroz)

# LIML model with interaction of YOB and QOB as instruments
model = kclass(LWKLYWGE ~ EDUC + as.factor(YOB) | . - EDUC + interaction(YOB, QOB), data = qob)
summary(model)
#     Estimate  Std. Error
#EDUC 0.089116   0.16110
#etc...

## Not run: 
#This is equivalent to `ivreg` from the AER package:
maer = AER::ivreg(LWKLYWGE ~ EDUC + as.factor(YOB) | . - EDUC + interaction(YOB, QOB), data = qob)
summary(maer)

#And similar to using GMM directly (warning: running this use serious resources!):
mgmm = gmm::gmm(lwage ~ exper + expersq + educ, ~ age + kidslt6 + kidsge6, data=mroz)

## End(Not run)

potterzot/rkclass documentation built on May 25, 2019, 11:24 a.m.