# mte: Fitting a Marginal Treatment Effects (MTE) Model. In localIV: Estimation of Marginal Treatment Effects using Local Instrumental Variables

## Description

`mte` fits a MTE model using either the semiparametric local instrumental variables (local IV) method or the normal selection model (Heckman, Urzua, Vytlacil 2006). The user supplies a formula for the treatment selection equation, a formula for the outcome equations, and a data frame containing all variables. The function returns an object of class `mte`. Observations that contain NA (either in `selection` or in `outcome`) are removed.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```mte( selection, outcome, data = NULL, method = c("localIV", "normal"), bw = NULL ) mte_localIV(mf_s, mf_o, bw = NULL) mte_normal(mf_s, mf_o) ```

## Arguments

 `selection` A formula representing the treatment selection equation. `outcome` A formula representing the outcome equations where the left hand side is the observed outcome and the right hand side includes predictors of both potential outcomes. `data` A data frame, list, or environment containing the variables in the model. `method` How to estimate the model: either "`localIV`" for the semiparametric local IV method or "`normal`" for the normal selection model. `bw` Bandwidth used for the local polynomial regression in the local IV approach. Default is 0.25. `mf_s` A model frame for the treatment selection equations returned by `model.frame` `mf_o` A model frame for the outcome equations returned by `model.frame`

## Details

`mte_localIV` estimates \textup{MTE}(x, u) using the semiparametric local IV method, and `mte_normal` estimates \textup{MTE}(x, u) using the normal selection model.

## Value

An object of class `mte`.

 `coefs` A list of coefficient estimates: `gamma` for the treatment selection equation, `beta10` (intercept) and `beta1` (slopes) for the baseline outcome equation, `beta20` (intercept) and `beta2` (slopes) for the treated outcome equation, and `theta1` and `theta2` for the error covariances when `method = "normal"`. `ufun` A function representing the unobserved component of \textup{MTE}(x, u). `ps` Estimated propensity scores. `ps_model` The propensity score model, an object of class `glm` if `method = "localIV"`, or an object of class `selection` if `method = "normal"`. `mf_s` The model frame for the treatment selection equation. `mf_o` The model frame for the outcome equations. `complete_row` A logical vector indicating whether a row is complete (no missing variables) in the original `data` `call` The matched call.

## References

Heckman, James J., Sergio Urzua, and Edward Vytlacil. 2006. "Understanding Instrumental Variables in Models with Essential Heterogeneity." The Review of Economics and Statistics 88:389-432.

`mte_at` for evaluating MTE at different values of the latent resistance u; `mte_tilde_at` for evaluating MTE projected onto the propensity score; `ace` for estimating average causal effects from a fitted `mte` object.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```mod <- mte(selection = d ~ x + z, outcome = y ~ x, data = toydata, bw = 0.25) summary(mod\$ps_model) hist(mod\$ps) mte_vals <- mte_at(u = seq(0.05, 0.95, 0.1), model = mod) if(require("ggplot2")){ ggplot(mte_vals, aes(x = u, y = value)) + geom_line(size = 1) + xlab("Latent Resistance U") + ylab("Estimates of MTE at Mean Values of X") + theme_minimal(base_size = 14) } ```