internalIV: Constructs Internal Instrumental Variables From Data

Description Usage Arguments Value References See Also Examples

View source: R/internalIV.R

Description

The function can be used to construct additional instruments to be supplied to hmlewbel as additional instruments in the "EIV" argument.

Usage

1
2
internalIV(y, X, P, G = c("x2", "x3", "lnx", "1/x"), IIV = c("g", "gp",
  "gy", "yp", "p2", "y2"), data = NULL)

Arguments

y

the vector or matrix containing the dependent variable.

X

the data frame or matrix containing the exogenous regressors of the model.

P

the endogenous variables of the model as columns of a matrix or dataframe.

G

the functional form of G. It can take four values, x2, x3,lnx or 1/x. The last two forms are conditional on the values of the exogenous variables: greater than 0 or different from 0 respectively.

IIV

the internal instrumental variable to be constructed. It can take six values, "g","gp","gy","yp","p2"or"y2". See the "Details" section of hmlewbel for a description of the internal instruments.

data

optional data frame or list containing the variables in the model.

Value

Returns a vector/matrix constructed from the data whcih can be used as instrumental variable either in hmlewbel or in any other function/algorithm making use of instruments.

References

Lewbel, A. (1997). "Lewbel, A. (1997). 'Constructing Instruments for Regressions with Measurement Error when No Additional Data Are Available, with An Application to Patents and R&D'. Econometrica, 65(5), 1201-1213."

See Also

hmlewbel

Examples

1
2
3
4
5
6
7
8
9
# load data
data(dataHMLewbel)
y <- dataHMLewbel$y
X <- cbind(dataHMLewbel$X1,dataHMLewbel$X2)
colnames(X) <- c("X1","X2")
P <- dataHMLewbel$P
# build an instrument gp = (G - mean(G))(P - mean(P))  using the internalIV() function
# with G = "x3" meaning G(X) = X^3
eiv <- internalIV(y,X,P, G ="x3", IIV = "gp")

Rgui/REndo_1.0 documentation built on May 10, 2017, 9:16 a.m.