Description Usage Arguments Value References See Also Examples

The function can be used to construct additional instruments to be supplied to `hmlewbel`

as additional instruments
in the "EIV" argument.

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

`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, |

`IIV` |
the internal instrumental variable to be constructed. It can take six values, |

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

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.

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."

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")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.