Description Usage Arguments Details Value See Also Examples
kclass
fits instrumental variables models using
k-class estimators.
1 2 3 |
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. |
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.
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. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.