The function provides instrumental variable estimation of treatment effects when both the endogenous treatment and its instrument are binary. Applicable to both binary and continuous outcomes.

1 2 |

`formula` |
specification of the outcome model in the form like either |

`treatment` |
A vector containing the binary treatment. |

`instrument` |
A vector containing the binary instrument for the endogenous treatment. |

`data` |
an optional data frame. If unspecified, the data will be taken from the working environment. |

`method` |
the estimation method to be used. The default is “LS", standing for least squares. “ML", standing for maximum likelihood, is an alternative. |

`AME` |
whether average marginal effects (AME) should be reported. The default is FALSE, in which case marginal effects at the means (MEM) are reported. |

`optimizer` |
the optimization algorithm for the ML method. It should be one of “Nelder-Mead", “BFGS", “CG", “L-BFGS-B", “SANN", or “Brent". See |

`zProb` |
a vector containing the probability of receiving the treatment inducement (i.e., instrument = 1) that have been estimated by semiparametrical methods. |

`larf`

is the high-level interface to the work-horse function `larf.fit`

. A set of standard methods (including `print`

, `summary`

, `coef`

, `vcov`

, `fitted`

, `resid`

, `predict`

) can be used to extract the corresponding information from a `larf`

object.

The function provides instrumental variable estimation of treatment effects when both the endogenous treatment and its instrument (i.e., the treatment inducement) are binary. The method (Abadie, 2003) involves two steps. First, pseudo-weights are constructed from the probability of receiving the treatment inducement. By default the function estimates the probability by a Probit regression. But it also allows users to employ the probability that has been estimated by semiparametric methods. Second, the pseudo-weights are used to estimate the local average response function of the outcome conditional on the treatment and covariates. The function provides both least squares and maximum likelihood estimates of the conditional treatment effects.

`coefficients` |
Estimated coefficients. |

`SE` |
Standard errors of the estimated coefficients. |

`MargEff` |
Estimated marginal effects, available only for binary outcomes. |

`MargStdErr` |
Standard errors of the estimated marginal effects, available only for binary outcomes. |

`vcov` |
Variance covariance matrix of the estimated coefficients. |

`fitted.values` |
Predicted outcomes based on the estimated model. They are probabilities when the outcome is binary. |

We derived part of the code from the Matlab code written by Professor Alberto Abadie, available at http://www.hks.harvard.edu/fs/aabadie/larf.html. We thank Onur Altindag and Behzad Kianian for helpful suggestions on improving the computation.

Weihua An, Departments of Sociology and Statistics, Indiana University Bloomington, weihuaan@indiana.edu.

Xuefu Wang, Department of Statistics, Indiana University Bloomington, wangxuef@umail.iu.edu.

Abadie, Alberto. 2003. "Semiparametric Instrumental Variable Estimation of Treatment Response Models." *Journal of Econometrics* 113: 231-263.

An, Weihua and Xuefu Wang. 2016. "LARF: Instrumental Variable Estimation of Causal Effects through Local Average Response Functions." *Journal of Statistical Software* 71(1): 1-13.

Zeileis, Achim and Yves Croissant. 2010. "Extended Model Formulas in R: Multiple Parts and Multiple Responses." *Journal of Statistical Software* 34(1): 1-13. http://www.jstatsoft.org/v34/i01/.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
data(c401k)
attach(c401k)
## Not run:
# Continuous outcome. Treatment effects of participation in 401(k)
# on net family financial assest
est1 <- larf(nettfa ~ inc + age + agesq + marr + fsize, treatment = p401k,
instrument = e401k, data = c401k)
summary(est1)
# Nonparametric estimates of the probability of
# receiving the treatment inducement
library(mgcv)
firstStep <- gam(e401k ~ s(inc) + s(age) + s(agesq) + marr + s(fsize),
data=c401k, family=binomial(link = "probit"))
zProb <- firstStep$fitted
est2<- larf(nettfa ~ inc + age + agesq + marr + fsize, treatment = p401k,
instrument = e401k, data = c401k, zProb = zProb)
summary(est2)
# Binary outcome. Treatment effects of participation in 401(k)
# on participation in IRA
est3 <- larf(pira ~ inc + age + agesq + marr + fsize, treatment = p401k,
instrument = e401k, data = c401k)
summary(est3)
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.